718Views5Replies

Author Options:

Arduino Christmas/Halloween Lights with Vixen Answered

Hi,

I need a piece of code that I can use to controll my christmas/Halloween lights this year.   I would like the code to work with Vixen so I can sync the music to the lights.  The controller that I have is normally open so if you have code you may have to tweak it so I can use the relays as N/C, lastly there are 6 channels.  No fading.  Any help is appreciated.  Thank you!

Discussions

0
None
germtangc

4 years ago

Still need help for this?

Anyway, here's a link to doityourselfchristmas forums about an arduino sketch used for vixen/arduino interface.

http://doityourselfchristmas.com/forums/showthread.php?23202-Arduino-code-for-christmas

If you need more PWM outputs, you can always use the ShiftPWM library. A sample INCOMPLETE code using this:

const int ShiftPWM_latchPin=8;

const bool ShiftPWM_invertOutputs = false;

const bool ShiftPWM_balanceLoad = false;

#include


unsigned char maxBrightness = 255;
unsigned char pwmFrequency = 75;
int numRegisters = 6;
int numRGBleds = numRegisters*8/3;
int i = 0;
int incomingByte[16];


void setup(){
Serial.begin(9600);

ShiftPWM.SetAmountOfRegisters(numRegisters);

ShiftPWM.SetPinGrouping(1); //This is the default, but I added here to demonstrate how to use the funtion

ShiftPWM.Start(pwmFrequency,maxBrightness);
}



void loop()
{
if (Serial.available() >= 16)
{
for (int i=0; i<16;i++)
{
incomingByte[i] = Serial.read();
}
ShiftPWM.SetOne(0, incomingByte[0]);
ShiftPWM.SetOne(1, incomingByte[1]);
ShiftPWM.SetOne(2, incomingByte[2]);
ShiftPWM.SetOne(3, incomingByte[3]);
ShiftPWM.SetOne(4, incomingByte[4]);
ShiftPWM.SetOne(5, incomingByte[5]);
ShiftPWM.SetOne(6, incomingByte[6]);
ShiftPWM.SetOne(7, incomingByte[7]);
ShiftPWM.SetOne(8, incomingByte[8]);
ShiftPWM.SetOne(9, incomingByte[9]);
ShiftPWM.SetOne(10, incomingByte[10]);
ShiftPWM.SetOne(11, incomingByte[11]);
ShiftPWM.SetOne(12, incomingByte[12]);
ShiftPWM.SetOne(13, incomingByte[13]);
ShiftPWM.SetOne(14, incomingByte[14]);
ShiftPWM.SetOne(15, incomingByte[15]);
}
}

0
None
germtangcgermtangc

Reply 4 years ago

Oh and BTW. U need 74HC595 shift registers (and optional ULN2803) for the ShiftPWM code.

0
None
mpilchfamily

4 years ago

What controller do you have? This kind of project may be way beyond an Arduino capabilities.

0
None
iApple guympilchfamily

Reply 4 years ago

It's a controller I made. You apply +5v to arduino pin and it turns on an outlet. 6 channels, no fading. Relays are ON/OFF.

0
None
mpilchfamilyiApple guy

Reply 4 years ago

You'll need a controller that will actually interface with the PC and accept the commands given by Vixen. While you may be able to get the Arduino to do that it will not be able to keep up with the sequence and keep the lights to stay in sync with the music. Not to mention the response time of the relays will may further slow things down.

Anyway it's beyond my knowledge.