Tuesday, February 25, 2014

A Bit of Details on My Project

As of right now, I'm waiting for my gyroscope to come in as it's part of the next step of my project. I have (for the most part) figured out how to work the accelerometer, and that's why I feel like I can move onto including a gyroscope as well (see previous post for more on my accelerometer progress).


However, as I'm waiting for the gyroscope to ship in, I've found a video that resembles the basic structure of how I want my project to turn out. It's a video called Arduino Multisensor, and it's of a bunch of sensors attached to an Arduino uno on a large breadboard.


The video shows a device similar to my idea as it has multiple sensors in one device that can change and output readings according to the different circumstances. However, differently, I'd like the readings of the data to show up on the user's mobile device and show all the readings at once instead of one at a time (but there may be an option setting for otherwise).
I probably won't use the barometer or compass, but most definitely the gyroscope, accelerometer, and thermometer with others to later be determined. Moreover, as the sensors in the video are spaced out onto a breadboard, I'd hope to make mine more compact as it'll be attached to a child.

This post's purpose is to give you more of an idea of what I'm trying to do, instead of an update of what I'm actually doing at the moment. As soon as my gyroscope comes in, I'll post more on updates!

Friday, February 21, 2014

More on Accelerometer!

I was able to figure out how to make the Arduino blink according to movement of the accelerometer!

From reading the helpful information on StackOverflow, I read that positive values indicate increased velocity and negative values indicate decreased velocity; while zero indicates constant velocity. With that said, I concluded that the positive and negative values will be when the baby breathes in and out. Whereas, on the other hand, zero would indicate that the baby has stopped breathing. And so, at the moment, I have the accelerometer have pin13 turn off when the values are not zero and turn on when it is zero. Later, I might make it more sensitive and have a warning for when the breathing of the baby slows.

In the last loop of the code I got from the guide, I added an if/else statement at the end. Also, outside the void setup placed earlier in the code, I had to write:
int led = 13
Inside the void setup, I wrote:
pinMode(led, OUTPUT).

Code:

void loop(void) 
{
  /* Get a new sensor event */ 
  sensors_event_t event; 
  accel.getEvent(&event);
 
  /* Display the results (acceleration is measured in m/s^2) */
  Serial.print("X: "); Serial.print(event.acceleration.x); Serial.print("  ");
  Serial.print("Y: "); Serial.print(event.acceleration.y); Serial.print("  ");
  Serial.print("Z: "); Serial.print(event.acceleration.z); Serial.print("  ");
  Serial.println("m/s^2 ");
  delay(500);

  if (event.acceleration.y != 0 && event.acceleration.z != 0)
    {     
       digitalWrite(led,HIGH);
      
    }  
  else if (event.acceleration.y == 0 && event.acceleration.z == 0)
    {
       digitalWrite(led, LOW);
    }
}  
Very simple, and it has worked for me. I didn't include "x" into the condition because I remember reading somewhere that x will always have same orientation and thus be of trouble in other calculations, or... something like that.

Planning on also ordering a gyroscope, which will help orientation reading. Another device to learn, haha.

Next step:

  • How to work a gyroscope!

Thursday, February 13, 2014

Check Your Wiring!

Earlier, I wrote about how I couldn't get my Arduino to communicate with the accelerometer. However, I was able to get it working! Yay.

Well, once I got the serial port issue fixed, the Arduino IDE started giving me errors like "not in sync" and whatnot, which got me on a whole other level of frustration! Turns out though, that the problem was a whole lot simpler than I made it out to be. In the end, it was because I wired the Arduino and accelerometer incorrectly... I accidentally switched the wires for SDA and SCL *awkward laugh. Now, everything works just fine!

So at the moment, I'm just trying to figure out how to read the data output from the accelerometer. I've found a few helpful insights and links from a forum on StackOverflow (which is pretty neat, since Ms. Chipps and I used to do our work together in the Stack Exchange NYC building. Now, we work at the FlatIron School's NYC building. It's a really cool place!).

As I'm figuring out the accelerometer, I'm adding some code to the one I got from the guide, and trying to make the LED pin 13 on the Arduino Uno blink every time the board senses movement. At the moment, I'm just using simple if-statements to do this, with some help of an official Arduino tutorial as I'm a bit new to the Arduino language/syntax. However, a problem I'm facing with this task is that once the accelerometer senses movement and blinks, it doesn't stop blinking and change according to movement again. It gets stuck!

And I'll leave with that, as I don't have sufficient if-statements for this part yet. To be continued!

Friday, February 7, 2014

Challenges

The main purpose of this blog is to document my Intel experiment experiences. And with that said, I can say that I've begun to start on it with my mentor, Ms. Chipps. It's really exciting to start working on my plans for a mobile device that can detect a baby's vitals!

So far, we've ordered an Adafruit accelerometer ADXL345, chosen for its low cost and good reputation. The first steps is to see if it's efficiently sensitive enough to be responsible for detecting a baby's breathing movements (as the accelerometer detects movement).

Accelerometers are good for sensing the presence of motion, or even the orientation of the object it's attached to. This can be useful in detecting vital signs of an infant as the accelerometer can be used to detect breathing movements or what position the infant is lying. For instance, SIDs is a major cause of deaths in babies; characterized by a lack of oxygen and commonly cause for warning not to have the child lying on their stomach. Thus, bringing reason to including an accelerometer into the device being created.

Currently, I'm using an Arduino Uno with the ADXL345, and am following a guide to wire and copied the code from the guide.

my Arduino Uno connected to the accelerometer
Materials (so far):
  • Arduino (using Arduino Uno)
  • Laptop/Computer
  • Accelerometer (using ADXL345 from Adafruit)
  • Wires
  • Bread board

First objectives:
  • How to work the ADXL345 and find how sensitive it is
  • How to read the ADXL345 data
Quite simple sounding objectives, but turned out to be quite the challenge!

One problem... I can't even get the program to upload to the accelerometer!! Using Windows Vista, on the Arduino IDE with the correct drivers and everything, I keep getting errors like "serial port 'COM6' already in use" or "serial port 'COM6' not found". I can't even get the simple basic "blink" program to work for pin13 on the board. ...it was working on my laptop before I started using the ADXL345 though.

New to programming, I can see that this hobby takes a lot of patience and persistence because troubleshooting is really quite frustrating!

Seeing Ms. Chipps today, however. Hopefully, with two minds, a solution will be found.

It's a small bump in the road, and I'll continue to post as we work on it!

Next steps:
  • How to connect the ADXL345 to a mobile device