How hard would this be for a starter?

Hello everybody,
I want to build some sort of hardware that tracks movements, and keeps a log of the movements variations over time, so I can build a chart or stuff.
I’m a complete newbie when it comes to hardware, but I read an article about arduino some time ago and I thought it would be a good start.
I will probably have to attach an accelerometer to the board, and quantify the accelerometers output (I dont need to know direction, just amount of movement).
So, how hard would this be for a starter? Am I in the right path? I have no knowledge at all with hardware or electronics.

Thanks for your time.

Can you give a few more details. Are you tracking inches or miles? Can you connect a sensor to a wheel or an encoder to get data on movement? Or is it a GPS application?

I want to track sleep movements for research. So the piece of hardware would stay somewhere in the bed, and keep tracking and logging the body movements. Thats why I dont need direction of movement. All I need is to know is if there is movement, and how much movement (subject in deep sleep or rolling in bed, etc).

why are you considering arduino for it?
i’d rather use a webcam? ( This dependends on what you want to do )

As I said, I have no knowledge in hardware at all.. I just thought I would have to use an accelerometer to get the movements, and I would have to attach it to something to process the information, and then arduino came to my mind. I'm not really sure why I choose arduino, I just read something about it here and there, and it just seems fit. I'm not sure if a webcam would be of use, if the movement is too small it would not be caught, and I would also have to concern about enviroment light, etc. My idea is to have arduino plus the accelerometer sitting in bed as the subject sleeps, and then connect it to a pc to collect the data. Is there something wrong? Is this not how arduino is supposed to work?

Think you need a pressure sensor as big as a bed ...?

The Arduino has input and output pins that would take could take sensor data and keep track of it for you. I think the question is...what kind of sensor would be best for your application. The web camera seems like it might have possibilities. Maybe a motion detector.

Are you wanting to keep track of the distance moved or the duration of time that the person is moving?

I don't know how difficult this project would be, as I am an Arduino newbie myself. You can read sensors easily with an Arduino, but I don't know how you would log it. I'm sure there is a way.

As for the whether using an Arduino is the best approach, I know (from a friend) that there is an app on the iPhone that measures your sleep pattern - and shows you how much time you spent in REM, deep sleep, etc. It uses the iPhone's built in accelerometer to record this information, so it is possible.

If you wanted to do this using a video camera, you could illuminate the subject using infra-red LEDs, which won't disturb the subject.

Noddy Nodbox: I'm trying to do something like that, that's why I thought of the accelerometer. I have a Motorola Droid, but the same application dont work because when the screen turns off, the sensor data stops been broadcast, so the application dont work properly. This does not happen with all android phones tho. Then I just thought about building one myself. Thanks for the tip about IR Leds.

I'm not sure what kind of sensor would fit best, since I has to be precise (if possible, be able to catch breathing).

(if possible, be able to catch breathing).

:o thatz a lot dude ;) i have an idea though it may be a little ( i guess lot ) hard you could build a grid of pressure sensors underneath the bed

A grid of pressure sensors would really be too much for me. Also because I’m thinking of something simple, just a gadget that I can take with me.
Is there a way to save these logs? Is it possible with just arduino, or I would need another peripheral?

You won’t be able to use Arduino to store the logs; it just doesn’t have enough capacity for something of this size.

You would need to interface it with a computer, perhaps a small laptop. You would then need it to communicate with that computer, possibly via Processing (http://processing.org/) which is a relative of Arduino. There are libraries for Arduino <-> Processing which will allow the two to communicate, but you are looking at extra work here. Processing will be able to write your data to a file which you can manually work on - or you can use Processing to represent this data in charts, etc.

So basically, you’ll be aquiring the raw data via Arduino and pushing it into Processing, where it gets more complicated depending on how much work you want the software to do. Thankfully Processing is not that hard to program, actually I think its easier to program in Processing than in Arduino.

Unless someone else has an idea…

Actually you could probably use Arduino to store the logs, if you add some external memory to it. But from here it becomes guesswork for me. My money is on Processing, especially since you can visualise the data more readily.

A grid of pressure sensors would really be too much for me. Also because I’m thinking of something simple, just a gadget that I can take with me.

Is there a way to save these logs? Is it possible with just arduino, or I would need another peripheral?

If you wanted to detect random movement, and you wanted it simple and cheap, you could do a “pin-in-spring” detector sensor: Take a piece of small gauge bare wire, and wind a small coil, and put a small drop of solder on the end. Solder the other end to your PCB. In the center (soldered to the PCB as well) put another thicker gauge bare wire, that extends to the end of the coil.

At rest, the coil shouldn’t touch the center wire, but when shaken a bit, the mass of the solder will cause the coil to shift and make contact with the center wire. Hook the two contacts (from the coil and the center wire) up to the Arduino via one of the pins which can detect an interrupt, and in your interrupt handler, set a variable to a non-zero value.

In the rest of your code (in a loop, most likely), have a counter or timer running; when the interrupt occurs, store the value of the timer/counter in the EEPROM memory, or better, to an SD card. Alternatively, you could dump it out the serial port and log it on a nearby PC.

If you stick with just the EEPROM or SD card (or micro SD and a Lilypad?), you could make the device really portable. You could do the same thing with an accelerometer, but it won’t be as cheap, nor as easy to interface with.

If you did want to go the accelerometer route, though, you could probably make a nice “stack” of Lilypad boards; the Lilypad, then the accelerometer, then a micro SD interface…

:slight_smile:

Is there a way to save these logs? Is it possible with just arduino, or I would need another peripheral?

You would need a RTC (realtime clokc) and SD card for data logging shield plug on top of the Arduino..

http://www.adafruit.com/index.php?main_page=product_info&cPath=17_21&products_id=243

You can retrieve the data from the SD card and plot the graph somewhere else..

I wrote a beginner blog by beginners and I've an entries talking about different sensors ( too many of them ... ) ... just click on the WWW below..

Noddy:
I like the external memory idea. Its small, and there’s no need to keep a computer around. I’m trying to build just a gadget, not to prepare a room in my house to research my sleep, so I’m not going to keep computers turned on or having complicated sensor schemes around. I want to be able to carry it around.

cr0sh:
What do you mean by “stack of Lilypad”? I’m going to need more than one board?

Stanley:
Thanks for the tip on the clock. Nice blog also, I will read it later.

I am thinking get a motion sensor like for an outside yard light. Then wire your Arduino to the LED on that light. Set the timer for shortest duration and program the arduino to log how many movements per night. That is what you want, right? To make like a scatterplot of movement 'hits' over time?