Introduction: Switching 3 Banks of LEDs With One Switch and Visuino

Picture of Switching 3 Banks of LEDs With One Switch and Visuino

This project came out of an experiment that I wanted to try, I wanted to see how much UV light was needed to see various portions of dollar bills and security checks. I had a blast building this and wanted to share these instructions here.

Things you'll need:

#1 An Arduino Nano or similar small board [even an UNO would work, just kind of big for this project]

#2 One standard sized breadboard, the 720 pin kind.

#3 3 sets of similar LEDs, each set should have the same specs, as far as Voltage and resistors required. [I used 6, 3mm UV and 3, 5mm UV for mine, but you can use any that you have on hand.]

#4 9 resistors matched to your LED current requirements.

#5 A momentary switch, either from a 37 in 1 sensor modules kit or a regular one that you can set up so it uses 3 wires.

#6 Bunch of relatively short jumper wires. [I used yellow, orange, red and black]

#7 Visuino a Visual Programming program by Boian Mitov plus the Arduino IDE

Step 1: Setup the LEDs and the Resistors...

Picture of Setup the LEDs and the Resistors...

In this first step, we will setup the LEDs and the Resistors. Place you LEDs a short distance from where your chosen Arduino board will be and about 1 or 2 slots from each other, to leave a comfortable space in between them. See Picture 1.

Next, place your resistors so one end is stuck in the GND rail of the breadboard and then the other is placed into the slot for the cathode pin of the LED. Reference Picture 2.
[I placed a jumper to connect the breadboards 2 GND rails together.]

Step 2: Setting Up the Wiring...

Picture of Setting Up the Wiring...

First up, for this step is to connect 2 GND wires from the Nano to the Ground rails on both sides of the breadboard. You can use a GND on either side of your chosen Arduino type board, I just used the same one for both of mine. Picture 1 & 2

Please note that the Ground rails on your breadboard may be located slightly differently.

On Picture 3 I have started plugging in the 3 different banks of LEDs into 3 Digital Pins, numbers 2, 3 and 4. Yellow wires are plugged into Pin 2 and connect to the LEDs that are the furthest away from the Nano. The Pin 3 wires are Orange and connect to the middle set of LEDs and the Red wires connect to the closest LEDs and are connected to Pin 4. Picture 4 shows the connections on the Positive side of the breadboard.

Step 3: Connecting the Switch [used for Changing the State of the LEDs]...

Picture of Connecting the Switch [used for Changing the State of the LEDs]...

On my switch, in Picture 1, the Signal and the Negative are denoted on the left and the right, respectively, so the middle connection is the Positive one. The Black wire gets connected to the GND rail on the upper side of the Nano and the White wire gets plugged in the 3.3V Pin on the Nano, while the Brown wire goes into Digital Pin 10. As seen in Picture 2 and 3.

Step 4: Setting Up the Sketch in Visuino...

Picture of Setting Up the Sketch in Visuino...

So, in this first Visuino Step you'll need to open Visuino or Download it from here: Visuino.com and install it per the on-screen prompts.

Next, in the main window, you'll need to select the Arduino compatible boards that you will be using for this project. Picture 1 shows that I have the Nano selected then click "OK"

Then you will want to to go to the Search box in the upper right-hand corner and type in 'but' the first part of the word, 'button' Picture 2 shows the results of this search. Drag the button component to the left of the Arduino board and space it away as shown in Picture 3.

Next, search for 'counter' in the same search box above the components sidebar, and drag the standard counter without the + and - on it, [Picture 4] to your main window just the right of the button component. See Picture 5.

Then, you are going to drag a connection wire from the Button Out to the Counter In. As shown in Picture 6.



Step 5: Setting Up the Sketch in Visuino... [continued]

Picture of Setting Up the Sketch in Visuino... [continued]

In this step, we'll continue adding individual components, next up will be the decoder, so in the search box type in 'decoder' and there is only one option, in 2 different categories, Picture 1. Drag it to the right of the counter so the pins points line up, as shown in Picture 2. In Picture 3 you can see to drag a connector, from the counter to the decoder.

Now you want to add some 'output pins' to it for the different stages of the button. Change the default number to '5' in the Properties window and tap the "Enter" key on your keyboard to set it as in Picture 4. Now you can see that the pins have been added in Picture 5.

Step 6: Setting Up the Sketch in Visuino... [continued]

Picture of Setting Up the Sketch in Visuino... [continued]

The next component we'll add is the OR operator, so search for 'boolean' by typing 'boo' Picture 1 and drag the OR component to the right of the decoder. Then we'll need 2 more, so drag those below the first one, as seen in Picture 2. Next, Drag a connection from Pin [1] of the Decoder to Pin [0] of OR1 Component, see Picture 3, and proceed to drag Pin [2] from the Decoder to Pin [0] of OR2 and then Pin [3] to Pin [0] of OR3, please see Picture 4.

Now you'll make the connections from the OR components to the Nano (or whichever board you are using). So, Drag connections from the Outs of the ORs to the Pins 2, 3 & 4, as seen in Picture 5.
At this stage, you have a working sketch, can you guess what it would do if you uploaded now and pressed the button?


Stop here to try out it for yourself.


See the next Step for the answer.

Step 7: Mid-Project Experiment...

Picture of Mid-Project Experiment...

So, did you test this, if you did you'd find out that the button presses turned on the LED set for each of the first 3 presses and the fourth one didn't appear to do anything, other than turn the last one off.

At the step in the project, I will explain what's happening.the Decoder has 5 positions for the button, the first one [0] is everything off and is the starting place. The next 3 each turn on one set of LEDs and the fifth (Output 4), that doesn't seem to do anything, at the moment, will be set up to turn them all on.

Step 8: Finishing Up in Visuino...

Picture of Finishing Up in Visuino...

Now just to finish up this sketch, you'll need to complete the circuit for the ORs that we added. So, drag some connections form Pin [4] of the Decoder to each of the ORs Pins [1]s, 3 of them in total. See Picture 1.

Next, connect the Input of the Button, to Pin10 on the Arduino board.(This Pin is up to you, that's just where I connected it) Pictures 2 & 3.

Picture 4 shows the completed circuit sketch and if you need/want to monitor the Serial output of the Counter then connect that output to the Serial Input as well. See Picture 5.

Step 9: Completion Video and Finished!

Now upload your sketch via the F9 Key in Visuino and then upload to the board from the Arduino IDE with CTRL+U. Then you'll have a working version of this project too.

Play around with it, to see what else you can add to enhance this sketch, then let me know in the Comments.

Enjoy!!

Comments

JimR153 (author)2017-11-30

If you remember it, I made a Sonic distance switch using only the Sonic component and the Boolean not, if something comes within 5 inches it triggers. You could almost add it to this and scratch the switch. Pass the bills over the sensor and it could do the lights automatically like. I think that I will have to build this one. You got my vote.

BoianM (author)2017-11-18

Congratulations! Very Nice :-)

Added it to the rest of your tutorials in the Visuino Wiki:

https://www.visuino.com/wiki/index.php?title=Main_Page#Kurt_Roesener

KurtRoesener (author)BoianM2017-11-18

Thank you, I had some of your help along the way...of course ;)

BoianM (author)KurtRoesener2017-11-18

You are Always Welcome KurtRoesener :-) !

About This Instructable

861views

8favorites

Bio: Computer Tech for 30 years, got interested in Raspberry Pis around 2012 and Arduinos in 2015. Always into Electronics and now creating Projects for others.
More by KurtRoesener:Simple Ambient RGB LEDs Lights With Visuino.Switching 3 Banks of LEDs With One Switch and VisuinoUsing the Trinket Pro With the Neo-Pixel Stick With Visuino
Add instructable to: