Please see my other video for a live kid-tested demonstration!
• LED Lights for Peg Per...
These LED lights are controlled by an Atmel AVR ATMega328P micro controller on a custom-designed PCB. The PCB includes switching regulators for both logic supply and LED power, along with MOSFETs to drive the LEDs and a collection of support components.
The ATMega328P is the same microcontroller used in the Arduino Uno, and my pin utilization was chosen to be full Arduino-compatible. In fact, I wrote all the control software in the Arduino IDE, and programmed the controller board using through 6-pin ICSP header that I included on the board. The microcontroller chip is also socketed "just in case".
The software is all written in properly object-oriented C++, and can be field-upgraded directly from a laptop using an inexpensive USBasp programmer.
LED brightness is controlled by the AVR PWM timers, using standard Arduino analogWrite() method calls.
When not in use, power conservation is accomplished by disconnecting the entire circuit from the 12V battery by turning off p-channel power MOSFET. (During normal operation, a signal from the mcu keeps this MOSFET on.)
The power-on procedure is initiated by a separate board mounted to one of the 12V electric drive motors. On this board, a pair of optoisolators detects power going to the motor (i.e. the tractor is being driven), pulling an open-collector output low and activating the p-channel power MOSFET on the main controller board. I think it's pretty clever.
As long as the accelerator pedal is activated at least once every 5 minutes, the microcontroller continues to run and keep the lights on. If there is no activity for 5 minutes, the mcu kills the power to itself.
Since I'm using high-efficiency switching regulators, not only is the entire circuit relatively immune to power fluctuations, but the current draw is minimal and efficient. I have not yet run an experiment to see how long a fully-charged batter will last with all the LEDs on, but I suspect it to be well in excess of 4 hours. Maybe a LOT longer...
28 дек 2014