criticalmaking.com

RGB (Red, Green, Blue) Voting System

February 21, 2009inf2241_classfi22410

Group: underconstruction
Other posts:

The rich discussion about how to introduce a bias in voting systems provided several ideas. As documented in other posts the mayor intuition was the exploration of a voting system that allows the voter to provide a wide rage of options and prevent a binary selection. This idea of a system that uses a gradient of values led us to explore an additional implementation using a color-based system.

RBG Voting System

RGB Voting System

How does it work?

Materials:
3 Potentiometers
1 Red LED
1 Green LED
3 Resistors

Three potentiometers control a color on the screen (mixing Red, Green, and Blue). A color is composed of three values each between 0 and 255, so for example the color white has a record like (0, 0, 0) whereas the color black has (255, 255, 255). The user has 10 seconds to record an answer.  While recording, a green LED can tell the user that a question/option is active. Then the red LED indicates that is time to switch to the next question.
Bias in color as a measure tool

The result of this process is a system with a particular type of bias: the use of color as a measuring tool. The voters would select certain gradients of color according to their preferences. However, the selection of color introduces a quite subjective principle of measurement.

Initial sketch


Processing Output
Once the code is uploaded to the Arduino board and the analog readings are set up to be received by Processing, the output is window which changes the background using RGB (Red, Green, Blue) combinations.

Connecting …

The Analog Input

Here a video of a little different variant of the RGB. In this experiment, an RGB led is used to create a multi-color lamp)

/// —— Arduino Code

//declare the analog pins.
int analog1 = 1;
int analog2 = 2;
int analog3 = 3;

//Declare variables for the analog data
int val1 = 0;
int val2 = 0;
int val3 = 0;

void setup() {
//initialize the serial Port
Serial.begin(9600);
}

void loop() {
//read the analog 0 pin
val1 = analogRead(analog1);
val2 = analogRead(analog2);
val3 = analogRead(analog3);

//divide the value by 4
val1 = val1/4;
val2 = val2/4;
val3 = val3/4;
//send the value to the external application. Notice how we are using
Serial.print(val1, BYTE);
Serial.print(val2, BYTE);
Serial.print(val3, BYTE);
delay(100);
}

// ——— Processing Code

import processing.serial.*;

Serial port;  // Create object from Serial class
int[] serialInArray = new int[3]; // Where we’ll put what we receive
int serialCount = 0; // A count of how many bytes we receive
int p1, p2, p3; // Starting val for reading
boolean firstContact = false; // Whether we’ve receive from the port?
color bg;  // Define bg color for using it later

void setup() {
size(100, 100);  // set size windows size
noStroke(); // No border on the next thing drawn

// set initial values for p1 – p3
p1 = 0;
p2 = 0;
p3 = 0;

// Print a list of the serial ports, for debugging purposes:
println(Serial.list());

// get data from serial port
// Create a String with serial port name
String portName = Serial.list()[1];
// Create an new Serial Class
port = new Serial(this, portName, 9600);
//port = new Serial(this, Serial.list()[1], 9600);
//port.write(65); // Send a capital A to start the microcontroller
}

void draw()
{
fill(255);
// If no serial data has beeen received, send again until we get some.
// (in case you tend to start Processing before you start your
// external device):
if (firstContact == false) {
delay(300);
port.write(65);
}
} // end draw()

// serial event function
void serialEvent(Serial port) {
// if this is the first byte received,
// take note of that fact:
if (firstContact == false) {
firstContact = true;
}
// Add the latest byte from the serial port to array:
serialInArray[serialCount] = port.read();
serialCount++;

// If we have 3 bytes:
if (serialCount > 2 ) {
p1 = serialInArray[0];
p2 = serialInArray[1];
p3 = serialInArray[2];

// print the values (for debugging purposes only):
println(p1 + “\t” + p2 + “\t” + p3);

// Send a capital A to request new sensor readings:
//port.write(65);
// Reset serialCount:
serialCount = 0;

// set bg. using retrieved data
bg = color(p1, p2, p3);
background(bg);
}

} // end serialEvent()

Notes: Special thanks to this post that explains how to send multiple serial inputs from the arduino and capture them in Processing.

Multiple serial input from Arduino to Processing
http://www.prophecyboy.com/itp/icm/multiple-serial-input-from-arduino-to-processing/

You can follow any responses to this entry through the RSS feed. You can leave a response, or trackback from your own site.

Tagged

Leave a reply

Follow Us