Skip to main content

Posts

Showing posts from May, 2016

Personal Analytics using DIY IoT devices and InitialState.com

Recently I have blogged about three DIY IoT devices that I have put up in my house. Some of these devices have been running for past 3 years and uploading data points to one of the three data brokers - Xively or ThingSpeak or Carriots. A few months ago I switch to InitialState.com which has a sleek interface and allows you to analyse your data in a much better visually intuitive way.

So with the following 3 devices collecting data using sensors from inside my house...

Weather station outside - installed in my balcony (temperature, humidity, pressure, light)Ambient sensors inside the house next too the bathroom (temperature and humidity)Electrical Energy Meter - Monitoring voltages, currents etc on all 3 phases 

...here are the few insights that I gleaned on from analyzing the data:



Overview:

My electricity usage patterns:





SHT11 + Particle Photon (running matrixSSL) + InitialState.com

Now days microcontroller platform for IoT devices are becoming more and more powerful so much so that they can now sport an HTTPS stack and hence send telemetry to an HTTPS capable data broker like initialstate.com. Which means no need for any linux based gateway/hub - you can do away with your Raspberry Pi as a go between your microcontroller node and the internet.

You ask why would some one want to do that? Simple - lesser the number of components in your system, lesser the points of failure.

So, I wanted to explore if it was possible to use a Particle Photon to send data directly to initialstate.com and recently it just became possible when a few good folks ported an SSL library to Spark Photon.



Steps:
Get a Particle Photon and connect it to SHT11. SHT11 is a digital temperature and humidity sensor. It works at 3.3V logic levels and can be powered by the photon itself. The photon will draw power from any nearby device (computer, smartphone charger or router) which has a spare USB p…

Configuring your OpenWRT router to use ExpressVPN to provide unrestricted internet access to all your devices

Problem statement: I am in China. I have subscribed to ExpressVPN access to check my gmail and facebook. I have a pocket router (TL-MR3020). How can I use that VPN for all my devices (laptop, mobile, tab, Android TV box). TL-MR3020 can run OpenWrt. It has a USB port, an Ethernet port and 802.11bg WiFi
Here are the steps. They involve downloading packages to your OpenWrt router. OpenWrt repositories are blocked in China as well. So complete these steps in your home country before you fly to China. (If you are already in China, you can install the ExpressVPN client on your laptop, and share that VPN Connection with your OpenWrt Router. Refer to this blog post on steps on how to do that)
Install OpenWrt on your TL-MR3020 router. (Refer to this blog post on how to do that - the latest version is a bit big and requires an external flash drive for extra memory size)Connect your OpenWrt router to unrestricted internet. Make sure you can access the router's console over SSH or serial (using…

Share your Laptop's ExpressVPN connection with your embedded development device while in China

Imagine you have an embedded development device (TL-MR3020 running OpenWrt in my case) and you are in China.  You want your embedded device to access unrestricted internet so that you can develop some apps for your router. You can use your laptop as a go between your home WiFi and your router. The laptop will initiate VPN connection and provide the internet access to your development device (TL-MR3020 in my case)
Here is my topology:

My laptop: Runs Windows 10 x64, ExpressVPN client and Tiny DHCPMy development device: Tplink TL-MR3020 running OpenWrt Chaos Calmer with rootfs mounted on external flash driveName of my WiFi adapter on my Windows PC: Wireless Network ConnectionName of my Ethernet adapter that I connect to my TL-MR3020: Local Area ConnectionName of the virtual TAP adapter created by ExpressVPN that I will share with my TL-MR3020: Ethernet (and NOT ExpressVPN - I know it might appear in some screenshots below, but that's not what we want to share)
Get a paid ExpressVPN a…

Internet Connected Energy Meter

This is the final post in a series of post that explains how I installed an electrical energy meter in my house and connected  it to the internet.

Here are the steps involved:

Installing a 3 phase energy meter in your home [Blog post here]
(I used Selec MFM383C Modbus capable energy meter, connected it to my router using USB<>RS485 interface based on FT232RL and MAX485)
Installing OpenWrt 15.05 Chaos Calmer on TP-LINK TL-MR3020 [Blog post here]
(required adding a USB hub to it, a USB flash drive to hold the rootfs, an FT232RL widget  for getting console access to the router over serial and another FT232RL based USB<>RS485 UART for interfacing to the energy meter using modbus. Instead of TL-MR3020, you can use TL-MR3040 as well which has its own battery pack in it.)


Compiling the binaries for libmodbus and mfm383c [Blog post here]
Install drivers for FT232RL based RS485 bridge, curl and some other important stuff on your router:
# opkg update#  opkg install kmod-usb-serial-ftdi k…

Cross compile .ipk including lib dependences for OpenWRT on Ubuntu 15.10 x64

In my efforts to smartify my house, one of the first things I did was to install an energy meter and connect it to the internet. I connected a TP-link TL-MR3020 to a Modbus capable energy meter to do this. Here are my efforts this far: Installing a 3 phase energy meter in your homeInstalling OpenWrt 15.05 Chaos Calmer on TL-MR3020 The next involved writing and compiling some native code to interface with the energy meter using Modbus. The Selec MFM383C energy is connected to TL-MR3020 over UART. My TL-MR3020 has a USB hub connected to it. One of the slots has a 8GB USB Flash drive in it with the rootfs on it. Another slot has FT232 and MAX485 based USB-UART bridge. I use this USB-UART communicate with my mfm383c using Modbus.
------------
Problem statement: Cross compile C code into an OpenWrt ipkg in case which requires fetching and compilation of dependent libraries as well.
Detailed problem statement: Cross compile a piece of software (native, C program)The software depends on a lib…