This is just a simple experimental project to try out Pimoroni's Tiny2040 for the first time.
In order to dim LEDs we have to use PWM; change the duty cycle of a square wave. The 2040 chip handles this and so this program is really simple, it just sets up PWM on one pin and handles two inputs, one for brighter, one for dimmer.
The harder part was controlling 12v LED strip using a 3.3v output. I've used a small transistor to amplify to 5V and then a mosfet to step that up to 12v. A 7805 gives us a 5v supply to power the microcontroller and to use in the amplification circuit.
It would be possible to generate three square waves with independent duty cycles, and thus have smooth colour changing with the RGB LEDs.
No comments:
Post a Comment