Arduino Circuits and Code. int ledPin = 9; void setup() { pinMode(ledPin, OUTPUT); } void loop() { digitalWrite(ledPin, LOW); delay(1000); digitalWrite(ledPin,

Slides:



Advertisements
Similar presentations
EMS1EP Lecture 8 Pulse Width Modulation (PWM)
Advertisements

Servo Background Servos provide control of rotary position Servos are used extensively in the remote control hobby world for: Aircraft (flaps, ailerons,
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
Basic DC Motor Circuits
Digital & Analog Inputs. Review Fundamental parts of an Arduino program are … Setting output types using pinMode. Declaring variables Can write a digital.
Introduction to Arduino Programming January MER-421:Mechatronic System Design.
South Jersey Robotics Club July 2014 Meeting Presentation Topic –Arduino (cont)
Living with the Lab Using servos with an Arduino EAS 199A Fall 2011.
Arduino. Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It's an open-source.
Secret Door Knock Detector
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
1 Servo Motor. 2 Overview A servo motor is a motor that is only capable of rotating 180 degrees A servo motor is controlled by giving it an angle to proceed.
Basic Circuits – Lab 2 Arduino and Sensors
Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)
Manufacturing Advanced Design Applications Manufacturing © 2014 International Technology and Engineering Educators Association, STEM  Center for Teaching.
Microcontroller Hands-on Workshop #3 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers November 7, 2009.
Cascade switching of an LED EAS 199B Winter 2013.
Pulse Width Modulation (PWM). 100% Pulse Width Modulation (PWM) 0% On the chipKIT there are 490 periods per second. Use analogWrite(pin, value) to control.
Good LED Circuit 5V0 GND. What Voltage Does Meter See? Answer: 5 V.
Servos The material presented is taken from a variety of sources including:
Microprocessors Tutorial 2: Arduino Robotics. Agenda 1. Robot Anatomy 2. Sensor Review 3. PWM 4. MAKE: Fade 5. Motors 6. H Bridge 7. Robot Control library.
ARDUINO 1. Basics  Comments  /* * Blink * * The basic Arduino example. Turns on an LED on for one second, * then off for one second, and so on... We.
Servo Demonstration In MPIDE, select File > Examples > Servo > Sweep.
Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Getting Started.
Line following tips photoresistors positioned near floor photoresistor circuits © 2011 LWTL faculty team living with the lab.
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
Photoresistor resistance changes dramatically with light level living with the lab Using Photoresistors with an Arduino © 2011 LWTL faculty team.
Motor TYWu.
SAMI MAKERSPACE MAKE: AN ELECTRONICS WORKSHOP. SERVOS Precise rotations.
Anodo (+) Catodo (-) Esempi: Rosso _ Rosso – Nero- Nero + (Marrone) = 220 ohm Marrone – Nero – Nero – Marrone + (Marrone) = 1 Kohm Marrone – Nero- Nero.
Microcontroller basics Embedded systems for mortals.
Lecture 9: Introduction to Arduino Topics: Arduino Fundamentals, Bean Date: Mar 22, 2016.
Robotics Grant Agreement No LLP UK-LEONARDO-LMP Project acronym: CLEM Project title: Cloud services for E-Learning in Mechatronics Technology.
Arduino DC Motor Motion Control Instructor: Dr Matthew Khin Yi Kyaw.
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
Istituto Tecnico Industriale A.Monaco EURLAB Control a Servo Motor If you want to swing an robot arm or … steer a robot you need a special motor (Servo).
INTERNET OF EVERYTHING SDU 2016 Week 9. Physical Output  Make things move by controlling motors with Arduino  Servo-motors  Rotary actuator that allows.
Pulse-Width Modulation: Simulating variable DC output
Microcontroller basics Embedded systems for mortals.
Written by ZEDO MiniQ - 개요 DFRobot( 에서 MiniQ 2WD 기반에 Romeo V2 All-in-one 컨트롤러 사용하여 사 용자가 다양한 컨스터마이징 작업을 수행할 수 있도록 제공함
Pulse Width Modulation Instructor Dr Matthew Khi Yi Kyaw.
physical computing .2 – Day 3
Microcontroller basics
Outline Introduction to digital-to-analog converter (DAC)
Assist. Prof. Rassim Suliyev - SDU 2017
CU ATLAS Practical electronics Motion and Servos
Microcontroller basics
Microprocessors Tutorial 1: Arduino Basics
Microcontroller basics
Lab 1: Arduino Basics Topics: Arduino Fundamentals, First Circuit
Line Following Tips photoresistor circuits
Control a motors angular position with a flex sensor
Analog Input through POT
Introduction to Arduinos
IoT Programming the Particle Photon.
Servos and Stepper Motors
Line Following Tips photoresistor circuit
Chapter 5 Servomotor.
CS-4540 Robotics - Lab 05 Switch inputs to the Arduino Uno
CS4101 Introduction to Embedded Systems Lab 8: Arduino DAC and PWM
Secret Door Knock Detector
Arduino : Introduction & Programming
Programming 2: The Arduino IDE & First Sketches
Arduino Practice: Photoresistors, PWM, Potentiometers, Motors
Assist. Prof. Rassim Suliyev - SDU 2018
Sensors and actuators Sensors Resistive sensors
Arduino Motor Lab Inspired by NYU ITP project
Introduction to Arduinos
Pulse-Width Modulation: Simulating variable DC output
Servo Motor.
Presentation transcript:

Arduino Circuits and Code

int ledPin = 9; void setup() { pinMode(ledPin, OUTPUT); } void loop() { digitalWrite(ledPin, LOW); delay(1000); digitalWrite(ledPin, HIGH); delay(1000); for (int i = 0; i<=255; i++) { analogWrite(ledPin, i); delay(10); } } power led ground resistor digital and analog write (actuator - led)

it matters which way round you put the led long leg to positive Resitance = (V S - V L ) / I V S = supply voltage, V L = LED voltage, I = LED current pwm pins for analogWrite things to remember

digital read (sensor - button) int inputPin = 9; int val = 0; void setup() { pinMode(inputPin, INPUT); Serial.begin(9600); } void loop(){ val = digitalRead(inputPin); Serial.println(val); } 5V button ground pin 9 10kΩ

use serial prints for debugging resistor needed in circuit debounce things to remember

analog read (sensor - ldr) int inputPin = 5; int val = 0; void setup() { Serial.begin(9600); } void loop(){ val = analogRead(inputPin); Serial.println(val); } ldr 5V ground pin5

analog read (sensor - potentiometer)

values 0 to use map to get 0 to 255 use millis() instead of delay things to remember

servos #include Servo myservo; // create servo object to control a servo // a maximum of eight servo objects can be created int pos = 0; void setup() { myservo.attach(9); // attaches pin 9 to the servo object } void loop() { for(pos = 0; pos < 180; pos += 1) { myservo.write(pos); delay(15); } for(pos = 180; pos>=1; pos-=1) { myservo.write(pos); delay(15); }

servos common rotation range is 180º good for smooth continuous motion servo library uses pins 9 and 10 servo needs time to reach destination

steppers

#include // change this to the number of steps on your motor #define STEPS 100 Stepper stepper(STEPS, 4, 5, 6, 7); void setup() { // set the speed of the motor to 30 RPMs stepper.setSpeed(30); } void loop() { stepper.step(100); delay(1000); } *

stepper can rotate 360º can lock into fixed position - strong torque precise position setting stepper library

dc motors

const int motor1Pin = 3; const int motor2Pin = 4; const int enablePin = 9; void setup() { // set all the pins you're using as outputs: pinMode(motor1Pin, OUTPUT); pinMode(motor2Pin, OUTPUT); pinMode(enablePin, OUTPUT); // set enablePin high so that motor can turn on: digitalWrite(enablePin, HIGH); //to control the speed of the motor //analogWrite(enablePin, 30) } void loop() { digitalWrite(motor1Pin, LOW); // set leg 1 of the H-bridge low digitalWrite(motor2Pin, HIGH); // set leg 2 of the H-bridge high // swap HIGH and LOW values to change motor direction // set both HIGH or both LOW to stop motor }

dc motors torque gears direction and speed

solenoids

solenoid boolean drum[] = {1, 0, 0, 0, 0, 1, 0, 1}; int drumPin = 2; int counter; void setup() { pinMode(drumPin, OUTPUT); counter = 0; } void loop() { digitalWrite(drumPin, drum[counter]); if(counter == 7) { counter = 0; } else { counter++; } delay(200); // delay between beats }

solenoids push and pull - use springs toy hacking - reed relays