Changes between Version 2 and Version 3 of ControlSystems/Electrical/Training/Arduino/Lesson6


Ignore:
Timestamp:
Sep 30, 2015, 11:19:23 PM (10 years ago)
Author:
David Albert
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ControlSystems/Electrical/Training/Arduino/Lesson6

    v2 v3  
    77[[Image(http://heroicuniverse.com/wp-content/uploads/2015/05/x-men-days-of-future-past-michael-fassbender-magneto-post-hugh-jackman-x-men-who-should-be-the-new-face-of-the-x-men-movies.jpg, align=right, width=200)]]
    88Magnetism was discovered by the ancient Greeks (and also by the vikings, Chinese, etc.) who noted that lodestone (magnetite), a naturally occurring iron ore was attracted to iron.  They also discovered that a block of lodestone suspended from a string would point to magnetic North and the compass was born.
     9
    910**Trivia**: It's called a magnet because lodestone was found in Magnesia, Turkey.
    1011
     
    1415
    1516Whenever current moves through a conductor (like a wire), it generates a magnetic field.  The direction of that magnetic field is perpendicular to the direction of the current flow and can be remembered using the right hand rule.  If the wire is coiled up, the magnetic field is enhanced.  It can be further enhanced and directed by inserting a ferrous material inside the coil.  Much of the early work on electricity and magnetism was done by Michael Faraday.  They discovered that when a conductor is carrying a current, and therefore generating a magnetic field is placed inside another magnetic field, an **electromotive force** results that applies force to push the conductor.  The direction of that force is often described using the left-hand rule.
    16   * [https://www.youtube.com/watch?v=Dc8Vay7mRss British electromaetism tutorial]
     17  * [https://www.youtube.com/watch?v=Dc8Vay7mRss British electromagnetism tutorial]
    1718
    18 Electro-motive force is what lets us use electricity to move things.  By far the most common application is the motor.  There are actually many types of motors, but in our experiments we will be using common DC motors.
     19Electro-motive force lets us use electricity to move things.  One of the simplest applications of electromotive force is the solenoid.  A solenoid actuator is an electromagnet (coil of wire) that is energized by passing electric current through it; the resulting magnetic field attracts an iron or steel rod causing it to move.  When the electric current is turned off, a spring typically returns the rod to its original position.
    1920
    20   * [https://www.youtube.com/watch?v=OpL0joqJmqY Retro motor tutorial!]
     21You can use your [http://playground.arduino.cc/Learning/SolenoidTutorial arduino to control a solenoid], but there are some important tricks to be aware of. 
     22   1. Electromagnets are formed by coils of wire.  Wire has very low resistance, so it will conduct a lot of current...far more than your Arduino can supply directly.  So the Arduino must control the solenoid indirectly: the arduino will activate an electronic switch that takes a small amount of current to activate and can then pass a large amount of current.  These switches can be electro-mechanical (called relays) or solid state (transistors or similar).
     23   2. When a current is passed through a coil a magnetic field builds up around the coil.  When the current is removed (when the electricity is turned off), the field collapses back into the coil inducing a flow of current.  If the current has no place to go, the voltage will build, potentially to quite high levels which can destroy the electronic switch.  This phenomenon is called **[https://learn.digilentinc.com/Documents/390 inductive flyback]** So an escape path is needed for the current; typically a protection diode (aka flyback diode) is used.
     24
     25== DC Motors ==
     26By far the most common application is the motor.  There are actually many types of motors, but in our experiments we will be using common DC motors.
     27
     28  * [https://www.youtube.com/watch?v=OpL0joqJmqY Retro DC motor tutorial]
    2129  * [https://www.youtube.com/watch?v=LAtPHANEfQo a little more modern]
    2230  * [https://www.youtube.com/watch?v=ZAY5JInyHXYv Brushless DC Motors]
    2331
    24    * Transformers (show how to use a signal generator?)
    25 * DEVICES: real-world control:
    26    * Electromagnets
    27    * Solenoids
    28    * DC Motors
     32== Motor Control ==
     33Like solenoids, the electromagnets in motors require a great deal of current; far more than the Arduino itself can source or sink.  External switches are required to control the flow of electricity through each motor in a robot.  Your kit contains a switching transistor; you can use the transistor to control the flow of electricity through a motor:
     34  **Exercise**: use the N-FET transistor in your kit to allow your arduino to control the flow of electricity through a motor.  Turn the motor on or off in response to a switch or to your ultrasonic controller.  Use a protection diode (also in your kit) to prevent the back EMF from the motor from destroying the transistor (and potentially you Arduino).  You can use the micro-motors provided (see a mentor if you don't have one) or you can use one of the gear-motors from the mini-bot kits (also ask a mentor).
    2935
    30 == Part II ==
    31 * THEORY: Controlling (high) current w/micro-controller
    32 * DEVICES: H-bridge for direction (make one with 2x SPDT or 1x DPDT switch?)
    33    * relays
    34    * power transistor
    35    * Inductors, flyback, meet ELI the ICE man
    36    * Protection diodes
     36== Direction Control ==
     37In robots, we want to be able to run the motor in either direction (forward or reverse).  To reverse the direction of a DC motor, we must reverse the direction of current through it.  Direction control is typically achieved using a circuit called an H-Bridge.  An H-bridge can be formed by a DPDT switch (or two SPDT switches), but for computerized direction control, the H-Bridge is formed using electronic switches (transistors).
     38   * [http://www.dprg.org/tutorials/1998-04a/ Good tutorial]
     39   * [https://itp.nyu.edu/physcomp/labs/motors-and-transistors/dc-motor-control-using-an-h-bridge/ Detailed tutorial]
    3740
    38 == Part III ==
    39 * THEORY: PWM for speed control (view with oscilloscope)
    40 * DEVICES: Arduino motor shields.
    41 * HANDS-ON: Drive DC motors, controlling speed and direction using a motor shield.
     41== Speed Control ==
     42If you don't consider the load on a motor, the higher the voltage you apply, the faster the motor will spin (at least for an ideal DC motor).  However, it's not easy for a digital device like the Arduino to adjust the analog voltage to a motor; instead, motor speed control is achieved using a clever technique called [https://www.arduino.cc/en/Tutorial/SecretsOfArduinoPWM pulse-width modulation or PWM].  You may have used PWM with your Arduino to vary the brightness of an LED in the "Fade" sketch (if you didn't, [https://www.arduino.cc/en/Tutorial/PWM please try it now].
     43
     44**Exercise**: Observe the PWM signal with an oscilloscope (ask a mentor for help)
     45
     46We will use an [https://www.adafruit.com/products/81 Arduino motor shield] to control the direction and speed of the DC motors in our mini-bots.  Although you can program the shield yourself, a convenient [https://learn.adafruit.com/adafruit-motor-shield/library-install library] is available for download.
     47
     48**Exercise**: Connect a motor shield to an arduino and use it to control the speed and direction of one of the mini-bot gear motors.  If your USB port can't power the motor (very possible), use an AA battery pack (see a mentor) to provide a separate power source for the motors via the motor shield power connections.