I have written about the ESP8266 before in my post about the magic button. For the button I am using the nodeMCU firmware which let’s you run lua script on the ESP. But recently the people over at esp8266.com created an Arduino IDE version which is compatible with the ESP8266. I was already using an ESP connected to an Arduino to log the output of my solar panels so I decided to try and run this code natively on the ESP. And it worked, so although this is not automation or virtualization related, here are some more details about my ESP8266 PV Logger.

Library

The logger connects to my Mastervolt Soladin 600. This inverter has an RS485 port but connecting it to a TTL serial port is easy. All you need is two resistors. For the schematic see the readme on github. I have been monitoring my PV panels for years using this library. That lib only works with software serial ports which are not supported by the ESP so I changed that to use the Stream class instead. Both Software Serial and Serial are inherited from Stream so now it should work with both on a normal arduino but I haven’t tested it with the software serial. I also changed the serial delay and timeout settings to get reliable communication between the ESP and the Soladin. You can find the updated lib here.

Log Destination

There are a couple places you could send your logging data to. Until today I was using data.sparkfun.com and that worked fine. But it’s lacking nice grapical presentation of you data. And I’m too lazy to build my own so I looked for something else. Now I am using thingspeak and that seems to work just a s well with the added bonus of nice graphs and google gauge visualisation. You can find my stats here.

Logger Code

The logger code is pretty easy. It tries to connect to the Soladin, if that succeeds it sends data to thingspeak. This is repeated every 15 seconds. If it can’t make a connection to the Soladin the loop slows down. You can find the whole code here on github. Don’t forget to compile it with arduino 1.6.1-esp8266-1 instead of the regular arduino IDE.

Hardware

All you need to run this is a 3.3volt power supply, two resistors, a cable with an RJ11 connect and a ESP-01. Mince looks like this.

The best part? The whole thing costs about 5 bucks! That’s a lot cheaper than Mastervolt’s PC-Link cable.