Introduction
I bet we all love holidays. Christmas is my favorite holiday of the year. We love Christmas because we get to travel to our hometowns, spend time with loved ones and eat lots of delicious foods…..but what I like about Christmas is the decorations; the colorful ribbons, flowers, balloons and my favorite… the Christmas running lights. With these lights put up in our homes, shops, supermarkets, malls and public places, they are very eye catching and mind blowing as they run around in different patterns.
Christmas running lights also known as LED chasers are built in such a way that multiple LEDs flash on and off for a period of time, forming different patterns such as scrolling, dimming and when looked carefully, they look like they are chasing each other in one direction.
Now that you know about running lights, where else can we utilize them for decoration?
In this lesson you will learn:
- More about LEDs
- How to connect multiple LEDs
- Digital loops
Important things to learn
a)More about LEDs
From UNDA project 1, we learnt how LEDs work and how to connect them. In this project, we will learn how to connect multiple LEDs.
But first, a bit more about LEDs.
LEDs come in different shapes, colors, sizes and brightness. The different characteristics allow you to use them for different purposes e.g. How big or small do you want your LEDs to be.
Size
LEDs are available in different sizes. The most common sizes are 3mm, 5mm, 8mm and 10mm. The size refers to the outside diameter of the LED. 5mm LED is the standard and most common LED. 3mm LED is the smallest and great for use in small fitting projects while 8mm and 10mm LEDs are best for bright projects.
Shape
LEDs also come in different shapes. Common shapes include flat, dome, cylindrical and round shape. They are used in different applications for different purposes example a dome shaped LED helps reflect light out of the top, the round one reflects light out uniformly while the rectangular shape is great for side viewing.
Colors
Light emitting diodes are available in a wide range of colors. The most common ones being red, orange, green, yellow, blue and white
In this project, we will use the common 5mm round in shape LEDs with different colors that is red, blue, green, orange and clear.
b)Connecting multiple LEDs
Can you recall how to connect a single LED from UNDA project 1
For multiple LEDs, the circuit is a bit different but the same rules apply. To connect our multiple LEDs, we connect each LED to a battery power supply through a resistor as in the diagram below.
To switch the multiple LEDs ON and OFF repeatedly, we connect the LEDs to multiple pins on the Unda.Make to send on and off instructions.
What instructions will be sent from the computer?
For the multiple LEDs to turn on and off, the computer will send instruction to each LED that is;
Turn on red LED
Wait
Switch off red LED
wait
Turn on yellow LED
Wait
Switch off yellow LED
Wait
Switch on blue LED
Wait
Switch off blue LED
wait
Continue until LED green is turned on and off then repeats again to red LED
The instructions can repeat for a number of times or continue endlessly.
And we are lucky, because unlike human beings, a computer never gets tired or bored and can keep doing a certain task no matter how many times you tell it. For us to give a computer instruction, we have to write the instruction in form of a program, however since we do not have the energy for repetitive tasks like a computer, to save us valuable energy and time we use something called a loop.
c. Digital Loops
First, what is a loop?
A loop just like the name suggests is going round and round and when you get to the starting point you go again and again.
When you need to repeat the same instruction again and again, we use a loop. Like in our diagram example below, if you want to give your friends a dance move instruction, you can tell them to repeat for a number of times instead of you repeating the instruction.
In UNDA project 1, we learnt that a computer sends digital instructions of 1’s and 0’s that is ON and OFF.
Hence, a digital loop is an ON(1) and OFF(0) instruction that repeats again and again. In our running lights project, the LEDs will turn on and off and repeat again and again.
Quiz
Building the running lights project
Uda Make digital output with different levels
In this lesson we will use digital output pins 3, 5,6, 10 and 11. These pins will each send a 1 or 0 to the LEDs connected to them.
Pin D3 will send ON and OFF to Green LED.
Pin D5 will send ON and OFF to Orange LED.
Pin D6 will send ON and OFF to Blue LED.
Pin D10 will send ON and OFF to Yellow LED.
Pin D11 will send ON and OFF to Red LED.
Let’s build it;
- Place the resistor 1 and the Green LED on the breadboard as shown in the illustration.
- Connector a jumper wire between port 3 labelled as D3 and one side of the resistor.
- Put a breadboard wire between the other side of the resistor and the anode of the red LED.
- Connect a jumper wire between cathode of the Green LED and GND line on the power rail at the bottom. The power rail is connected to the GND port using a jumper
- Repeat the process by connecting Orange LED through a resistor to port D5 and to GND line.
- Blue LED through a resistor to port D6 and to GND line.
- Yellow LED through a resistor to port D6 and to GND line.
- Red LED through a resistor to port D6 and to GND line.
It’s time to run the project
- Open projects.
- Select project 2 – Running Lights.
- If the Kit is powered off, power it on.
- Press center key to upload.
- On the upload dialog box, press the left key to upload.
- The project should run after upload is 100% complete.
Watch this video on how to make.
What did you observe?
Once the project has uploaded and running, you will observe that the LEDs will flash on and off starting with the green LED, then the orange, blue, yellow and red. The LEDs will flash on and off repeatedly as long as the power is on. The process will repeat to the next LED until it reaches the green LED and then repeats again.
For the LEDs to flash on and off, the positive leg of the green LED is attached to D3, which is the digital output pin. Our small portable computer, Unda Make sends the first instruction to turn the voltage high, turning the green LED on and the second instruction to turn the voltage low, turning the LED off.
The same instruction is repeated to the orange LED connected to D5, blue LED connected to D6, yellow LED to D10 and red LED to D11.This instruction repeats again from the start, which is green and this repeats again and again.
The turning ON and OFF of the LED creates a running light effect, that is like the LEDs are chasing each other. Unda Make small computer is used to controls the LEDs switch timing and cycle.
A digital loop is used to give instructions of how many times to repeat the ON and OFF instruction.
Quiz
Feedback is closed.