SlideShare a Scribd company logo
PHYSICAL PROTOTYPING
© 2011 K3 Creative Commons v3.0 SA-NC
Lab 6: Motors
With the Arduino prototyping board
millis()
• millis(); returns the number of milliseconds the
arduino has been on
• Useful when you want two things to happen at once
”semi threading”
• Returns a long
• Examples/Digital
/Blinkwithoutdelay
Made by: David Sjunnesson
micro()

Returns the number of microseconds since the
Arduino board began running the current
program

Returns a long

Works the same way as millis()
Random
• random(min, max)
• Returns a pseudorandom number
between min and max.
• random(10,50) returns a number
between 10-49
• randomSeed();
• randomSeed(analogRead(4)); Gives you
a better random value
Try it out
• Create a program that randomly in time sends a
random value to the computer.
map()

Re-maps a number from one range to another

Useful when a sensor sends one range of
values but you need it in another.

map(value, fromLow, fromHigh, toLow, toHigh)
constrain()

Constrains a number to be within a range.

Helps to make sure a value is in a certain range

constrain(value, minimum, maximum)
Try it out!

Create a program that maps your value from a
potentometer from the read range into another
and sends it back to the computer.
MOTOR
• Actuator that transforms electricity into movement
• Motors can be of different kinds: DC, stepper, servos, etc. Each type has a different
way of being driven
• New motors can be very expensive. In many cases we will not be interested in high
accuracy and precission, just in showing the basic functionality
• It is in those cases when dismounting some kind of motor-driven device will be
useful to acquire the basic components for our design
• Car-toys, electric razors, printers, CD-drives, old hard drives, cash registers, and
many devices contain motors that we should be able of using
TYPES OF MOTORS
• There are three main types of motors
– DC motors: they are used in toys and devices that do not need high degrees of
accuracy in terms of speed or angle. With certain circuits that can be improved
– Stepper motors: they can move to a very precise position. We find them in
printers, scanners, etc
– Servo motors will move and stop at a certain angle on request. They are used in
car models to control the direction, model-planes for the flaps, etc
TYPES OF MOTORS
• DC motors:
– run freely
– hard to control their position/speed
– can use as less as 2,5Volts
– speed can be controlled using PWM
– we use relays, transistors or H-bridges to control them from Arduino
– with encoding circuits can become very precise
DC MOTORS: PWM
• PWM stands for Pulse Width Modulation. Microprocessors cannot produce pure
analog signals, nor can they provide enough current to drive motors
• Through calculating the average value of a sequence of pulses, microprocessors
emulate the generation of analog signals
• It is with PWM that we can change the speed of a DC motor. It is anyway needed
the use of a transistor, since the pins on Arduino cannot handle the amount of
current to move the motor
PICTURES © their authors
STEPPER MOTORS
• Stepper motors:
– 2 types: unipolar or bipolar
– rotate a certain amount of degrees at each pulse
– typical values of angles are 1,8 - 3,6 - 7,2 ...
– we use transistors, transistor chips, and H-bridges to control them
– they have 4 or more wires
– RepRap
STEPPER MOTORS
SERVO
• they will rotate to a certain angle depending on a PWM value we push into them
• recently there are continuous rotation servos
• broadly used in robotics
SERVO/Continuous
• Connect the servo to the arduino
• Black ----> Arduino ground
• Red -----> Arduino 5v+
• White ----> Arduino motorPin
• Make it move Clockwise or Counter-clockwise
depending on the values read from a potentiometer
• Usefull functions is map()
SERVO/Standard
• Connect the servo to the arduino
• Black ----> Arduino ground
• Red -----> Arduino 5v+
• White ----> Arduino motorPin
• Make it move to a specified angle depending on the
values read from a analog input
• Usefull functions is map()
Power

Battery packs

Rechargables

Ampere * Volt = Watt

Biltema
Transistor
• The transistor is considered by many to be the
greatest invention of the twentieth century. It is
the key active component in practically all
modern electronics.
Transistor
• A transistor is a semiconductor device,
commonly used to amplify or switch electronic
signals. The transistor is the fundamental
building block of computers, cellular phones,
and all other modern electronic devices.
Transistor
• We use transistors for:
– turning DC devices on/off: motors, lamps, etc
– dimming DC lights
– changing the speed of motors seamlessly (using
PWM)
How to hook up a motor
using IRF Z24
Copyright Kajsa Sahlström and Matilda Marcelius
How to hook up a motor
using BC547
DANGER!
Relay
• A relay is an electrical switch that opens and closes under the
control of another electrical circuit
• Makes it possible to control big stuff with Arduino
• Control up to 220V with 5v from Arduino
• Cant control speed...
Hook it UP!

Connect a DC motor and control the speed with
a analog sensor

Create a gaspedal!

More Related Content

PPT
Physical prototyping lab2-analog_digital
PPT
Physical prototyping lab5-complex_sensors
PPT
Physical prototyping lab3-serious_serial
PPT
Physical prototyping lab1-input_output (2)
PPT
SENSORS AND BLUETOOTH COMMUNICATION
PPTX
Qt arduino serial_port
PPT
ARDUINO AND ITS PIN CONFIGURATION
PDF
Interface stepper motor through Arduino using LABVIEW.
Physical prototyping lab2-analog_digital
Physical prototyping lab5-complex_sensors
Physical prototyping lab3-serious_serial
Physical prototyping lab1-input_output (2)
SENSORS AND BLUETOOTH COMMUNICATION
Qt arduino serial_port
ARDUINO AND ITS PIN CONFIGURATION
Interface stepper motor through Arduino using LABVIEW.

What's hot (20)

PPTX
02 General Purpose Input - Output on the Arduino
PDF
How to measure frequency and duty cycle using arduino
PPTX
04 Arduino Peripheral Interfacing
PPTX
GCC 4-1-16
PPTX
Gcc 4 15-16
PPTX
Arduino slides
PPTX
GCC 3-18-16
PDF
2009 11-17-arduino-basics
PPTX
I2 c and mpu6050 basics
PPTX
MPU6050 IMU with Arduino
PDF
Embedded system course projects - Arduino Course
PDF
برمجة الأردوينو - اليوم الأول
PPTX
Distance measurement using Ultrasonic sensor on Arduino Uno
PDF
Starting with Arduino
PPTX
Arduino Robotics workshop Day1
PDF
Contactless digital tachometer using microcontroller
PDF
Using Ready-for-PIC and SDR Libraries
PPTX
Arduino Interface LM35 MQTT Using UART
PPTX
Gcc 4 22-16
PPTX
2 Digit Object counter
02 General Purpose Input - Output on the Arduino
How to measure frequency and duty cycle using arduino
04 Arduino Peripheral Interfacing
GCC 4-1-16
Gcc 4 15-16
Arduino slides
GCC 3-18-16
2009 11-17-arduino-basics
I2 c and mpu6050 basics
MPU6050 IMU with Arduino
Embedded system course projects - Arduino Course
برمجة الأردوينو - اليوم الأول
Distance measurement using Ultrasonic sensor on Arduino Uno
Starting with Arduino
Arduino Robotics workshop Day1
Contactless digital tachometer using microcontroller
Using Ready-for-PIC and SDR Libraries
Arduino Interface LM35 MQTT Using UART
Gcc 4 22-16
2 Digit Object counter
Ad

Viewers also liked (6)

PDF
David Cuartielles and Tony Olsson - Going Physical (K3 research seminar)
PPT
Physical prototyping lab2-analog_digital
PPT
Lect23 Engin112
PPTX
How to design a machine?
PPTX
Obstacle detection Robot using Ultrasonic Sensor and Arduino UNO
PPTX
Code generation
David Cuartielles and Tony Olsson - Going Physical (K3 research seminar)
Physical prototyping lab2-analog_digital
Lect23 Engin112
How to design a machine?
Obstacle detection Robot using Ultrasonic Sensor and Arduino UNO
Code generation
Ad

Similar to Physical prototyping lab6-motors (20)

PPTX
Servo Motors and it's applications .pptx
PPTX
PDF
elementz_0636621001471675637HumanFollowerRobotppt.pdf
PDF
Introduction_to_Mechatronics_Chapter4.pdf
PPTX
major project ppt 27-4-16
PDF
arduinoworkshop-160204051621.pdf
PPTX
Ardui no
PDF
Sensor and Actuators using Rasberry Pi controller
PPTX
Smart shoe
PDF
Prestentation
PDF
First step robotics
PPTX
project ppt for final year viva-voce - modified
PDF
Lecture 08 robots and controllers
PPTX
teststststststLecture_3_2022_Arduino.pptx
PPTX
Warehouse Managing Robot
PPTX
Self Obstacle Avoiding Rover
PPTX
Arduino Based Project.pptx
PPTX
Newppt major
PDF
Arduino microcontroller ins and outs with pin diagram
PDF
Arduino spooky projects_class3
Servo Motors and it's applications .pptx
elementz_0636621001471675637HumanFollowerRobotppt.pdf
Introduction_to_Mechatronics_Chapter4.pdf
major project ppt 27-4-16
arduinoworkshop-160204051621.pdf
Ardui no
Sensor and Actuators using Rasberry Pi controller
Smart shoe
Prestentation
First step robotics
project ppt for final year viva-voce - modified
Lecture 08 robots and controllers
teststststststLecture_3_2022_Arduino.pptx
Warehouse Managing Robot
Self Obstacle Avoiding Rover
Arduino Based Project.pptx
Newppt major
Arduino microcontroller ins and outs with pin diagram
Arduino spooky projects_class3

Recently uploaded (20)

PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Machine Learning_overview_presentation.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Machine learning based COVID-19 study performance prediction
PDF
Getting Started with Data Integration: FME Form 101
PDF
August Patch Tuesday
PDF
Approach and Philosophy of On baking technology
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
TLE Review Electricity (Electricity).pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Machine Learning_overview_presentation.pptx
Programs and apps: productivity, graphics, security and other tools
Diabetes mellitus diagnosis method based random forest with bat algorithm
A comparative study of natural language inference in Swahili using monolingua...
Reach Out and Touch Someone: Haptics and Empathic Computing
Encapsulation_ Review paper, used for researhc scholars
Machine learning based COVID-19 study performance prediction
Getting Started with Data Integration: FME Form 101
August Patch Tuesday
Approach and Philosophy of On baking technology
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
NewMind AI Weekly Chronicles - August'25-Week II
Building Integrated photovoltaic BIPV_UPV.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Advanced methodologies resolving dimensionality complications for autism neur...
Assigned Numbers - 2025 - Bluetooth® Document
SOPHOS-XG Firewall Administrator PPT.pptx

Physical prototyping lab6-motors

  • 1. PHYSICAL PROTOTYPING © 2011 K3 Creative Commons v3.0 SA-NC Lab 6: Motors With the Arduino prototyping board
  • 2. millis() • millis(); returns the number of milliseconds the arduino has been on • Useful when you want two things to happen at once ”semi threading” • Returns a long • Examples/Digital /Blinkwithoutdelay Made by: David Sjunnesson
  • 3. micro()  Returns the number of microseconds since the Arduino board began running the current program  Returns a long  Works the same way as millis()
  • 4. Random • random(min, max) • Returns a pseudorandom number between min and max. • random(10,50) returns a number between 10-49 • randomSeed(); • randomSeed(analogRead(4)); Gives you a better random value
  • 5. Try it out • Create a program that randomly in time sends a random value to the computer.
  • 6. map()  Re-maps a number from one range to another  Useful when a sensor sends one range of values but you need it in another.  map(value, fromLow, fromHigh, toLow, toHigh)
  • 7. constrain()  Constrains a number to be within a range.  Helps to make sure a value is in a certain range  constrain(value, minimum, maximum)
  • 8. Try it out!  Create a program that maps your value from a potentometer from the read range into another and sends it back to the computer.
  • 9. MOTOR • Actuator that transforms electricity into movement • Motors can be of different kinds: DC, stepper, servos, etc. Each type has a different way of being driven • New motors can be very expensive. In many cases we will not be interested in high accuracy and precission, just in showing the basic functionality • It is in those cases when dismounting some kind of motor-driven device will be useful to acquire the basic components for our design • Car-toys, electric razors, printers, CD-drives, old hard drives, cash registers, and many devices contain motors that we should be able of using
  • 10. TYPES OF MOTORS • There are three main types of motors – DC motors: they are used in toys and devices that do not need high degrees of accuracy in terms of speed or angle. With certain circuits that can be improved – Stepper motors: they can move to a very precise position. We find them in printers, scanners, etc – Servo motors will move and stop at a certain angle on request. They are used in car models to control the direction, model-planes for the flaps, etc
  • 11. TYPES OF MOTORS • DC motors: – run freely – hard to control their position/speed – can use as less as 2,5Volts – speed can be controlled using PWM – we use relays, transistors or H-bridges to control them from Arduino – with encoding circuits can become very precise
  • 12. DC MOTORS: PWM • PWM stands for Pulse Width Modulation. Microprocessors cannot produce pure analog signals, nor can they provide enough current to drive motors • Through calculating the average value of a sequence of pulses, microprocessors emulate the generation of analog signals • It is with PWM that we can change the speed of a DC motor. It is anyway needed the use of a transistor, since the pins on Arduino cannot handle the amount of current to move the motor PICTURES © their authors
  • 13. STEPPER MOTORS • Stepper motors: – 2 types: unipolar or bipolar – rotate a certain amount of degrees at each pulse – typical values of angles are 1,8 - 3,6 - 7,2 ... – we use transistors, transistor chips, and H-bridges to control them – they have 4 or more wires – RepRap
  • 15. SERVO • they will rotate to a certain angle depending on a PWM value we push into them • recently there are continuous rotation servos • broadly used in robotics
  • 16. SERVO/Continuous • Connect the servo to the arduino • Black ----> Arduino ground • Red -----> Arduino 5v+ • White ----> Arduino motorPin • Make it move Clockwise or Counter-clockwise depending on the values read from a potentiometer • Usefull functions is map()
  • 17. SERVO/Standard • Connect the servo to the arduino • Black ----> Arduino ground • Red -----> Arduino 5v+ • White ----> Arduino motorPin • Make it move to a specified angle depending on the values read from a analog input • Usefull functions is map()
  • 19. Transistor • The transistor is considered by many to be the greatest invention of the twentieth century. It is the key active component in practically all modern electronics.
  • 20. Transistor • A transistor is a semiconductor device, commonly used to amplify or switch electronic signals. The transistor is the fundamental building block of computers, cellular phones, and all other modern electronic devices.
  • 21. Transistor • We use transistors for: – turning DC devices on/off: motors, lamps, etc – dimming DC lights – changing the speed of motors seamlessly (using PWM)
  • 22. How to hook up a motor using IRF Z24 Copyright Kajsa Sahlström and Matilda Marcelius
  • 23. How to hook up a motor using BC547
  • 25. Relay • A relay is an electrical switch that opens and closes under the control of another electrical circuit • Makes it possible to control big stuff with Arduino • Control up to 220V with 5v from Arduino • Cant control speed...
  • 26. Hook it UP!  Connect a DC motor and control the speed with a analog sensor  Create a gaspedal!

Editor's Notes

  • #2: Encourage people to interrupt you so you can help them immediately. Explain they do you a favor. It’s good to time the duration of the presentation.
  • #3: Millis() gives you the amount of time the arduino has been running in milliseconds. Use a long variable to store this information, int is too small to hold the data. Show blink without delay example Picture: use an arduino to control the flash of a camera to do high speed photography based on the sound. (In the case of the picture the bulb breaking) If you would use delay() it would not work because you would hit the actual kaboom. (the moment you want to photograph)
  • #4: Micro works the same as millis, but returns the time in microseconds. You use it when generating sound with arduino.
  • #5: Explain random, give minium and maximum value. The value returned is always in between the minimum and maximum specified. You use static electricity of the physical world on an analog port to get a true random number.
  • #6: Read the values in the serial monitor. Explain everything again, random and randomseed.
  • #8: You use this value often to constrain the value of sensors to get rid of their random behaviour. Example: LDR. It fluctuates a lot, so you can constrain it’s value to make it more accurate.
  • #9: Read the value in the serial monitor. Remap the value of 0-1023 to something else 0-255 for instance.
  • #10: Explain DC-motors Stepper motors Servo motors Every piece of electronics which moves has a motor. There is a trade of between price, easiness to connect and accuracy.
  • #12: Retarded brother of the other two motors. If you switch the cables around it runs in the other direction. You can use PWM on a low power motor to make it run at different speeds. If it’s a high power motor you need a transistor to control it at different speeds. When you need some sort of precision servo motors are the way to go. An H-bridge not only allows you to change the speed but also the direction of turning. H-bridge is a bunch of transistors connected You put the motor as the bridge in the letter H, the center piece.
  • #14: You can tell it’s a stepper motor because it has 4 more wires then the DC motor. They need a transistor chip to be controlled. They need more power. They can be moved at very specific angles. You can use the steps 7,2 degrees per step for a normal stepper motor. They also exist in 3,6 degrees per step. They are used in scanners to scan the picture at the same speed for the whole picture. Reprap is an open source 3D printer.
  • #15: Magnets activate in turn and make the piston turn.
  • #16: You control them with PWM, don’t use the motor library. All robots use servo motors, and model airplanes. There are two kinds, a standard servo motors, the standard one only turns 180 degrees, and a continuous rotation servo. Continuous rotation servos are slower and they can’t be turned to a specific angle.
  • #17: With a continuous rotation servo you can influence the speed by pulsing it at a specific speed. 500--------1000--------1500 If you pulse it at 1000 it will stop, 500 it will spin left way around and 1500 the right way around. Map the values from the They have a small potentiometer hole at the connector You can distinguish them this way from 180 degrees servos.
  • #18: The standard servo, you pulse it, and the length of the pulse determines the angle to which it will turn. If you pulse it with a delay of 500 milliseconds it will go to 0 degrees.
  • #19: You can buy batteries to power the arduino so you don’t need the USB cable Safe is: 6-17 volts. Direct current
  • #20: Most important electronic invention. 31 years old. It’s the basis of all modern computers. In prototyping they are usufally used to switch a lower power circuit to a higher power circuit. So for instance you can control a high power lamp or solenoid indirectly from the Arduino with a transistor.
  • #23: The IRF Z24 is a good transistor to use. Some operate at lower power. The IRF Z24 handles up to 80 volts, so it’s good for anything. This one is about 15 SEK
  • #24: This is a smaller cheaper one. The BC547 is low voltage
  • #25: Talk about 220 volts. IF you go above 80 volts, you have to switch to a Relay instead. If you want to control AC power you also need a Relay. Transistors are only for Direct Current.
  • #26: They are not allowed to experiment with this in school. You can blow out the wall sockets. If you want to control 220 volts, Most relays only start to work from 12 volts. You have to activate an electro magnet inside the relay to close the high power circuit. You use an arduino to control the transistor and the transistor to control the relay. You can experiment with this by buying a Relay kit. IF you are unsure of what you’re doing with Relays then you’re not supposed to work with them.