| August 16th, 2009 Another Way Of Controlling DC Motor With AVR: Here is a video of me controlling a 3V hobby motor by sending a pulse of current. It is the same setup & code as the 11 LED CHASER (a hack), except 1 LED has been removed (at PC5) and replaced with a N2700 (row 2-4, row 2 to GND, row 3 to MCU, row 4 to positive on motor, row 5 to positive rail plus to negative on motor) MOSFET setup to switch on a normal 3 volt hobby motor that requires more amperage (higher than the 40mA maximum that the ATmega168 can handle) than the MCU provides (also added a 5V voltage regulator as power supply is 6 volts). To avoid using a MOSFET, I could have used a pager motor (used for vibrator) that will run on 40mA) directly connected to the MCU and rail just like I do with the LEDs in my demos.
11 LED Chaser Effect (before hack above): I noticed that the whole right side of the NerdKit has 11 accessible ports that 11 LEDs will fit in just comfortably. I was told I could only get up to 6 or 8 LEDs using math to do it, but my old stubburn way of programming step by step in C easily allowed by to do these 11. Here's a video (barebones microcontroller on breadboard). I do not use any fancy math with my code because my video shows it running off 3volts (2 AA batteries), complicated programming would have caused the MCU to "brown out" (not function right and glitch) with only a 3 volt power supply. Below is my commented and refined 11 LED light chaser basic demo source code (if not using makefile from nerdKit, then put underscore in front of delay_ms to _delay_ms):
|
Free image widgets HERE.