3-D input device

I mentioned this 3-D capacitive input interface for Arduino (on Instructables.com) in class yesterday. It’s basically one corner of a cube with the 3 sides covered with aluminum foil, attached to the Arduino using shielded cable and a couple of resistors. It claims to report the distance of your hand from each of the three faces of the hemi-cube, so you can those as x, y, z coordinates to control… anything! One idea that springs to mind is setting the R/G/B values for your mood lighting. If it’s accurate enough, you could also try to hack it into your favorite cad program (you *are* already using VR goggles for that, right?)

Arduino + Processing

Some times you might want to Arduino talk to your computer in order to do things that your Arduino can’t do on it’s own, send emails, vision recognition etc.

example 1:
Control your arduino board directly from processing, read anlogue values change anolgue outputs etc.
: http://www.arduino.cc/playground/Interfacing/Processing

example 2 :
Have Arduino talk to processing.
here: http://arduino.cc/en/Tutorial/Graph

Arduino Programming examples

First example of having Arduino store a number of button presses.


* Button
* by Greg Saul
* Incriments a counter by one each time a button on 7 is pressed.

int ledPin = 13;                // choose the pin for the LED
int inputPin = 7;               // choose the input pin (for a pushbutton)
int val = 0;                    // variable for reading the pin status
int counter = 0;                // store the number of button presses
boolean buttonDown = false;     // a flag that stores if the button is beeing pressed down or not
boolean isLightOn = false;      // a flag that stores if the led is on or off

void setup() {
pinMode(ledPin, OUTPUT);      // declare LED as output
pinMode(inputPin, INPUT);     // declare pushbutton as input
digitalWrite(ledPin, LOW);    // turn LED OFF
Serial.begin(9600);            // opens serial port, sets data rate to 9600 bps


void loop(){
val = digitalRead(inputPin);  // read input value

// check if we have just pressed the button down, and if we have incriment the counter
//  by one and set the button down flag to on
if (val == HIGH && buttonDown == false) {      // check if the input is HIGH and the button is not already been held down
buttonDown = true;           // set the button flag to down
counter = counter +1;        // add one to the counter
Serial.println(counter);     //send the current counter value to the computer

//if we are no longer pressing the button down set the buttonDown flag to up
if (val == LOW){
buttonDown = false;  // set the buttonDown value to up

// if we pressed the button 10 or more times toggle the led.
if(counter >= 10){
toggleLight(); // turn led off and on
counter = 0;


// Toggle the led on and off.
void toggleLight(){

// if the led is already on turn it off and rember that it's off.
isLightOn = !isLightOn;  // swap the isLightOn on if it's off and off it's on


Second example of having arduino read a analogue input and drive a analogue output


* AnalogInput AnalogOutput
* by Greg Saul
* Reads a brightness value from the photo resistor on pin 3
* and tranlates it to a brightness value of a led on pin 11.

int LDRPin = 3;    // select the input pin for the LDR (photoCell)
int ledPin = 11;   // select the pin for the LED, will need to be a PWM pin
int val = 0;       // variable to store the value coming from the sensor

void setup() {
pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT
Serial.begin(9600);       // start comunication with the computer

void loop() {
val = analogRead(LDRPin);    // read the value from the sensor range 0 – 1024
//Serial.println(val);       // Send val to the pc, can be seen using Serial Monitor
analogWrite(ledPin, val/4);  // write val to the PWM output analogWrite values from 0 to 255


Sorry for the ugly post I will try and get the <code> tags working on wordpress or the ability to upload .pde’s

Let me know if anyone has any questions about the code.

Cute but also useful

I’m sure a lot of people have seen the cute little dancing robot Keepon;
He even stars in music video’s

The other thing that many people don’t know is that Keepon was developed to study the mechanisms of social communication of children and to help children developmental disorders such as autism to understand emotive actions.

Keepon on Wikipedia here

pdf on how Keepon helps children with autism here