I was on a roll with Arduino in late December. Then I got to this project. It didn’t work. I knew it was something silly as I knew what was going on, but something wasn’t correct. As is my wont, I became frustrated. I put this away.
And it’s been away for two months, nearly.
Plugged it in today, re-wired the circuit as I had disassembled it to create a circuit for my students, plugged it in, and all worked as expected. Hoo rah!
I actually caught myself smiling. I am not a smiler.
Sometimes we need to just put something away for a while and come back to it with fresh eyes. That is definitely the case here.
I understood the code that was written (basically what was done in tutorial 1).
I found it interesting that McWhorter put the voltage on the breadboard “working area” and not the power rail. It doesn’t matter, but I thought that was what those columns were used for.
So, all was good. The homework was to add to the circuit. Specifically, a blue and a green LED. The requirements were to blink the red five times, the blue 10 times, and the green 15 times.
Each light received voltage from the Arduino directly so no need to connect them in a series. What needs to happen, however, is to get the grounds together since there is but one ground on the board. A couple jumper cables from the cathode of the red and blue LEDs to the green cathode row completed the circuit.
The one thing that came up that I decided not to pursue is the coding. There has to be commands that would have shortened the code. The way it is right now is that there are five blink commands for red, 10 for blue, and 15 for green. I am certain I can state to loop something 5 times, 10 times, and 15 times without duplicating the code. That will probably come in a later lesson.
Several years ago Dan Connelly delivered a Toastmasters speech about LEDs. I wasn’t into it at the time. He was re-working all the fixtures at his place of employment and had become fascinated with the technology.
Currently I am working through a couple Arduino courses. Paul McWhorter has an excellent series. His second lesson is all about how LEDs work. This time around, I have caught the bug.
McWhorter emphasizes that we should know the physics behind the LED, not just the computing to manipulate it. To that end, he goes into a lengthy discussion on semiconductors.
It took me, dear reader, several tries before I got it. I confused semiconductor with microcontroller, thus thinking the semiconductor was separate from the LED. No, the semiconductor is within the LED. Once I had that straightened out, I understood.
So, one does not just send voltage to the LED. It travels through the semiconductor, which has been specially made to have atoms with extra electrons and atoms with extra protons. The voltage separates these extras into the bands. The more voltage, the lower the threshold for movement. The electrons connect with the holes. This current is passed to the LED. The LED is pre-made with a forward voltage. Whatever it is dialed in at determines what color light is produced.
I found this handy graphic that shows how the LED works:
Learning can be so fun! One thing leads to another.
This project was to learn how to code the Arduino in order to read the state of a pin (on or off) and then construct a situation in which the lights that are connected to the pins are toggled on and off. The lesson I did with Paul McWhorter proved helpful with this.
I was able to construct the circuit and read/understand the code without issue.
The issue I had with this project was solely trying to get the paper on top of the circuit I built. This breadboard is small. It was dark and light wasn’t great in the apartment. My eyes aren’t what they once were. The idea is that the lights are for a spaceship for which we might want to activate hyperdrive. Contrived. I eventually got the damn thing on the LEDs back into the correct holes.
The homework for this lesson was to extend the complexity either with LEDs or switches. I added an LED. First, I had the yellow light blink with the second read LED. Then I coded the yellow light to blink when the button is off and toggle off when the button is pressed. The red lights blink at that point. Success!
Not the first time I’ve built a circuit as this used to be our fourth grade curriculum. We did not use resistors, however. The resistor was a bit of an issue. Looking for the 220Ω resistor, it did not match the photograph. There’s a handy resistor color key guide provided. Unfortunately, nothing seemed to match. Frustrating. I finally searched and found someone who described the color scheme that I had. Part of it was that my eyes spotted different colors than what are apparently. Another reason was that these resistors were strapped into the band backwards from the others. Found it!
Another frustrating thing I experienced is that there was not a black jumper cable provided. Black is always used for ground. Mine has orange because I didn’t have another. 🙁
But it all works as designed. 5 volts of electricity flows from the Arduino board (powered by a USB cable) through the red cable to the breadboard. Electricity then flows through the resistor. The resistor changes some of the current to heat so as not to overpower the LED. The electricty flows then to the switch where it stops. When the switch is pressed, the electricity continues through the red jumper to the LED. It powers the LED. To complete the circuit, the electricity flows through the orange jumper cable up the rail of the breadboard to the black cable and back to the ground pin on the Arduino board.
Series & Parallel Circuits
Next up was making different circuits. The series circuit went without issue. I struggled with the parallel circuit. It took me a while to let go of the differences in colors of the jumper wires. Once I did, things progressed. Even so, I couldn’t figure out why one of the buttons would not light. In the end it was just a case of old-ageism. I can’t see the little things as well as I would like. I had misaligned one of the wires. I thought it was in a different row than it actually was. Yup, human error . . . the ol’ I-D-10-T error on my part. Once I figured that out, all was good!
At the end of the lesson, students were challenged to make a parallel circuit with three or four buttons. Completed!
A couple years ago I was given an Arduino starter kit. The idea was that Fritz and I would learn electronics together. We played a little, but his interest quickly waned. I guess I moved on too. While it was a good kit, I decided to reduce my load and I got rid of it.
Now that I am settled, I decided to bring this project back into my life. I purchased the same kit and this morning have begun playing around with it.
Paul McWhorter is a fabulous teacher. After watching his first lesson on the Arduino, I have successfully written a couple programs. Yes, it is very basic, but I am able to control the wired light on the board of the Arduino itself through pin 13.
Yes, this 55-year old man is giddy with his success!