Objective: To explore digital inputs and outputs using a microcontroller and an Arduino prototyping environment
Digital I/O With LEDs: For this part of the lab, I used an microcontroller (Arduino Nano Every) to turn on/off two different LEDs. The Arduino supplied all of my circuits with 5 volts. To turn on/off the blue LED, I basically made two circuits that were connected through Arduino code. One of my switches was connected to pin 2 on the microcontroller, and pin 2 checked for a high voltage or low voltage. The blue LED was connected to a resistor, which was connected to pin 13 on the microcontroller. I chose a 47 ohm resistor since the blue LED had a forward voltage of 3.4 volts and a forward current of 0.03 amps according to this website. Therefore, resistance would equal (5-3.4) volts / 0.03 amps or 53.3 ohms. When the switch was closed, pin 2 would sense a high voltage (5 volts) and then pin 13 would send a signal to the blue LED to turn it on. The switch also had a 10K ohm pull-down resistor to hold the logic signal near 0 volts when the switch was open.
The circuits to turn on/off the red LED worked the same way, except I used a 100 ohm resistor, and I used pin 3 and pin 14. Pin 3 had the same role as pin 2, and pin 14 had the same role as pin 13. I chose a 100 ohm resistor since the red LED had a forward voltage of 2 volts and a forward current of 0.02 amps according to this website. Therefore, resistance would equal (5-2) volts / 0.02 amps or 150 ohms.
Schematic for digital I/O with LEDs
Breadboard setup for digital I/O with LEDs
When coding up my circuits, I had to keep track of my different pins and double-check my variables to make sure that each switch would control their respective LED correctly. I referred to this diagram, and modified some example code provided in the Arduino prototyping environment.
https://gist.github.com/tranjames267/5d469b91774e329b5c8cacdc0f34ba4c
A video showing the digital I/O with LEDs working
Digital I/O With Neopixels: The breadboard setup for the Neopixels was very similar to part 1 in the lab. I kept the switches and their respective resistors in the same spots and just replaced the LEDs with a Neopixel strip. The main challenge in this part of the lab was soldering for me, especially conditioning the tip of the soldering iron. Much of my time was spent trying to figure out where the solder would melt, and soldering became much easier after touching the tip to some tin and using some metal wool to clean it. After I soldered 3 wires to the Neopixel strip, I made sure to secure the connection with hot glue. Connecting the Neopixel strip to the breadboard was fairly simple. One wire went to power, another wire went to pin 13, and the last wire went to ground.
Schematic for digital I/O with Neopixels
Close up breadboard setup
Breadboard setup showing Neopixel strip
I coded the Arduino such that when pin 2 sensed a high voltage of 5 volts, the Neopixel strip would show a multicolored LED pattern. When pin 3 sensed 5 volts, the Neopixel strip would show an alternating blinking pattern. I modified the example code from class to program these patterns.
https://gist.github.com/tranjames267/1051336f84a781dcee67640ac3777843
Video showing the Neopixel strip working
Soldered Breakout Board: The purpose of a breakout board is to take a small part of a larger circuit and isolate it on a board with simpler connections. I chose to make a digital output breakout board with two 100 ohm resistors and red LEDs in a parallel circuit.
Schematic for digital output breakout board
First, I arranged my components on the breakout board. I added my signal and ground wires, along with my LEDs and resistors in the configuration below. I had to bend the wires of the components to a horizontal position to keep them steady on the board.
Breakout board configuration with signal (red) and ground (green) wires
Since I had four nodes in my schematic, I had to solder 4 points on my board. To start soldering, I stuck my board upside down on a piece of putty and arranged my wires such that I would have my 4 desired nodes. I had to clip the component wires because they were fairly long. After I was done with my arrangement, I soldered both of the resistors to the signal wire. Then, I soldered one resistor to the anode of an LED and soldered the other resistor to the anode of the second LED. This resulted in 3 soldered nodes.
Breakout board with 3 soldered nodes
The last node required me to connect the cathodes of the LEDs to the ground wire. Being right-handed, I decided to rotate my board so that I could reach the last node more easily. After I connected the last node, all 4 of my nodes were soldered and complete.
Breakout board with 4 soldered nodes
To test my breakout board, I simplified my circuit from part 1 of the lab so that I would have 1 switch connected to pin 2. Then, I connected my breakout board to pin 13 and ground. After I saw my breakout board working, I applied hot glue to the nodes to secure them and finished the back of my board with a strip of tape.
https://gist.github.com/tranjames267/f5a4ed23f02481d93ff2e6952cc258d2
Video showing the breakout board working