Up and running with the ESP8266

Successfully put ESP8266 into prototype after finalizing the temperature controlled deck lights.  The deck lights use an Arduino UNO with MOSFETs, a dht11 sensor and a ds1307 real time clock (rtc). They turn on and off the lights at predefined times.  I’m hoping to use the Timelord library to turn them off shortly after sunrise and on at sunset.  That’s for another post.

The only thing they are really missing is connectivity.

IMG_20170328_185853

The ESP8266 solves that with on-board Wi-Fi, and pretty much anything else you could want for ten bucks.  Other people have said it, but this is amazing technology for the money.  With a little persistence and a lot of mistakes, it is infinitely configurable.  I ran out of DHT sensors and had to rely on the sole analog pin of the ESP to start collecting data.

On day 1, it’s already streaming data to thingspeak’s platform every 20 seconds.  I know that’s overkill, but I copied the timing code and didn’t want to recompile and upload before settting it up for the night on the porch.

Clipboard01

Here it is after running all night on the FTDI USB TTL adapter (I do not have a high quality 3.3V power supply).

 

Clipboard01I have a LiPo Battery that I will run it off for the day after adjusting the WiFi Send interval to a more reasonable 1 Hz.  After reading about the Narcoleptic.h library, it seems plausible to get 1 year off a LiPo Cell.

While I like the data manipulation of Thingspeak, I prefer the customizability of Google Sheets for data display especially since I’ve already worked out the bugs of the sheets daily rollover.  While both services are free and both could charge at any moment, I suspect that google will prefer to keep it free while consuming our data.

With google sheets as a preferred method, the next step is to figure out how to POST data to google sheets directly from ESP8266 packets.  From what I can tell, this will involve a google form or an intermediary processor such as python and gspread which I already have running.

Advertisements

Tomato Shibby Internal Webserver

While learning bootstrap3 and developing for beadopotamus.com, I had the need to internally serve the website so we could look at it on multiple devices to allow for screen size and color variations.

Turns out that Shibby’s Tomato has NGINX internal web server!  Yay.  Setting it up was not terribly difficult but required some tinkering.

  1. Make sure your flash drive is mounted under USB support.
  2. Under file sharing,   you probably want to create a separate mount point for ease of SAMBA access to the directory.  I did and it works well.  I can use Brackets over the network to test changes in the dev environment.
    1. I created a www directory under the root and called it web.  usbwebserver
    2. This directory houses the hosted files.
  3. Enable the webserver and point it to the correct directory.  nginxconfig

I hope this helps someone.  I couldn’t really find a tutorial on it so I fiddled with it until it worked.

The good news is that this is not externally accessible so there is little security threat.

The peculiar thing is the directory did not survive a reboot.  I’m guessing that the router clears out the web server directory on reboot.  Current config here. I’ll see if this survives a reboot.

intserverconfigserverintserverconfigshare