My IoT Projects
InitiadsStuff that I made
Automatic Web Logon
If you live in a place where the local internet provider insists on showing you a web login screen every time you want to surf the internet, then you are in a fix because your IoT devices might experience outage every 24 hours because they may not be smart enough to login through the web to start another active web session. If you possess a router that can be flashed with OpenWRT, you can make sure that your smart TV always has access to the internet without any need to use your phone or computer's browser to log in. There are two ways to go about this:
- Use an OpenWRT/DD-WRT capable router and use wget as a cron job and start up task configured on it. Here is how to do this: My Blog Post
- Use a smarter bash script configured as a cron job on your OpenWRT/DD-WRT capable router. The script will ping www.google.com every few minutes and if the ping fails, it will try to log in. Here is how to do this: My Blog Post
PS: Now days there is a better way to go about this: Install and configure WiFi Web Login android app on all smart phones owned by every member in your house. Even if one of the residents of your home is in the house, the app will automatically make sure to login again to re-activate the session whenever it expires.
This one of my first IoT projects. It involved using a TL-MR3020 Router (flashed with OpenWRT), Power adapter (shell removed) and Sparkfun Weather Board. I mounted them all in two lunch box (thermal Isolation) and installed them in my balcony. The weather station has been actively running since December 2013. The data it captures (Temperature Humidity, Atmospheric Pressure and Light) gets uploaded to io.adafruit.com once every minute. There have been a few glitches that I had to solve over the months, most of them were related to communications between my router and the weather station, but I solved them over time. Initially, I used Xively as the data broker, when they shut down the personal version of their service, I moved to InitialState which proved to be too expensive (USD 300 per year) and finally, now I use io.adafruit.com
- Build process and improvements: My Blog Post (This still mentions Xively)
- My weather station's feed URL is: https://io.adafruit.com/lithiumhead/dashboards/anurag-and-divya-home
- What I learnt about my environment by operating this (and other) device(s) over the past few years: Personal Analytics
PS: A much cheaper and Simpler war to do this now days is to use: SparkFun Photon Weather Shield + Particle Photon (using InitialState)
PPS: I have yet to post a blog on how to interface with io.adafruit.com instead.
I used to have a buggy 4G LTE router (a ZTE MF29 used with Airtel 4G here in Pune, India) which used to hang around thrice a week causing loss of connectivity until it was rebooted manually by toggling the power button on its back. So I rigged up a Raspberry Pi along with PiFace Digital to continuously check the connectivity (ping google.com) and if there was a disruption, it would toggle a relay to power cycle the router. I did this through a bash script configured as a cron job that ran every 5 minutes to check for connectivity and take action accordingly.
- Build process is outlined here: My Blog Post
In many countries, certain websites are blocked. Elsewhere certain content is blocked depending on the region from where you are trying to access the content. One way to overcome this hurdle is to use VPN (Virtual Private Networking). VPN requires you to pay a monthly subscription fee. Such services (e.g. ExpressVPN) provide apps for Windows PC, Android, iOS etc.These apps allow you to enable VPN only on one device at a time. If you have an OpenWrt capable router, you can install OpenVPN on it and grant open access to all your devices over WiFi
- Blog post outlining how to do that
I wanted to measure how much electricity I was consuming and so I went ahead and installed a Modbus capable energy meter (Selec MFM393C) in my breaker panel. A TPlink TL-MR3040 running OpenWrt uploads data points to InitialState.com using HTTPS. A bash script configured as a cron job along with a native executable does the trick:
- A series of 4 blog posts that outlines
- how to install the energy meter
- install latest OpenWrt on MR3020 or MR3040 router with rootfs on external flash drive
- how to cross-compile a native executable for it
- and finally how to put it all together .... is here
- The project was featured on Hackaday and initialstate.com/learn
I used xively.com as my data broker when I first implemented this project. I have recently switched to a paid account at initialstate.com because it has a better feature-rich GUI.I now use io.adafruit.com which is pocket-friendly for hobbyists.
- Portable version: A portable version of similar setup was also created and mounted inside a suitcase. It used a 3G WiFi Dongle (Huawei WiFi Dongle E8231s-1) with a Vodafone prepaid SIM Card and a Dragino MS14P instead of TL-MR3040. Also, in this case, I used a different make of the Modbus enabled 3 phase electrical energy meter. I did not use current transformers so the maximum current that I could measure was limited by the internal CTs of the meter I used which was 5 Amperes in this case. This portable setup is useful for measuring the power consumed by appliances around the house/office/factory.
SHT11 coupled with a Particle Photon. Uploads data to InitialState.com
SHT11 is a 3.3V I2C Capable Temperature and Humidity Sensor.
I installed it next to the WiFi router inside my house.
My WiFi router has a USB port for connecting a portable hard disk to serve as media storage.
I used that USB port to power the Particle Core.
The compiler is part of a Web based IDE.You type the code there in your browser (very Arduino like) and click the flash button.The code gets compiled and downloaded into the Particle Core/Photon over the WiFi/Internet.
Since this device is installed just above the door of one of my bathrooms.
If one takes bath and come out, a pulse rise in humidity is registered.
So I can actually look at the feed from past 1 week and check on what days I did take a bath and on what days I did not.
- InitialState.com uses HTTPS which requires a resource-heavy SSL library to run on the already resource-constrainedmicrocontroller.
- The build process is captured in this blog post here
- SHT1x Arduino library that I ported for use with Particle Core: Github Repo
- Source code for getting this done: Github Gist
A lamp that shimmers when your sweetheart mentions you in her tweet?
Build one using Arduino Yun, Digital dimmer and Temboo.
- Build details, source code and video: My Blog Post
This is a surveillance system based on MotionPie - Linux distribution fine tuned for turning your Raspberry Pi into a Surveillance System.
I used a UVC USB webcam along with my Raspberry Pi 1 for the purpose. MotionPie automatically shoots small video clips whenever it detects motion. A bash script that identifies the latest one of these clips and uploads it to PushBullet. These show up as a push notification on your Android phone if you have the app installed on your phone. MotionPie has now been renamed to MotionEye OS [Github | Facebook] since it supports more boards (like Banana Pi, Odroid C1 and Cubietruck)
- Build process: My Blog Post
This one uses an ESP-01 module (Sporting the ESP8266 chip) reprogrammed to run the nodeMCU lua interpreter. A lua script reads Temperature and Humidity values from DHT11 and uploads its to ThingsSpeak.com once every minute.
- Source Code: init.lua | thingspeak.lua
- (Remember to change MY_THINGSPEAK KEY in thingspeak.lua to your key and MY_WiFi_SSID and MY_WiFi_PassPhrase in init.lua)
- ThingsSpeak.com Feed URL: https://thingspeak.com/channels/65872
Ambient Sensors in a Visiting Card holder
Stuff that I put together
Air Quality Sensors
AirPi is a Raspberry Pi shield made by Tom Hartley for collecting data about the air quality and logging it online over at Xively.
I ordered mine a few months ago and got an enclosure for it.
The kit is available here on Tindie.
The Python code and installation instructions are available here on github.
On my AirPi, I modified the Python scripts - removed the super while loop and set the script up as a cron job that executes every minute. I also modified them to upload the datapoints to InitialState.com instead of Xively. My Github of the fork which includes these changes is here.
I used Netgear WNA1000M USB-WiFi dongle to add wireless to RPi. It has a Realtek RTL8188CUS chip inside it. The Raspbian distribution comes pre-loaded with drivers for it.
I am a licensed Amateur Radio operator.
Recently, I setup a Raspberry Pi 2 at my house in Pune to monitor the ADS-B signals from aircrafts passing overhead.
I referred the build process outlined here to build my own PiAware setup.
I also installed Raspcontrol on my Raspberry Pi 2
I used the same DVB-T USB Tuner mentioned in the pages above. It uses the RTL2838 chip.
I added a Netgear WNA1000M which uses RTL8188CUS chip to add WiFi to my Raspberry Pi.
I made sure to use USB extension cable with the Netgear USB WiFi dongle so that i could place it further aware from the USB DVB-T Tuner.
This made sure that the WiFi signals did not interfere with the DVB-T Tuner.
Stuff that I bought
CarIQ is a Pune based startup. They sell this device that comes with its own SIM card inside (you don't have to pay any monthly data charges). The devices plugs into your car's OBD-II port. It draws power from it. It stays powered even when your key is removed from the ignition. Besides having GPS, it fetches engine health messages over CAN and sends this data to their servers online. You can keep track of your car's engine's performance, battery voltages, how much you travel every week and compare your driving performance with other drivers of similar cars who chose to install CarIQ in their cars as well. I find it useful when I travel to a strange place for the first time and want to mark it on the map once I am back home. I use the device with our Maruti Swift VXi puchased in May 2010.
So what all do I have as a part of my Infotainment center?
An LCD TV with LED back light, Samsung Blu-Ray player capable of playing videos over a DLNA capable NAS, a Chromecast, Tata Sky HD box and my Laptop.
I use an HDMI Hub to connect them together. The Blu-Ray player is hooked to my home WiFi router using a CAT5e cable that runs through the PVC conduits in the walls.
- More details: PDF Slides
Me and two other friends purchased flats in the same apartments at same time. While moving in, we decided to setup a local area network between our homes so that we could share a high speed internet, share printers and play files from each other's NAS on each other's TVs/Blu-Ray players. So we got the building's electrician to route CAT5e cables between our flats located on different floors. We placed a WiFi router in each flat and hooked them up together.
In my own home, I had asked the builder to run CAT5e cables along with AC power cables along the PVC conduits in the walls (concealed wiring). This allowed me to place RJ45 sockets at most switch panels in most rooms.
- Network diagram of our Local Area Network: PDF
- At places where one RJ45 socket was not enough, I used 5 port Ethernet Switch [DES-1005A] to extend the network:
My Home Network
Withings Aura Connected Alarm Clock
Withings makes connected devices for wellness tracking. One of their products is Withings Aura.
This devices has a plethora of sensors - besides the usual ambient light, temperature and sound, it has a sleep sensor which is a mat that you but under your mattress.
The sleep sensor keep tracks of your sleep cycles (deep, light REM) and wakes you up at the the best time (within the vicinity of the set alarm time) in your sleep cycle so that you wake up fresh always and never groggy.
The alarm clock feature soothing music and light to put you to sleep as well. The builtin lamp and snooze function are touch activated.
You can wake up to a web radio station as well.
The clock has WiFi and Bluetooth built-in.
I have set it to play a live web stream of Radio FG 98.2 FM Paris.
I do feel that I wake up fresh since I have started using it.
The companion Withings Health Mate app is a single app that works with all the Withings devices. That said you can manually enter and track your weight, fat% and blood pressure as well.