Analog I/O and Enclosure

Part 1:

Build an interactive circuit that uses at least two different variable resistors (inputs) and some kind of output (sound, light, movement).

For part one one this exercise, I played around with several different sensors and the first circuit I built used a slider, a flex sensor, and a photo resistor each mapped to control the brightness of three different colored LEDs.

https://giphy.com/embed/kv5o7UINQKiDdYzxfu

IMAG1248

After having good success with this experiment using multiple sensors to control multiple lights, I wanted to try using multiple sensors to control a single RGB LED. The photo sensor wasn’t “playing well with others” so I replaced it with a potentiometer.

IMAG1251

This gave me an idea for Part 2 of this exercise to make a color blending sort of toy, using three potentiometers, so rebuilt the circuit with three regular LEDs, red green blue, and one RGB LED. Each potentiometer controls one color. The Red pot is mapped to the single red LED as well as to the red pin on the RGB LED, so when it is turned it controls both.

________________________________________________

Part 2:

Build a custom enclosure for your project – the enclosure can be soft or hard but it must fully hide your electronics.
Parts: variable resistors, photo resistor, micro-controller, breadboard, fabrication materials

I decided to make a color mixing toy, so it seemed appropriate to make the enclosure in the shape of an artist painting pallet.

This slideshow requires JavaScript.

After using the laser cuter to trace out the shape on cardboard, I needed to use an exato-knife to get it out of the sheet.

The cardboard I found in the recycle bin was double thickness so I cut through the layers in a ring around the holes to mount the translucent material that will allow the LEDs to shine through.

This slideshow requires JavaScript.

Two layers of clear plastic sheet with two layers of white tissue paper sandwiched in between gave me the appearance I was looking for. Trace and cut out pieces that fit into the recesses.

Created an inner structure with shallow cardboard tubes that give space for the Red board, power pack, and house the potentiameters and LEDs.

I found that one LED wasn’t bright enough to light up the little pods, so just wired two together using small proto boards to consolidate the wires.

then added the potentiometers threading the wires in through opposing sides to give it some support and to make sure the LED wires don’t touch it.

Cut a hole in each white plastic piece and then mounted them into the pallet with the pot/LED pods, securing with hot glue.

I wanted some unique knobs for this that looked like blobs of paint, so I made some using some modeling foam and craft paint.

Adding all the wiring in was a bit messy, so I combined all the power and ground wires on proto board, and made sure to label each wire as I went so that hooking up the microcontroller would be easier.

This slideshow requires JavaScript.

Here is a rough attempt at a schematic of the wire hook up:

Final step for components was power. I have a 5v power pack from a previous project that happened to fit, so added that. Also added a rim so that when the bottom piece is attached, none of the internal components show.

IMAG1320.jpg

I’m quite happy with this as prototype. The lighting quality isn’t quite as good as I hoped, but different types of LEDs could solve this if I had a longer time frame to research and experiment.

IMAG1324

https://giphy.com/embed/deDsa6TeLfxnD31fw5

In daylight, the lights are more difficult to visualize, so I put it on the floor under the table so it would show up brighter.

https://giphy.com/embed/9uITi0CHz9a1SYqZFG

Here is the code:


int redPot;
int RedGB;
int redLED;
int greenPot;
int RGreenB;
int greenLED;
int bluePot;
int RGBlue;
int blueLED;
void setup() {
Serial.begin(9600);
pinMode(3, OUTPUT); // Red RGB
pinMode(5, OUTPUT); // Green RGB
pinMode(6, OUTPUT); // Blue RGB
pinMode(9, OUTPUT); // red led
pinMode(10, OUTPUT); // green led
pinMode(11, OUTPUT); // blue led
}
void loop() {
redPot = analogRead(A2);
greenPot = analogRead(A1);
bluePot = analogRead(A0);
Serial.print("redPot:");
Serial.print(redPot);
Serial.print("greenPot:");
Serial.print(greenPot);
Serial.print("bluePot:");
Serial.println(bluePot);
//delay(1000); //uncomment to read Pot values
RedGB = map(redPot, 0, 1023, 0, 255);
analogWrite(3, RedGB);
redLED = map(redPot,0, 1023, 0, 255);
analogWrite(9, redLED);
RGreenB = map(greenPot, 0, 1023, 0, 255);
analogWrite(5, RGreenB);
greenLED = map(greenPot, 0, 1023, 0, 255);
analogWrite(10, greenLED);
RGBlue = map(bluePot, 0, 1023, 0, 255);
analogWrite(6, RGBlue);
blueLED = map(bluePot, 0, 1023, 0, 255);
analogWrite(11, blueLED);
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s