New gadget: wireless sensor station

August 08, 2016

new-gadget-wireless-sensor-station  Facebook  Twitter  Google +  

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 popular entries

VR Experiences #1: Oculus Rift

The 80's childs are familiar with virtual reality term. we seen this subject in the action at johnny mnemonic, the lawnmowerman etc.if you're not living in a cave, probably should know the


Stealing sneakers from NIKE

as the whole crafty geeks knows, nike has a rvsp system via twitter. they


Bytecheleby at revision

Looks like our portable shell "Bytecheleby" still useful on scene. im started to enhance it by using my newest libraries and lots of new stuff. stay connected for latest releases


Pain and Suffer inside: Displaylink Adapter

as mentioned on my recent tweets, was looking for a low cost multi-display solution about couple weeks. gaming oriented gfx cards already


Entering system level command line

I get this trick from a sysadmin friend. it allows to enter system level shell access in Windows Vista and later versions. useful for bypass UAC and ntfs file permission issues.sc create SuperC