Help to get a start with my project

Hi all, i am Dimitri from Belgium. I will take time to properly introduce myself, but for the moment i am in a big deadline rush to get a job done. We are a creative sign maker company and for a current build, we need to control a simple light animation. I'll try to explain as good as possible:

The project is a lightbox with 4 different compartments. Every seperate room has led lights built in (12v). These leds need to be switched in a specific order and time. This program needs to run in loop mode and hopefully can run for years without the need for a different program.

The program exists of 9 steps:

relay n°
1 2 3 4

1 0 0 0 time:1/10 sec
1 1 0 0 time:1/10 sec
0 1 1 0 time:1/10 sec
0 0 1 1 time:1/10 sec
0 0 0 1 time:1/4 sec
0 0 0 0 time:1/4 sec
0 0 0 1 time:1/4 sec
0 0 0 0 time:1/4 sec
0 0 0 1 time:1/4 sec
0 0 0 0 time:1/4 sec

I really want to understand and learn arduino, but to be honest, i can't afford the time to learn it all by myself for this project. I hope to find some advice here for the components to order to get this job done and some pointers on where to start experimenting from here. I need this lightbox to be up and running in exact a week from now (after my work hours). Is that realistic for an absolute beginner? If not, i'll need to go for some professional help i guess :slight_smile:

Thanks in advance!

Dimitri

#define P1 1    // These are changed to correspond to the digital
#define P2 2    // output numbers that relays 1..4 are connected to.
#define P3 3
#define P4 4


void setup() {
  
  pinMode(P1, OUTPUT);
  pinMode(P2, OUTPUT);
  pinMode(P3, OUTPUT);
  pinMode(P4, OUTPUT);
}


void switchLights(bool L1,bool L2,bool L3,bool L4) {

   digitalWrite(P1,L1);
   digitalWrite(P2,L2);
   digitalWrite(P3,L3);
   digitalWrite(P4,L4);
}


void loop() {

   switchLights(1,0,0,0); delay(100);
   switchLights(1,1,0,0); delay(100);
   switchLights(0,1,1,0); delay(100);
   switchLights(0,0,1,1); delay(100);
   switchLights(0,0,0,1); delay(250);
   switchLights(0,0,0,0); delay(250);
   switchLights(0,0,0,1); delay(250);
   switchLights(0,0,0,0); delay(250);
   switchLights(0,0,0,1); delay(250);
   switchLights(0,0,0,0); delay(250);
}

Here, try that.

-jim lee

Wow, that was fast! Thanks already!

I need to order a suitable relay card and need to download/install the software on my computer so testing will be something for wednesday or so. i can't wait!

For the hardware, is this combination good for my application?
http://www.conrad.be/ce/nl/product/191789/Arduino-UNO-65139-Board-ATMega328
http://www.conrad.be/ce/nl/product/095841/Relaiskaart-5VDC-4-voudig-voor-Arduino-Raspberry-Pi-etc

(sorry, it's in dutch, but i guess you are familiar with the specs and numbers?)

And a last question for now. On the page of the Arduino UNO board, it says that i need a power source of 7-12vdc. Can i use one power source for the leds together with the board or is it best to keep them separate?

Dimitri

For the hardware, is this combination good for my application?

Yes, the UNO and that relay module should be fine.

One thing to note is that the relays are "active low", and the HIGH/LOW state of the outputs in jimLee's program will need to be reversed.

Can i use one power source for the leds together with the board or is it best to keep them separate?

It's best to keep them separate.