Fubar Labs Tutorial - Hampton Sailer · 10/3/2017 Introduction to Arduino and IDE 1 Fubar Labs...

Post on 30-Jun-2020

2 views 0 download

transcript

10/3/2017 Introduction to Arduino and IDE 1

Fubar Labs Tutorial

Arduino Motor Control Tutorial

DC Motors, Servo Motors, Stepper Motors

Hampton Sailer, HW Engineer

• 30+ years experience designing microprocessor

based circuit boards.

• 25% of my time with software for debug

• 7 years website design,UI and backend

• TCP/IP Ethernet networking debug

• Lots of power wiring (120 volt) work

• Stage lighting and sound system work

• Home construction and revovation

Arduino Motor Control

• Requirements: some programming experience, a

Laptop, Arduino starter kit (including motors).

• Use ready made hardware – Motor Control Shield

• DC Motors - speed and direction

• Servo Motors (used in R/C models) - position

• Stepper Motors – CNC milling, 3D printers, etc.

• Open loop control, programmed behavior

• Follow through with IDE “Example” codes

• Follow http://www.tutorialspoint.com/

10/3/2017 Fubar Labs - Introduction to Arduino and IDE 3

DC Motors, Servos, Stepper

• DC hobby motors on Google

• Mabuchi dc motor on eBay

• Really cheap hobby dc motor (Alibaba Express)

• DC+hobby+motor+shaft+coupling

• Hobby King Servo Motos

• Hobby King Sensored-brushless-motor

• Tower Hobbies Servo Motors

• http://www.solo-labs.com/diy-dual-stepper-motor-driver-

shield-arduino/

Heavy Duty Motor Control

• One L298 chip

• Dual “H” Bridge

• Run 2 stepper motors

• Up to 2 amp output

• Up to 46 Volts

• 25 Watts dissapation

• Digital pin control

• $15 or less http://www.learningaboutelectronic

s.com/Articles/2-motor-H-bridge-

circuit.php Qunqi-Controller-Module-Stepper-Arduino

10/3/2017 Introduction to Arduino and IDE 7

DC Motor “H” Bridge

Reverse motor direction

Careful to program valid logic

• You can “smoke” the

driver transistors if

you turn on the wrong

pair.

• Usually there is some

kind of fuse in the

supply circuit to

prevent damage.

• Go buy some fuses

when learning to

program

L293 Motor Control Shield

Pulse Width Modulation

• Uno has 6 output

pins that can PWM

• analogWrite(arg)

• analogWrite

• Repeats at 490Hz

• Poor man’s D/A

DC Motor and Servo Motor

PWM speed control

Robot Arm driven by hobby Servos

Servo Motors

• Used for hobby device mechanical control

• R/C Airplanes

• R/C Toy Cars

• R/C Boats

• Toy Robots

• Rotate 180 degrees

• Some full rotation

• Low power

• Light weight

• Will hold static position

Inside a Servo Motor

• Small DC motor to

drive a gear chain to

the output shaft.

• Encoder connected to

the output shaft

• Error correction

amplifier to drive DC

motor

• Pulse Train input

• Pulse width duty cycle determines angle of output shaft

• Repeats on a 50 Hz basis in this example

Stepper Motors

10/3/2017 Fubar Labs - Introduction to Arduino and IDE 19

10/3/2017 Fubar Labs - Introduction to Arduino and IDE 20

Stepper Motors

Stepper motors effectively have

multiple "toothed" electromagnets

arranged around a central gear-

shaped piece of iron. The

electromagnets are energized by an

external driver circuit or a micro

controller. To make the motor shaft

turn, first, one electromagnet is

given power, which magnetically

attracts the gear's teeth. When the

gear's teeth are aligned to the first

electromagnet, they are slightly

offset from the next electromagnet.

This means that when the next

electromagnet is turned on and the

first is turned off, the gear rotates

slightly to align with the next one

10/3/2017 Introduction to Arduino and IDE 22

Free Arduino Tutorials

• https://www.arduino.cc/en/Tutorial/BuiltInExamples

• https://www.tutorialspoint.com/

• http://www.me.umn.edu/courses/me2011/arduino/

• http://www.computerprogrammingbook.com/arduino/

• https://playground.arduino.cc/Main/ManualsAndCurriculum

• http://www.free-engineering-books.com/2014/10/the-largest-collection-of-arduino-books.html

• http://www.electronicshub.org/arduino-project-ideas/

• https://randomnerdtutorials.com/arduino-step-by-step-projects/

• https://www.elprocus.com/

• http://arduinolearning.com/code/multi-function-shield-examples.php

10/3/2017 Introduction to Arduino and IDE 23

Some Hardware Vendors

• Ebay, Aliexpress, Amazon, Sears, Walmart

• https://www.adafruit.com/

• https://www.sparkfun.com/

• http://shieldlist.org/

• www.jameco.com http://www.mpja.com/

• www.digikey.com www.mouser.com

• https://www.dfrobot.com/

• http://www.apcmag.com/12-raspberry-pi-alternatives.htm/

• https://playground.arduino.cc/Main/Resources

• https://www.tindie.com/browse/arduino/