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.

Friday, 28 February 2014

Working Sensor

After a lot of delay I have finally managed to get an output reading for my capacitive sensor working. For some reason I was not able to get any kind of output  from the way I had previously built the prototype. I dont know if it was due to how I had laid the pins out or what I had given the Arduino, but for some reason or other It just wouldnt work.

I am now very glad to say however that I have now got numerical output from my Arduino, and the readings are coming in the form of numbers from the sensor pin. These numerical values are printed in the Arduino's serial monitor and as I move my hand closer and further away the numbers increase of decrease accordingly.


The readings output to the Arduino's serial monitor, which increase or decrease depending on the distance from the plate. Currently the readings spike at around 300 when the plate is touched, but still increase and decrease without touch. The values may be low but at least I'm getting values. To increase the distance the sensor picks up the user can be increased by using a higher value resistor. I'm thinking about using a 440K resistor since it will give me a higher reading without overloading the serial port.


Thursday, 20 February 2014

Capacitive Sensor

The Arduino can be used for a multitude of projects. Designed to make it easier for those who are not experts in electronics, the chance to get creative with some electronic prototyping. This is one of the main reasons I felt it would be an ideal tool to use for my major project.

To begin detecting the human body's capacitance, Arduino has a clever library than can be downloaded which turns any pin declared in the sketch into a sensor. For this to work the Arduino must be able to find the libraries one they are installed. As far as I can tell, as long as the file is somewhere on the computer it can find it. But to be sure I have created a libraries folder in myDocuments that the Arduino will use to find all its files. Once done I will compress these files into one folder which also contains my sketch.

Basic example of capacitive sensing sketch. Imports the .h file which calls the function of the .cpp file.
This sketch is set up to read the values passing between pins 2 and 4.

Contained within the libraries folder is a .h and .cpp files, or header and source respectively. These files tell the arduino what to do with the information I give it, in this case, which pins are being used and what serial port to send the values over.

http://playground.arduino.cc/Main/CapacitiveSensor?from=Main.CapSense

Wednesday, 15 January 2014

Processing

For my project, not only do I need to learn how to use an Arduino, but I also need to learn how to communicate with it. The best and easiest method I have found of doing this is by using a programming language called "Processing". What's interesting about Processing and what makes it suitable for communicating with my Arduino, is that the IDE used for the Arduino, is based on the one used in processing, thus making the languages work in a similar way. It also allows for an easier method of communicating with the Arduino, since processing has the ability to read inputs via the serial port on the computer.

Processing also suits the open source style of my project. The software is freely available and has a large online community who are always updating and improving the softwares functionality. Examples of this come in the form of import libraries, of which processing has over 100, that can help give projects that extra interaction or output.


The processing IDE. As you can see it is very similar to the environment used for the Arduino.


Tuesday, 7 January 2014

The Work Continues

With Semester 1 over and VIVA 1 behind me, it's time to start working on the production of my major project.
A previous post has already discussed the materials I needed to get my project working. Now that I have most of these materials and a prototype built. I will now start work on producing a working model.
The first step is to  upload a sketch to my Arduino that will allow me to interact through capacitance.

The main aim of this work is to have my Arduino detect the human body and measure its capacitance. I'll achieve this by using the Arduino's Capacitive Sensing library. Which turns one or more of the Arduino's pins into a sensor. I will be primarily using the digital pins on the Arduino though it is also possible through analogue pins. I will then attempt to take the values measured by the Arduino and import them into processing.
Once the values are in processing I need to turn them into sound. Though processing is primarily used to create visuals there are a few methods in which it can be used for audio output. I will post the results of my research into this further in the blog.