Connect motion detector to data logger / computer

Aqil

Junior Member
Feb 17, 2012
5
0
0
Hi community!

I'm studying statistics and would like to automatically measure and record when everyone in the household goes to the bathroom over a long period of time. So I thought it should be simple enough putting up a motion detector and connect it to the computer or some little autonomous device. Apparently I thought wrong. I can't find any such product in it's entirety for a reasonable price (<$100). Having googled for hours without a simple solution, I registered to this board, hoping someone more knowledgeable can point out a simple solution to a non-tech-savvy noobie.

I can find small motion detectors on eBay for less than $3 which is all good. But I have no idea how to connect the green-plate-thingy to something that records the data for me. Can I do this without dwelling into computer science and taking an engineering 101 course? Or have I missed some other obvious solution? Shouldn't there be some product out there that can do this for me? Motion detectors connected to alarms, cameras and light switches are all over there.

Thank you for your time!

Sincerely
Aqil
 

piasabird

Lifer
Feb 6, 2002
17,168
60
91
We use to have a kind of security camera in our data room. It would take a picture of the empty room and whenever the the input to the camera would change it would update the picture. I dont know if it was the software that does this or the camera itself. The camera would only record when movement was detected.

I am just imagining how my toilet paper moves around every time the air duct starts blowing.
 
Last edited:

Aqil

Junior Member
Feb 17, 2012
5
0
0
I will definitely look into the webcam option. I actually have a crappy webcam lying around. My main concern though is that I want the data, not in image format, but in numerical format, preferably in a txt or excel file. This way I wont have to enter the data manually upon viewing the pictures, and I might not have to keep my computer on 24/7.

Thank you for your input!
 

mfenn

Elite Member
Jan 17, 2010
22,400
5
71
www.mfenn.com
This is a perfect task for LabView. It's somewhat expensive to buy for production use, but most universities have student versions available in their computer store. If not, you can buy a student it direct from NI for pretty cheap. Learning how to use it is also a great addition to your resume.
 

Knavish

Senior member
May 17, 2002
910
3
81
Do you really want to put a webcam in a bathroom??? You can do motion detection this way, but I think you'd get a bunch of objections.

Luckily, I have the perfect solution. About 10 years ago I had a very similar project: cheap, computer logged motion detection. http://x10.com makes a bunch of different motion detectors, security cameras, etc. At the time, I purchased some little battery powered IR motion sensors from them. They broadcast on some wireless frequency (definitely much lower tech than wifi, btw), and a serial port receiver logged the broadcast.

Back at the time x10.com ran all of these sketchy banner ads on places like weather.com hinting that you could build your own security system and/or secretly take pictures of somewhat undressed women, but the hardware did work pretty well given it's sub $100 price.

Here's an example of the detector I'm talking about: http://www.x10.com/home_security/ms10a_hps_motion_detectors.html?TWENTY11. It's a pyroelectric detector that senses when something warm moves in front of it. It's the same kind of thing some commercial offices use to automatically turn off lights when people are gone.

At the time they had a serial port interface with an antenna that would listen for these sensors -- you might find one if you look around their website. FWIW, X10 is some kind of home generic automation protocol, so there are probably other vendors sell that similar devices.

WARNING:
X10.com still looks like a lame website with all the pop-over junk. Make sure it's not a total scam operation before giving them your CC info. It does look they have forums, so I guess they are still legit...

Sorry for the messy reply, but I really think you can get your project done with this equipment.
 

kornphlake

Golden Member
Dec 30, 2003
1,567
9
81
This is a perfect task for LabView. It's somewhat expensive to buy for production use, but most universities have student versions available in their computer store. If not, you can buy a student it direct from NI for pretty cheap. Learning how to use it is also a great addition to your resume.

+1 for labview, any university with an engineering department should have labview in one of the student computer labs, there's a good chance an engineering student or TA may help you get the program written. You'll need some kind of data aquisition device, in my experience it's best to get the DAQ first then write the program. Years ago there were some fairly inexpensive DAQs, I believe one company made them available at no cost for educational projects. It may be cheaper and easier to use a PLC and an actual data logger. Either way it kind of turns into an engineering project.
 

Aqil

Junior Member
Feb 17, 2012
5
0
0
I've made little progress with this, so I wanna bump this thread to see if I can get some more suggestions.

I didn't manage to get the webcam to log movement. The only Linux compatible software able to do this lack user interference and must be reprogrammed. So I learned some python programming language, but soon realized that I would probably have to take a computer science degree to get anywhere. LabView seems like a good software but way too sophisticated for what I'm trying to do. I'm willing to learn it if I find a good cheap hardware to apply it on. Webcam can't be the best option. I have to get a long wire to get it to the bathroom door and I have to keep my computer running 24/7.

The type of data is really the simplest imaginable. If a rat in a cage presses a lever to get food, how does the researcher know that the rat pressed the lever? Really, this should be as simple as a light switch. Take a look at your fridge. It most likely has a little button/switch that turns the light off when the door is closed and the button is pressed in, but not otherwise. I just wanna disconnect the light from the switch and put an SD card there instead.

Consider modern cyclometers (bike computer). I can get one for $10. It uses a reed switch (using magnets) which easily could be placed on a door so that the display shows, in real time, how many times in a given time period, the door closes and opens. If I find a bike computer that can export the data, the problem is solved. Do you know of any?

I found a guy who can do a motion data logger with Arduino for $100. If I would do it for myself, the parts would cost me about $80 and days of labor, for a product that does less than the bike computer. The sensor Knavish suggests here, simply sets of an alarm (correct me if I'm wrong), and that is of no use to me.

I've got a somewhat good grasp of which sensors I can use now. But I could really need some advise on how to generate data from a simple switch and save it in .csv format on a SD card, pen drive or something similar.

Again, Thank You for your help!
 
Last edited:

mfenn

Elite Member
Jan 17, 2010
22,400
5
71
www.mfenn.com
Saving to a file on flash media requires a decent amount of processing power. I think that you've pretty much figured out your available options. What you want to do is pretty common, but still not common enough to be a commercial product (at least within your price range). Either learn how to program a little microcontroller or learn how to program LabView. Either would be a fun project that would enhance your skill set.
 

Aqil

Junior Member
Feb 17, 2012
5
0
0
T Yamamoto,
Yeah, that would be perfect. Does it exist outside of our dreams?

mfenn,
Very well, which microcontroller do I need and where can I find Microcontrollers for Dummies? I found microcontrollers for sale. What more do I need? Batteries? wires? Some other green plate thingy? Or is a microcontroller a standalone unit?
 

mfenn

Elite Member
Jan 17, 2010
22,400
5
71
www.mfenn.com
Well technically speaking, the microcontroller itself is just a chip, but you can buy a complete kit. Arduino boards are very popular have a pretty good software library with examples on how to read digital sensors (like your switch) and SD cards, etc. Check out arduino.cc for information about the boards and software and sparkfun.com as a place to buy the boards, sensors, etc.
 

Knavish

Senior member
May 17, 2002
910
3
81
Agil:
The x10 suggestion I provided (assuming hardware similar to what I used 10 years ago) will basically write a message to your serial port when the motion sensor triggers. You would need to write a simple program that would listen at the serial port and save a timestamp when it sees the sensor message.

Since you're not a programmer type, you should investigate data loggers. I've used temperature loggers from Onset Computing. They also have something called a "Time of Use Data Logger". I've never used this type of logger, but they do list "State Open/Closed" as an example of recordable information. They may even give you advice for how to attach a switch to one of these.
http://www.onsetcomp.com/products/data-loggers/time-of-use

If this logger works anything like their temperature logger, you just plug it into a computer (USB) and can export the data as CSV.

[Edit: they have exactly what you're looking for]
I scrolled further down on the page and found this:
HOBO UX90 Room Occupancy/Light Logger - UX90-005
http://www.onsetcomp.com/products/data-loggers/ux90-005
Unfortunately it's $199.
Maybe their $79 on/off light data logger would work for you as well. I suppose either of these would require you to correlate light level with someone being in the bathroom.
 
Last edited:

Aqil

Junior Member
Feb 17, 2012
5
0
0
mfenn & Knavish,

I will look into all of this. Thank you both for sharing your knowledge!