Arduino at the Exploratorium, June, 2012

Instructor:

Michael Shiloh
michael@michaelshiloh.com
This page is at teachmetomake.com/wordpress/arduino-exploratorium

Plan, roughly:

  1. Theory and practical introduction
  2. Simple robot and controlling higher current (motor)
  3. Sensors and reversing motor, more complex programming, and blink without delay
  4. Hacking a toy or electronic device
  5. TBD
  6. TBD

Week 1: Theory and practical introduction

Depending on what supplies and materials everyone has:

  1. Install Arduino IDE and blink light
  2. Learn how to use the solderless breadboard
  3. Add an LED to a different pin
  4. Program to alternate
  5. Basic circuits
  6. Build a simple LED and resistor circuit using the 5V supply from Arduino
  7. Add a transistor, pull up switch, pull down resistor
  8. This is the heart of a microcontroller
  9. Switch is a simple sensor (bump, tilt, window, flow, pressure mat, fridge door, etc.
  10. digitalRead() is how you would access the switch in Arduino
  11. What about analog? What is it? Amount of light, pressure, distance, temperature, etc.
  12. Photoresistor and analogRead()
  13. Conditional to turn LED if light is over some threshold
  14. Serial.println()
  15. analogWrite()
  16. Homework:
    1. Read Learn electronics using Arduino by Lady Ada
    2. Read the following tutorials on the Arduino website:
      1. Blink: Turn an LED on and off.
      2. DigitalReadSerial: Read a switch, print the state out to the Arduino Serial Monitor.
      3. AnalogReadSerial: Read a potentiometer, print it’s state out to the Arduino Serial Monitor.
      4. Fade: Demonstrates the use of analog output to fade an LED.
      5. ReadAnalogVoltage : Reads an analog input and prints the voltage to the serial monitor
    3. Explore the Arduino built- in examples (File->Examples) and pick one ore two that you’d like to learn more about
    4. Reply to Ray by Thursday noon regarding the robot project

Week 2:  Simple robot and controlling higher current (motor)

  1. Lecture
    1. Simple circuit theory: voltage, load, closed circuit
    2. Mechanical switch, transistor switch
    3. Transistor as output of microcontroller
    4. digitalWrite() turns one of two transistor switches on. HIGH connects output to 5V and LOW connects output to GND.
    5. But, transistor gets hot whenever current runs through it. The more current, the more heat. Too much heat will damage the transistor, so we have to be aware of the maximum current a transistor can handle
    6. The transistors at the outputs of Arduino can only handle 40 mA. An LED uses about 30 mA, while a typical small motor uses hundreds or thousands of mAs Does that mean that the only thing we can control are LEDs?
    7. No; a transistor is not only a switch, but it is also an amplifier; that is, a small current can control a larger current, just as you use a lever to amplify a small force to lift a heavy boulder.
  2. Lab
    1. Use a transistor to control a motor
    2. Use PWM to vary the speed of a motor
    3. Use a pair of photoresistors to control which of two motors to activate
  3. Homework:
    1. Build a light-seeking robot

Week 3:  More sensors, why we can’t reverse with the transistor I gave you, and how to interface to an external IC (in this case so that we can reverse our motor)

Links to information regarding the motor controller (or more correctly, “quad half H-bridge driver”) IC we’re using

  1. Datasheet for the L293/SN754410
  2. Control your motors with L293D at Let’s Make Robots
  3. DC Motor Control Using an H-Bridge at NYU ITP Physical Computing page

Week 4:  Hacking a toy or electronic device

  1. Output (control)
    1. Direct
    2. Transistors (PNP and NPN) and their limitations (limited isolation, DC, pull up or pull down)
    3. Relays (reed)
    4. Opto isolators (essentially an LED) (e.g. Jameco Part no. 320805)
  2. Input (sensing)
    1. Direct
    2. Voltage dividers
    3. Transistors (PNP and NPN) and their limitations (limited isolation, DC, pull up or pull down)
    4. Relays (reed)
    5. Opto isolators (essentially an LED)

Week 5: 

  1. PID (although I know very little about this)
    http://hackaday.com/2011/07/21/demystifying-pid-control-with-a-look-at-the-new-arduino-pid-library/
  2. Autocalibration
    http://arduino.cc/en/Tutorial/Calibration
  3.  LCD displays
    http://arduino.cc/en/Tutorial/LiquidCrystal
  4. Interrupts
    http://arduino.cc/en/Reference/AttachInterrupt
  5. Interracting with a program on your computer
    File->Examples->Communication->Graph

Week 6:

  1. PID (although I know very little about this)
    http://hackaday.com/2011/07/21/demystifying-pid-control-with-a-look-at-the-new-arduino-pid-library/
  2. Interacting with a program on your computer
    File->Examples->Communication->Graph
  3. Blink without delay
  4. Extending functionality through libraries (e.g. this library for creating capacitive sensors

Other options:

  1. Interfacing Arduino to the internet via a program running on your computer
  2. Finish robots and add intermediate robotic concepts to the robot: line following, collision detection and avoidance, sound effects
  3. Tri-color LEDs (I have some)
  4. Using shields (you can share mine: wifi, ethernet, CANbus, wav (play sound clips or full songs!), motor (big motors), GSM (you provide a SIM card and it connects to the cellphone SMS network – control your robot via SMS text messages!) and some others I’m forgetting
Print Friendly

Leave a Reply

Your email address will not be published. Required fields are marked *