Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Marcelo ArredondoAndres SabasAndrea ZGuz
Published

Arduino Opta Christmas Show

Transforming holiday magic with Arduino Opta PLC, this project brings Christmas lights to life, all synched to your favorite carols.

IntermediateFull instructions provided3 hours1,275
Arduino Opta Christmas Show

Things used in this project

Hardware components

Opta
Arduino Opta
×1
Arduino UNO
Arduino UNO
×1
CatSink USB-C PD
Electronic Cats CatSink USB-C PD
×1

Software apps and online services

Vixen Lights
Arduino IDE
Arduino IDE
Arduino PLC IDE

Hand tools and fabrication machines

Servo Motor, Premium Male/Male Jumper Wires
Servo Motor, Premium Male/Male Jumper Wires
Cable Cutter, 130.17mm
Cable Cutter, 130.17mm
Multitool, Screwdriver
Multitool, Screwdriver
Extension Cord
Christmas Lights
Christmas Tree
Power Strip
Extension Cord Plugs

Story

Read more

Code

Vixen_Lights_Arduino

Arduino
Code to use Arduino Boards with Vixen Lights
 #define MAX_CHANNELS 4 //Define the amount of channels available on our board
  int channels[MAX_CHANNELS] = { 3, 5, 7, 9};
  //int channels[MAX_CHANNELS] = { RELAY1,RELAY2,RELAY3,RELAY4}; //For using the Opta alone


void setup() {
    Serial.begin(9600); //Setup serial at 9600 baudrate 
  for (int i = 0; i < MAX_CHANNELS; i++) pinMode(channels[i], OUTPUT); //Set all the channels as outputs
  for (int i = 0; i < MAX_CHANNELS; i++) digitalWrite(channels[i], LOW); //Set al the channels as LOW for the starting position

 }

void loop() {
  if (Serial.available() >= MAX_CHANNELS) { //Start a loop when if the serial communication is available, when Vixen Lights is open
    for (int i = 0; i < MAX_CHANNELS; i++) { 
      incomingByte[i] = Serial.read(); //We creat a variable to save the informaiton read through USB serial 
    }
    for (int j = 0; j < MAX_CHANNELS; j++) { 
      if (incomingByte[j] == 0) { //We check if the serial communication is sending a 0 or a 255
        status = LOW;
      } else {
        status = HIGH;
      }
      digitalWrite(channels[j], status); //The status is writen to the channels to turn the lights on or off. 
    }
  }
}

Credits

Marcelo Arredondo
10 projects β€’ 3 followers
Andres Sabas
48 projects β€’ 47 followers
Co-Founder of The Inventor's House Hackerspace, DIY, Workaholic
Andrea ZGuz
10 projects β€’ 2 followers
Electronic Engineer. Support Engineer at Electronic Cats.

Comments