Help with Arduino-Based Christmas Light Show Timing Issues

aoora1

New member
Hey guys....

I am working on a Christmas light display project using Arduino, and I'm running into some timing issues that I could really use some help with. My setup involves using an Arduino to control a series of relays connected to the Christmas lights. I've written a basic sketch to turn the lights on and off in a sequence, but the timing is not as accurate as I'd like.

Specifically, the lights sometimes turn on or off a little earlier or later than expected, which disrupts the synchronization with the music. I'm using the delay() function for timing, but I suspect that this might be causing some issues. I've read that using millis() for timing can be more reliable for this kind of application, but I'm not sure how to implement it effectively.

I also check this: https://www.doityourselfchristmas.com/forum/index.php?threads/rgb-leds-now-consumer-grade-hackabllooker But I have not found any solution. Could anyone guide me about this? Has anyone here faced similar issues or have experience with precise timing for light shows? Any advice on how to improve the accuracy of the timing or suggestions for alternative approaches would be greatly appreciated. Additionally, if there are any libraries or examples that could help streamline this process, I'd love to hear about those as well.

Thanks in advance for your help!
 
ESPixel stick uses millis() to control timing. delay() only an approximate time and typically can only be counted "to be no less than" your set time.

FYI ESPixelStick controls 16 relays via a PCA output device. or four directly connected devices.
 
I thought that I'd mention that Arduino Hardware Timers and their interrupts can also be used for similar control purposes. This requires more advanced programming skills, so II'm not recommending it at the time. The millis() techniques that Martin mention are best for now because more precise, controllable timing can be obtained. There are plenty of tutorials and examples on the internet.
 
You can feed your arduino from Vixen or xLights and get really precise timing. This doesn't make it standalone but it would give you what you want.

BTW, you could use a RPi and FPP as your show player and it would play your music in sync with the sequence and not tie up your computer. It still costs about $100 by the time you have what you need but a Raspberry Pi with FPP easily fits in the small box to drive the arduino and does a great job.

Curious to see your sketch and what all it does. Can you post it? We promise to help you improve the code if we can see it.
 
Back
Top