New gadget: wireless sensor station

August 08, 2016

new-gadget-wireless-sensor-station  Facebook  Twitter  Google +  
  vidposter.jpg

 After the spending months to commercial projects, taken few days of break and created a new sensor node for home network. it's supposed to be a weekend project but i have to put rest of the new week to make it completely functional.

 
 One month ago i mentioned about purchased 2x pair of raspberry pi from an used goods store. still using first one as headless torrent client and repurposed second one as a sensor station at these days. sounds like overkill for such a simple task but reliability is the key while developing a security gadget. consistent readers possibly know, i was created it's arduino+ethernet version at past year but didn't mention about ruined nights which caused by false alarms.
 
 Preparing parts
 There is not too much thing to highlight, it's exactly same setup which mentioned in this entry got raspi with wifi dongle in this setup instead arduino. implemented mq5 gas sensor to both of them as an extra. my though was reading analog inputs by using MCP3008 adc converter but that caused a file descriptor leak which is very common in popular linux distributions. so i got laying around multiwii flight controller from a crashed quadcopter, i attached sensors to it and fetched data by using serial port. that took my 30 minutes instead spending hours maybe days to research what caused the memory leak in previous attempt.
 

 Software setup
 It's powered by node.js like other pair of pi and uses same libraries which i developed for torrent client project. raspberry's primary functionality is video transmission in that case. it's own video capturing tool raspivid can record high quality videos by utilizing the onboard h264 hardware. that's why ffmpeg and similar solutions stuck in 320x240.

 After more research found a guy's blog who forked the raspivid's source and implemented a live streaming feature which is exactly what i need. installed it for future use but recording is okay for now, i created a quick script to record 24hrs of video separated by hours and delete them everyday. another script creates a web daemon in a spesific port and captures photos and handles basic commands such as shutdown & restart etc.
 third script fetches data from arduino (multiwii) and pushes them to home automation server. sources are available in rest of entry.
 
 Functionality
 I planted it to living room which sees the balcony directly, now it's non-stop recording hd video, measuring temperature, light level and lpg & co2 gas levels and detects the human movements. as mentioned in first lines on entry, previous arduino based sensor was waking me up with false alarms. now using this device's data as cross-validator for incoming data. for example, if gas levels higher than 500 and other device's level is close to 500, my automation software (judith) launching the gas alarm.

 Same method applies to pir sensor, if you need to go living room, you have to pass from hallway first and hallway also got a pir sensor, machine records this activity and does nothing if movement detected in this order. if suddenly an activity detected in living room, that means someone break in from window or balcony, that's a reason to launch a fully audible alarm. as mentioned before, nobody going to break into my house and steal something but increasing the security perimeter increases the safety feeling and you don't have to worry tick or noises on middle of the night. commercial pir sensor sets provides same functionality but you have to arm them before goto bed, disarm before wake up for pee, arm again before sleep. almost no logic in there and completely depends on human commands.


 by the way temperature was approx 35 C while i recording the video, noticed the pir sensors cannot detect humans with higher temperatures, i was literally sweating and both of sensors didn't see me. validated that by approching to building's automated hallway lights. same condition applies while wearing raincoat. so we can say pir sensors not too reliable in that case. alternative hardware might be a doppler radar (the sensors which installed on automated glass doors on the public malls) but they're expensive and view distance is very limited.
 

 Cost
 Already got all components in my trash dump, so cost is almost free to me. component list follows:
 - Raspberry pi model B with official 8mp camera
 - 1x mq5 lpg gas sensor
 - DS18B20 temperature sensor
 - 1x light dependent resistor
 - multiwii flight controller as equivalent to arduino nano
 - 12v to 5v/1.2amps step-down converter (was sony phone's official car charger)
 - audio amplifier which salvaged from broken beats headphones
 - 1x speaker which salvaged from a dead notebook
 - TP-Link TL-WN722n wifi dongle
 - 1x voltage divider module
 
 plus spent exact 7 days to development but that's absolutely worth it. if interested, complete project sources available in this github repository.
 
 watch on youtube if having troubles with flash

  Most Watched

Fail of week: WS2811 VU-Meter

after the few commercial projects, i got some "me-time" at last. i sold all of my geek toys and some trash on ebay except few 3 Year, 2 Month ago


Strange signals on radio ocean

2012 was SDR year. some guys (Antti Palosaari ...

Project Judith - First hardware connection tests

trying to make a connection between my virtual assistant "Judith" and a PIC16F84 based 8-bit relay interface. first step to pc b...

New gadget on desktop: Air Quality Sensor

past year i was working with a material named ...

Lets search a file: the psy way

once upon a time, google was have a desktop search solution for win32 based systems. i can't remember maybe at 2007~2008. it was...