Week 8 - Untoolkit : electronic outputs

Zine

My zine design :

State 1 - Thijs Uffen
State 2 - Thijs Uffen

Assignment 1: RGB LED & digital switch

For this assignment, I used my Grove Arduino board. My regular board is broken so I had to improvise. Loes helped me out with this problem and showed me a way to connect the grove board with my breadboard.

My arduino setup - Thijs Uffen

To begin with, I connected the RGB LED to my groveboard on the D0, D1 and D2 pinholes. I connected those to my breadboard. Then I placed three 22 ohm resistors on the board, paralel from the LED pins and the cables. At last, I connected the LED to an GND port, and connected this to the GND of my arduino.

In Arduino, I used the following code that Loes provided to me:

After I uploaded the code, the LED on my breadboard began to shine different colors!

My working RGB LED - Thijs Uffen

Now my LED is working, I am going to connect a switch to toggle between the different colors of the LED.

The setup for my button - Thijs Uffen

Because I don't have a 10K resistor at home, Loes has thaught me to use a Pullup. In this way, you can enhance the signal a digital pin is giving. I had to swap the High and Lows in the original code from Micky, because the connections on the breadboard are different. The button is normally attached to a ground, but now it has to be attached to a 3v port. My code looked like this:

At first, I received unexpected outputs from the counter in the code. I only saw a red light from the LED.

Only a red light - Thijs Uffen

To check if my code was correct, I added a serial print line to each else if statement. The code was correct so it had to be my hardware.

I finally noticed that my resistors didn't connect properly, so the green and blue colors didn't want to light up. When I fixed this, I noticed that the output was very unstable. It had to do with my counter, because I saw in the monitor that the counter value fluctuated from 0 to 3 very quickly.

Disco party - Thijs Uffen

When I switched

to

I fixed the problem. Because when the previous button state is high and the counter reads false, it forms a loop and pendles between the counter values. When the previous button state is high and true, the counter can make a distinction between the different inputs.

It finally worked! - Thijs Uffen

Assignment 2: RGB-LED & analog sensor

The next assigment was to connect a RGB-LED to an analog sensor. Originaly, we had to use a LDR sensor. I didn't have one, so I used a grove light sensor.

The setup I used for this assignment - Thijs Uffen

At first, I tried the code on DLO. Because I use a different sensor, the code didn't work properly. I searched on the internet and found a nice code I could use to manipulate the RGB-LED with the sensor:

The code worked perfectly, the color of the LED changed when placed in a dark environment.

Working light sensor & LED - Thijs Uffen

Processing & Digital Swatch

The next step is to work with Processing. Processing is a sketchbook software that generates visuals by the input of code. It is possible to connect the input of your sensor with Arduino to manipulate the output of Processing.

Because I was working with the grove light sensor on my previous assignments, I decided to use it for this assignment as well because I am familiar with it.

The output created by Processing has to resemble the series we created, so I am aiming for a black background and copper details.

I searched on the processing website for some nice variable examples in shapes. They all use the mouse position, I have to adjust to code so the output reacts to my sensor input.

To do so, I wrote some code for the Arduino, so the output on my COM3 will convert it's values for processing languague.

Next, I looked at the examples on the processing website. I came across a cool design, a bezier.

The example I found - Thijs Uffen

The code for this example was originaly like this:

The sketch now only uses the input of your mouse. The styling is also not in line with my idea. So I had to connect my sensor input with Processing, and change the values of the sketch to make it appear more like the series we've made.

The code I wrote looked like this:

I adjusted the thickness and colors of the lines. I also adjusted the canvas size to match the 10cm * 10cm requirement. I changed the bezier input to dataInput instead of mouseX.

The digital swatch I made - Thijs Uffen

I uploaded the code, and the bezier moved when I changed the light on my light sensor!

It worked! - Thijs Uffen

Reflection

During this week, I learned a lot of new insights concerning programming on Arduino. I had some prior experience, but that was very basic compared to the things I've done this week.

Especialy the combination with the breadboard and additional electronical circuit props, like resistors (and the lack of them) has thaught me to debug, program and build cool installations.

Loes helped me out a lot this week, because I didn't have all the required parts. I learned how to pull up a signal for my Arduino board, so I can bypass the required 10k ohm resistor for my button.

Last updated