This week had our class dealing with output devices. The group assignment was to measure the power consumption of an output device, and the individual assignment was to add an output device to one of our boards and program it to do something.
Group AssignmentOur group assignment for this week was to measure the power consumption of an output device. We started by creating a circuit with an arduino, led, resistor, and breadboard. We then wrote some code to change the brightness of the led and uploaded it, before using a multimeter to test the power by placing the two ends on either side of the resistor. This allowed us to see the fluxuation of the pulse width modulation signals.
We also looked at the power in different situations with a small motor. It took all of our hands to connect the wires and measure the components themselves, but with some help from Madison as our camera-person, we could still kind of document our work.
When Professor Goodman added a load to the motor, the amperage increased on the multimeter to almost 1 amp and the voltage dropped to 5 volts.
Individual AssignmentFor this week's assignment, Whitney and I wanted to get a head start on our electronics components for our final project. We were thinking of adding lights and sound to our seating orb, so Whitney decided to work on having speakers as an output and I was going to work on lights. I wanted to make the neopixels glow in a rainbow that faded between the different colors. My goal for this week was to light up neopixels using one of the boards I had already made. To start, I downloaded the arduino neopixels library within the arduino application. I had never used neopixels before, so I started out by writing a simple blink function with them, which I was going to test to see if I was coding them correctly. To do this, I was going to use my board I made 2 weeks ago for input devices week. When I first went to upload my code, it gave me a UPDI initialization error. I checked my connections and still couldn't get it to work. I tried uploading the code to my board from week 8, and that wouldn't work either, so I was in a funk. I then decided to consult with Professor Goodman, and he also couldn't figure out what was wrong. We tested voltage, continuity, the connections again, my code, and even hooked my board up to the oscilliscope. When we checked the oscilliscope on the neopixel pins, the voltage was high, but there was no flashes of data popping up on the screen.
The board was uploading code, but it just wouldn't work with the neopixels. We knew that they worked, because when I initially plugged them into the board, a few random ones lit up.
My board had a led, and we added a blink function to the code, which worked, but was super faint!
Even though this worked, the neopixels still wouldn't light up. We then tested the if the code was actually sending to the pins by hooking up an arduino to the neopixels. This did work, and we used an oscilliscope for the current, which had the correct output with flashes of data.
After all of that, Goodman said the issue might be my attiny, so I switched it for a new one. I did this, and we still had issues. We looked at the code again, and realized that when I added the blink function as a test, I just wrote the pin that the led was on, and there already was a led int and output declared. I changed the pin to the one I needed, and replaced the number in the blink function with the variable. I then uploaded this code and the led worked regularly with the correct brightness! It was nice to fix this bit of confusion, but sadly, it had nothing to do with what I was trying to accomplish for this week, so I really didn't make any progress. With all of our trials, Goodman and I decided to start with new code. I went under file in the arduino application, and then went to examples, before opening a strand test file.
I changed the numer of leds to 10 so it wouldn't take a lot of power, and put the correct pin number before uploading this to my board. This code worked perfectly! The strand test showed a bunch of different functions for the neopixels. One of these functions was exactly what I wanted to do for our final project. This was a simple rainbow, where the whole strip changed colors. This function was just called rainbow! I deleted the code for the other patterns, and then uploaded the plain rainbow function code to my board. It turned out great and you can see it here!