Wednesday, 12 March 2014

Processing the Serial Values

Once I got the values from my serial port to print out in processing's console. I started getting to work on some kind of output.
Since processing is primarily designed for creating graphics and visuals, so that's where I started.

To do this I once again used Processing's serial library functionality, to have it call in serial values being passed to the computer from the Arduino. With processing I was then able to give the serial values a variable called brightness, which will be changed by the values given from the Arduino.
By setting a background image in Processing using the RGB colour values, I have been able to control the intensity of the colour's value. This value is determined by the value being imported from the serial port, or in this case the capacitance from one of the plates.
Once the graphical window was defined with colours set to 100 for red, 0 for green and the variable "brightness" for blue.

Once the serial port is called in processing it is possible to manipulate what's on screen through the values it is reading.


As you can see this sketch is not that different from the original sketch used to print the values into Processing's console. 
All that has been changed is the variable given to the serial data, and what Processing needs to do with it.
First processing reads the values and buffers with a value until it detects a new line being given from the serial port.
Then all it does is look for a seralEvent, to which I have told Processing to read the string until a new line is made. (Or continuous serial values).

An example can be seen here.

Tuesday, 11 March 2014

Multiple Sensors

I want my device to work basedon three planes of movement. The X,Y and Z. I also want to take the values that are being output by my Arduino and read them independantly in processing. For this to work I need to create a modified version of the capacitive seonsor to allow for multiple input.

After purchasing a small breadboard, it has become much easier for me to test and experiment with my project, by allowing me to hook up more plates and use less wire, and completely remove the need for soldering.



The sketch works exactly the same when hooked up to two sensors. The input is received from pins 2 and 6, with pin 4 being the grounded pin, to which capacitance is measured against.


Currently the values that are read without touching the plate, peak at around 60. I want to increase these values for later use and to do so only requires a higher value resistor.I currently have 220K resistors fitted to the Arduino, I am looking at increasing these to approximately between 440 to 510K resistors.

Sunday, 9 March 2014

Importing serial values into Processing.

Now that I have actual output from my Arduino, Its time to start attempting to import these values into processing.
The first step is using processing's built in serial library. I made the mistake of attempting to find this online from various sources, before a forum post revealed it to be intergrated as part of the software. I simply updated my version of processing (for some reason I was using 1.5) to version 2 and imported processing.serial.*; Which tells it to include all files it has for importing serial data.

All that needed to be done in the processing sketch then was telling it to take the values it's reading from the serial port, and print them in the console.

I believe that now that I have these values importing into processing, it wont be long before I can do something with them.

This is the example sketch that reads then writes the serial values into the console.

A closer look at the processing console, showing values increase and decrease based on users hand movement.

Thanks go to https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing/to-processing for the tutorial on importing serial values to processing.