Smart Home / Internet of Things

Awhile back I went on a vacation and was concerned that the heat might go out at my house and my pipes would freeze. My dad lent me a device that was fairly expensive that I could hook up to my land line which would call me in the event water was detected. It was a bit of a pain to setup and was unable to inform me of a power outage. Since then I've learned to program microcontrollers fairly well. That, coupled with the release and widespread availability of esp8266 breakout boards led me to install a temperature/humidity sensor in my crawl space. I created my own printed circuit board to make connecting a NodeMCU 1.0 with a DHT sensor quick and easy. It also breaks out every pin of the NodeMCU and has a small proto area for attaching a variety of other sensors and/or actuators.
Here you can see my setup in action, powered by a standard cell phone charger and cable. I programmed it using the Arduino IDE. To program an esp8266, you must navigate to preferences and add the following URL in the Additional Boards Manager URLs box: http://arduino.esp8266.com/staging/package_esp8266com_index.json. Then, go to Toos >> Board >> Board Manager and install the esp8266 boards. I programmed mine to log into my WiFi network and log data to a Google Spreadsheet using Sujay Phadke's fantastic HTTPSRedirect library. From my spreadsheet, I am able to set up events that trigger emails or text messages that are sent whenever certain conditions are met (e.g.: my crawl space is too cold and the pipes are about to freeze, or the sensor is offline which means the power probably went out).

Bringing Smart Home / IoT Projects to my Classroom
In the fall of 2016 I was awarded a grant by the Mat-Su Schools Foundation to buy materials for my students to build and program a demo smart home and undertake other IoT projects (see attachments below). Bringing this experience to my students proved far more difficult than I had anticipated though, as we had a tremendous amount of difficulty just connecting to the school's guest network. I tried several different devices (Raspberry Pis, Ethernet shields, and various microcontrollers) but was unable to figure out a way to easily connect to our school district's guest network. Either I had trouble connecting microcomputers because ntp servers were blocked, or I had trouble connecting microcontrollers because I couldn't get past the splash page (it's hard to click "I Agree" when the device you're using has no screen to render the web page). I even tried rooting my phone and installing software so that I could make it a hotspot that only microcontrollers could connect to. Even after corresponding with multiple app developers, I was unable to work out a viable solution (I had no way to limit the hotspot to the specific devices we were using in class).

To make matters worse, the free and super easy to use service I had been using (Ubidots) changed their terms of service (no longer free). So, I decided to break down and figure out how to read information from and log sensor values to a Google spreadsheet. I figured this would be a great sustainable solution as it would be free and you can do all sorts of things using Google Apps Script like send an email based on high or low sensor reading. That said, communicating with a Google spreadsheet using a microcontroller is a lot easier said than done since Google redirects users to another web page when using such services. Initially, I figured out a way to tweak Sujay Phadke's HTTPSRedirect library to obtain the bidirectional communication I sought.

Finally, in March of 2017, our IT department got rid of the splash page and Sujay Phadke released a much-improved version of his library. Even so, it took another couple weeks for me to figure out how to get an esp8266 to consistently connect to the guest network. Eventually, I figured out that it was having trouble connecting in an environment where multiple routers were broadcasting the same SSID. The final piece of the puzzle was figuring out how to specify the BSSID and channel of the router in my classroom.




Ċ
Michael Backus,
Apr 8, 2017, 5:05 PM
Ċ
Michael Backus,
Apr 8, 2017, 5:05 PM
ċ
Tricorder.zip
(62k)
Michael Backus,
Aug 23, 2015, 2:55 PM
Comments