« September 2004 | Main | November 2004 »
October 20, 2004
Serial Communication Lab--Using Pots to change RGB
For my serial communication lab, I wrote a processing program that changes the RGB values of a JPG according to potentiometer input from my board.
----
For my serial communication lab, I wrote a Processing program that changes the RGB values of a JPG according to potentiometer input from my board.
My Board:

Mapping
My processing program multiplies the RGB values in a picture by variables that are connected to the potentiometers. The potentiometers have an output between 0 and 255. Some mapping was in order to make them have a desirable effect on the pictures. After some experimentation, I decided that 0-125 would make the multiplier go between 0 and 1. For pot values between 125 and 255, the multiplier goes between 1 and 15.
Random Numbers
To create interesting visual effects, I had the multiplier fluctuate randomly. The pot input set boundaries for the random number generator. If the mapped pot input is 0, the multiplier will fluctuate between 0 and 1, if it produces 15, it will fluctuate between 1 and 15. For aesthetic reasons, 1 is always one of the boundaries.
Here's the Processing code.
Movies
In this movie I have JPG of the visible spectrum. At the start, all pots are at their midpoint. Then I move them, starting with blue, towards 0. As a result the colors start to fluctuate between 0 and their original values. After I have done that to all colors, I move the pots, starting with the red one, to their maximum values. This causes the colors to fluctuate between their original value and the maximum value allowed by Processing.
Here's another movie where I do the same thing to a more interesting picture.
Here's the Processing code.
Posted by rus200 at 06:12 PM
October 15, 2004
Beer Garden Sound Meter -- Project 1
Here's two movies of our Beer Garden Sound Meter.
-----
Meter Mode:
Bucket Mode:
Posted by rus200 at 03:35 PM
October 04, 2004
Lab 4 - Analog Out
Lab 4: Servo/Analog out. I had problem with the servo responding bizarrely to the analog input. I also built a musical instrument of sorts using freqout.
-----
I ran into a problem in the second step. Following the instructions in the lab, the analog output (using PWM) would only go from 1 to 1.5 volts, instead of 1 to 2 volts. As a result the servo would only move in 50% of it's full range. This is what fixed it. I changed the equation in the lab:
pulseWidth = minPulse + (pulseRange * (sensorValue/10)) / 100
to this:
pulseWidth = minPulse + ((pulseRange * (sensorValue / 100)) /10)
I'm not sure exactly why this works, but one possibility is that pulseRange * (sensorValue / 10) creates a number too large for the chip to process. Dividing it by 100 creates a manageable value that can be then divided by 10. Unfortunately, this results in the loss of some resolution in the reading/translation of the analog input.
Did anyone else have this problem?
Here's a video of the servo.
For my application, I made something like a musical instrument. I used analog input from a pot as a parameter for the freqout function. I tried to use two pots and two freqout functions to get harmony, but I'm not sure the chip is capable of that. It resulted in this cool rhythm though.
Here's a video with sound.
Posted by rus200 at 01:44 PM

