Connecting many solder boards so they work in synch

Hi, thank you so much for helping me! Right now I have 5 solder boards that are based off the circuit design I am attaching below. I want the boards to work synchronously; however, I do not know how. All of the boards can turn on and blink. However, I want it so that right when I turn on the Arduino, all 5 boards will turn on and blink at the same time as well as turn off at the same time. Below is my code and I have attached 2 images: one of the solder boards and one of my circuit design. I know each board will need its own 9V battery, however, I want to connect them so that the moment I turn on the Arduino, all of the boards work synchronously. Thank you!

byte timeRunning = 0;
byte startButton = 2; // or whatever pin is used, button pin to Gnd when presses
byte ledPin = 3; // or whatever pin is used, will turn relay or MOSFET
byte onBoardLed = 13;
unsigned long startTime;
unsigned long timeNow;
unsigned long elapsedTime;
unsigned long thirtyminutes = 30 * 1000 * 60UL;

void setup() {
pinMode (startButton, INPUT_PULLUP);
pinMode (ledPin, OUTPUT);
pinMode (onBoardLed, OUTPUT);
Serial.begin(9600);
}

void loop() {
// wait for start button press, ignore if already pressed
if ((digitalRead (startButton) == LOW) && (timeRunning == 0)) {
timeRunning = 1;
startTime = millis();
Serial.print("Inside if statement for timeRunning == 0");
Serial.println(timeRunning);
}
if (timeRunning == 1) {
timeNow = millis();
elapsedTime = timeNow - startTime;
if (elapsedTime <= thirtyminutes) {
digitalWrite (ledPin, HIGH);
digitalWrite (onBoardLed, HIGH);
delay (100); // one second on time
digitalWrite (ledPin, LOW);
digitalWrite (onBoardLed, LOW);
delay (100); // one second off time
Serial.print("startTime: ");
Serial.println(startTime);
Serial.print("timeNow: ");
Serial.println(timeNow);
}
else {
// 30 minutes is up
timeRunning = 2;
Serial.println("Inside else statement");
digitalWrite (ledPin, LOW);
digitalWrite (onBoardLed, LOW);
}
}
}

Why 5 separate boards rather than just 1 ?

You need to review how to power LEDS, what you show is not correct.

Find your FET type in the drawing. Note also: signal flow is left to right; ground at bottom, +V at top.

I am using an NPN N2222. How can I like the 5 to one? I need to space out the LEDs around the cast I am making which is why I could not put it all on one board. Thank you!

You haven't fixed the MOSFET yet? Flip it left to right. Body diode and D connected to the LEDs, Source to Gnd.
With NPN, Collector will connect to LEDs, Emitter to Gnd.

Couple options:

  1. Drive all the gates, or bases, from the same Arduino pin.

  2. Use 5 Arduino pins, turn all on/off at the same time.

Please stop creating new threads.

I did change the MOSFET to a BJT. I am using an N2222 now but have not changed my schematic sorry. I want the 5V to carry out through the different solder boards and for all the different ones to connect as well. I have tried to connect the grounds together but still, the other board won't light up. Is there a reason? Thank you!!

You can see how one signal, power, and Gnd can run out to each patch of LEDs with a transistor mounted at each patch.


Or put the transistors with Arduino, and just run power and the connection to the transistor collector to each patch.

What would happen to my 5V pin? In addition, does this mean that I can power all 5 boards from just 1 9V battery? I see that there is a battery drawn, but I do not see every board needing one. Why is that so? As well, I have been playing with 2 solder boards and trying to connect them together. What I did was I connected one board to my Arduino and it was blinking and worked well. Then I took another board and use an alligator clip from the ground to ground, the switch you drew at Start to that switch on the second board, and one from the 5V on one board to the other post I soldered for the 5V. (The 5V post is the same place as the positive of the battery). I then connected an alligator clip from the post connected to pin 13 on one board to the other and what I noticed then is that those lights stopped blinking. Is that normal? Thank you so much for your help! I appreciate it so much!

Pin 13 can not drive more than 1 or 2 LEDs directly. Anything more needs a transistor. If you actually connected to D13, you may have damaged the Arduino pin.

I drew a 9V battery as that is what your schematic had.

Battery + (after the switch) goes to the anode of all patches in parallel.

You can power all 5 from one 9V battery. I have no idea how long it would run. I think a 1/2 hour was discussed in your other thread.
The 5V pin would not be used for anything.

Does this make the power connection any clearer?

Yes, I am hoping for it to run for a minimum of 30 minutes. Each LED is 1.2 V (850nm infrared diode). This is a lot clearer thank you. Just to be sure, I will keep it how I have it—one BJT per solder board // circuit—I do not need to add another to connect the boards all together?

Right now, I have my emitter soldered to a post on each board because I was using that as my ground. I can keep that, but what I need to do is have a jumper or wire and have all of the posts attached to the emitters connect to each other?

I will also keep the base of my BJT connected to a soldered post (I soldered a wire standing straight up and used them as my posts) but then wire it so that all the posts are connected to each other?

I also see that there is a wire coming out of the switch that is connected to the battery, which I will only need to use 1. With that, I will connect them all to the battery ground posts?

Thank you for your drawing! I ended up only using one resistor (33ohm) connected to the LED strip and collector. However, that should not matter to the rest of the circuit and the number of batteries I use. Correct? I appreciate your help!

ended up only using one resistor (33ohm) connected to the LED strip and collector. However, that should not matter to the rest of the circuit and the number of batteries I use. Correct?

No incorrect.
You need a resistor on each strip. This is because LEDs are none linear devices and as such will not share current evenly.
Also having such a low resistor value then the constant current effect of a resistor is diminished.

So is it not possible to connect all the boards now?

Also, sorry, my ground is connected to my emitter of my BJT but my battery negative is connected to a post on the strip I connect all the cathodes too. Is it okay to still connect all the boards together? Thank you!

jchia:
Also, sorry, my ground is connected to my emitter of my BJT but my battery negative is connected to a post on the strip I connect all the cathodes too.

The battery negative should be connected to the BJT’s emitter and that point connected to all boards and the ground of your Arduino.

Using a BJT will drop about a volt reducing the voltage you have to light the LEDs. Where as a FET does not have a fixed voltage drop it is found by multiplying the on resistance by the total current.

So I’m guessing if the battery isn’t connected to the emitter it won’t work? Also, I do not need to add anymore transmitters to get this to work correct? Thank you for your help!!

Out of curiosity too, why is pin 13 so special? If I put my code into pin 12 will it work like pin 13?

There is no guessing ;).

“ Out of curiosity too, why is pin 13 so special? If I put my code into pin 12 will it work like pin 13 ?”

Yes.

My issue is that when I connect grounds and then pin 13's together they do not blink. Is there an issue in my code? When it's not integrated they do blink though.

Okay, so I think you're saying this now.
Every "patch" is a standalone unit, that just needs Gnd and a Control line going to the processor.

What is the resistor value in front the of the transistor?
You may be able to connect all the resistors to one output pin, you may need to use one pin to each patch.
If you do 5 digitalWrite()s to 5 pins, they will look simultaneous - your eye can't detect the microseconds of time difference from output to output.

Yes, currently that is what I have. However, my schematic is slightly different now. I ended up soldering it like this:

4.7k ohm resistor is connected to the anode of the most left column of the LED strip. (I have 4 LEDs in series, 5 in parallel, and 20 LEDs per solder board). The other side of the 4.7K ohm resistor is connected to a switch and the switch is connected to ground.

The ground the switch just mentioned is connected to a post which is connected to the emitter of my NPN 2222. For my NPN 2222, the emitter is connected to ground, the base is connected to another resistor and the collector is connected to another resistor.

The base is connected to a 1.2K ohm resistor which is connected to a post and that post is where I clip connecting to the pin 13.

The collector is connected to a 33ohm resistor which is then connected to the anode of the last column of LEDs, which I am aware is odd.

My LEDs are connected in a way that (on the very left column) the anode is connected to a 4.7ohm resistor, and then that LED's cathode is connected to the LED behind's anode. The 5th LED in that column's cathode is connected to a strip I soldered and that pattern is the same for all the columns. All of the 5th LED's connect to the same cathode strip and all of the 1st LEDs connect to the same anode strip.

There is a post soldered onto the cathode strip. That is where I attach the negative end of my 9V battery. I connect my positive end of the 9V battery to the post attached to the connection between my switch and 4.7ohm resistor.

I connect the wire from my Arduino's 5V pin to the post connected between the switch and 4.7ohm resistor as well.

I then have the switch that is connected to pin 2 and ground (aka the post attached to the emitter).

I have a wire from the Arduino connected to the post attached to the switch connected to pin 2.

I am using the Arduino's 5V pin to add on to the 9V battery for brighter LEDs. I am using 850 nm LEDs. I will post a picture of my soldered board below. Thank you so much! I am very confused with how this has turned out because my LEDs blink and work when alone but when I am trying to integrate them they do not seem to work as well. Is there a solution to this? I have connected posts together and the LEDs light even with one battery but it is hard to tell if they are blinking...it does not seem to look as if the added boards blink though. I really appreciate your help and am sorry for all these issues. I am in a time crunch.