SP.711: Wednesday 10/15, Day 4

Today is a day to finish up the wiring and testing of the motor
 driver chip, and if you've already finished that, work
 on a non-essential but useful topic: current sensing.

1) Catch up on remaining projects from the past two classes.

then you can do (A) and (B) below in either order.
 (A) is more precise current sensing using the LMD18200 chip,
 but has some tricky details to work out, 
 and (B) is quick-and-dirty current sensing with a series 
 resistor (but can be simpler and cheaper).

A.1) Use the LMD18200's "Current Sense Pin" (see the datasheet)
   to constantly read the current flowing through it and
   print the result out to the serial port.
    Try this at full speed first, then try it at lower speeds.
   Look through the LMD18200 datasheet and the extra
  "Application Note" we have to see some of the tricky details
   of sensing current while doing PWM.    

A.2) Set up the PIC to automatically shut off the motor
   (and flash a warning LED?) if the current gets too
   high. The idea of this is that you should be able to
   drive the linear stage into the end walls and have the motor
   automatically shut off without breaking anything or
   burning anything out.

A.3) You may have had some problems doing A.2. You may need to
    filter the current (with an analog circuit or in your program
    on the PIC) to keep the PIC from automatically shutting down
    the motor just based on chort current spikes or the larger current
    spike when you change directions.

B) Implement super-cheap current sensing by placing a
    0.2 ohm, high wattage resistor in series with the motor
    (think about where you want to put it... there are several
     possible places in the circuit and it makes a difference).
   You want to read the voltage across the resistor and convert
    that into a current.
   This method could be used with your simple transistor driver
    from last Thursday for a super-cheap motor-driving system.