1

I'm new to programming and hardware so be gentle.

I've used this tutorial Arduino Ultra Mega Timers to create a time on/off circuit.

I'm attempting to connect some adafruit neopixel led strips to a 5v relay. I've been trying to read up on how exactly relays work and what wires would go from GND, 5V, and Dout to NO and NC but I've hit a brick wall because all of the schematics I've found show light bulbs connecting to the relays. A detailed explanation of exactly how to connect the LED strip to the relay and why it works would be great as I am trying to learn!

1 Answer 1

1

You cannot find a tutorial for controlling neopixel strips with a relay, because that just does not make any sense. You don't need a relay to control the strip.

The Neopixels consist not only of the LEDs themselves, but also of one LED driver chip per LED (WS2811 and it's siblings). These driver chips control the LEDs based on the data, that you send through the data pin. Actually one Neopixel LED consists of 3 LEDs inside a single package, one LED each for the colors red, green and blue (so that you can create all the other colors with a combination of them). The driver chip controlls the brightness of all three colors.

Thus you only need to connect your 5V power source to the strip (5V and ground) - Be sure to connect the power lines directly to your power supply, so that the LED current does not flow through the Arduino (because that can fry your Arduino) - and the data In pin of the strip to a fitting digital pin of the Arduino. You can use the Adafruit Neopixel library or the FastLED library for controlling them.

To turn the strip on, you set the needed pixels to the wanted color and then call the show method of the library (which sends out the color data through the data pin). To turn the strip off, you simply clear all the pixels (the libraries have extra functions for that), which basically means setting all pixel to black (red, green and blue components all zero).

So forget about the relay and just use the strip directly. Also Adafruit has a very good guide on how to use the Neopixels.

3
  • Hey, I really appreciate your reply Chris. I understand what you are saying. But I've already programmed the strip to blink for a certain time, at the intensity I want, and the color that I want. The problem is I want the Neopixels to turn on at a specific time during the day which is the reason why I'm using the RTC and the relay. Are you saying the RTC and the relay aren't necessary at all to do what I want? I want the LEDs turn on at 12 and off 2 on their own. If the relay isn't necessary to do what I asked, would you mind pointing me in in the right direction? Thanks!
    – mattheworo
    Jul 29, 2020 at 12:31
  • You need the RTC for time keeping. But you don't need the relay. The tutorial, that you linked, uses both, but that doesn't mean, that you always need to use them together. Divide the functionalities of your project up: 1. You want to keep and know the time; for that you need the RTC. 2. You want to control the LED strip (here you only need the strip). And the code should just put both things together.
    – chrisl
    Jul 29, 2020 at 12:40
  • You can still follow the tutorial, but instead of the code for turning the relay on and off, you should insert the code for turning your LEDs on and off. The relay is just not needed there; it has no function in your project.
    – chrisl
    Jul 29, 2020 at 12:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.