Blue Team – Progress Report II for Prototype I: Smart Cushion

Goals for the week:

  • Interface a button to the arduino. Turn serial data on/off
  • Hook up two potentiometers and get the values printing to the serial port.
  • Get Processing to output the data coming in from the serial port:
    • sensor 1: XXX  sensor 2:YYY

Meeting times/dates

Sunday 11am-3pm

Individual Hours:

.5 hours: All group members individually introduced themselves to the Arduino micro-controller before the meeting.

What we did:

Got arduino interfaced with computer. Completed a program that can read data from 2 or more potentiometers (or other analog voltage sources) and outputs this data via serial. We also wrote a program in processing to interpret this data and store it in appropriate variables.

What we didn’t do:

We need to just continue working with processing to see what else we can do with the data. Maybe check into libraries for making graphs with our data. Also, still need to make a shared dropbox folder or something for easy access to our existing code.

Where we are stuck:

Waiting for parts to come in. This mainly inclu

 

des the cushion and sensors. Once these come in we should be able to make significant progress on the hardware portion. ETA: Sometime this week.

There could be improvements we could make in our serial protocol implementation.

There are some concerns about how reading the serial data in processing actually works and whether we will “get behind” in reading data from the arduino with our current implementation. Check to see if there is a more ideal implementation of reading and manipulating serial data in processing. We should see if John or Tom have input on this, or we can post to the Arduino/Processing forums.

Notes/Misc:

WorkingProgram.pde

01
Travis Whitty
February 26th, 2013 4:21 pm

This is the processing code we used to read in the potentiometer and then turn the data we got into a number. I apologize if it isn’t too understandable from there, I had to try to spread it out from opening it on notepad on this computer.

import processing.serial.*;

Serial myPort;
int ArdVar;

String ProcVar;

int pot1 = 0;

void setup (){

myPort = new Serial(this, “/dev/ttyACM0″, 9600);

}

void draw(){

//println(ArdVar);

ArdVar = myPort.read();

// println(ArdVar);

if (ArdVar == ‘['){

println(ArdVar);
delay(500);

ProcVar = myPort.readStringUntil(']‘);

// println(ProcVar);

if (ProcVar != null){

String[] buffer = splitTokens(ProcVar, “:]”);

int i = int(buffer[1]);

//i = i + 50;

println(buffer[0]);

println(i);

}

}

}

02
February 26th, 2013 4:22 pm

Cool! It actually works best to add these sorts of things as attachments as opposed to cutting/pasting the content in the body of the post. By cutting/pasting you loose formatting, for example. It make code hard to read. These files attach fine.

03
Travis Whitty
February 26th, 2013 5:27 pm

Alright, I’ll attach the program into our original post here!

Leave Your Comment

Name*
Mail*
Website
Comment