Okay, so I'm new with Arduino, but I have to use it for my end project for school. For the product I want to make, I have to use an accelerometer to register the sleeping pattern of a child. To register this, I'm using the Wii Nunchuck as an accelerometer. Problem is that I want my prototype to react to the sleeping pattern, for example, a light goes on when the child is moving a lot (so is awake). To do this it's necessary to find a formula to go from the three values to one, but I don't have a clue what this formula could be. I've been searching for a month now and I can't find anything.
Do you have some advice for me?
Thing is, my teacher told me that it wasn't as simple as that, but I don't have a clue, actually.
Thing is, my teacher told me that it wasn’t as simple as that, but I don’t have a clue, actually.
That depends on what you are trying to accomplish. The output of the accelerometer is the acceleration along three axes. For your purpose, all you seem to be concerned about is whether there is motion, or not.
Square root of x squared plus y squared plus z squared?
Funny I was putting together the same project around the same time. I just finished it late last week and have used it a couple of times. I have an Adafruit data logger shield and just save the nunchuck data every 200ms, which results in about 5Mb of data through the night. Then I remove the SD card from the shield in the morning and load it into Excel and do my data manipulation and plotting there. If you need to run the analysis live on the Arduino, the root of the squares that AWOL suggested sounds fine.
It works pretty well, although last night my son ripped out the wires from the breadboard while he was thrashing around in the middle of the night. I'd love to figure out how to get my wireless nunchucks to work as that would solve that problem. I was also hoping to collect some microphone (sound level) data concurrently, but that is also proving to be more complicated than I had anticipated.