Do you know those cheap LED strips?
These are often called "analog" LED strips because you cannot control each pixel individually like you do with "digital" strips.
Today we want to drive them using our Arduino board.
Hardware
- Arduino Board
- MOSFET
- White LED strip
As MOSFET i have used I have used the IRF520 that comes with the Arduino starter kit but you can use any general purpose MOSFET (for example the popular STP16NF06).
Schematic
Code
#define PIN 11 // control pin #define DELAY 10 // 20ms internal delay; increase for slower fades void setup() { pinMode(PIN, OUTPUT); } void loop() { // fade in for(int i=0; i<255; i++) { analogWrite(PIN, i); delay(DELAY); } // fade out for(int i=0; i<255; i++) { analogWrite(PIN, 255-i); delay(DELAY); } }
This is the code if you prefer a "strobo effect".
#define PIN 11 // control pin #define DELAY 20 // 20ms internal delay; increase for slower pulse void setup() { pinMode(PIN, OUTPUT); } void loop() { digitalWrite(PIN, HIGH); // turn on delay(DELAY); // wait few milliseconds digitalWrite(PIN, LOW); // turn off delay(DELAY*10); // wait some more time }
References
Dimming a 12V LED Strip With an Arduino
RGB LED Strips
RGB Led Strip Controlled by an Arduino
Thank you for posting such a great article! I found your website perfect for my needs. It contains wonderful and helpful posts. Keep up the good work!
ReplyDeleteRGB LED STRIP
can it be done without a mosfet?
ReplyDeleteWorks well, even with a 12V white LED strip. Thank you
DeleteHi, yes it is perfect .....but I need help please, with code settup...
DeleteMy idea is 12 hours LED light OFF and after 12 hours LED light ON, if is possible? please.
Thank u. Ondrej
I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us
ReplyDeleteLED robots party service
I appreciate you for this blog post really good. Thank for sharing information.
ReplyDeleteAs you want Programmable LED Controller then contact our manufacturer who give you bet products............................................................... Read More
Informative post. Thanks for sharing.
ReplyDeleteSmart Color Changing LED Bulb WiFi
Wonderful Post. This is a very helpful post. These are the useful tips for Solar Garden Lights.Good and useful information. Thanks for sharing the blog.
ReplyDelete