ESP8266 PV Logger

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.

ESP8266 PV logger

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

9 thoughts on “ESP8266 PV Logger”

  1. This is great. I’ve had it running with my Soladin for the past few weeks. How difficult do you think it would be to send the data to my local mqtt broker instead of thingspeak? I’d be able to incorporate it into my home-assistant with mqtt.

    1. There is an mqtt client lib for arduino so that would be pretty easy. Was thinking about doing the same thing.

  2. I’ve been trying to edit the sketch to include MQTT (streaming.h) for the past few days but I think its beyond my capabilities. If you do decide to make these changes yourself I would be most grateful if you would share your sketch.

    1. Sean, I’m flattered by your question but this is purely hobby for me. I dont build stuff for other people. Thats why i share it as open source so anybody can build his own. You should give it a try, could be a nice learning exercise 🙂

  3. Me again, well I’ve taken your wise words and now have a desk filled with all manner of esp8266 devices, I’ve a bunch of wemos humidity and temperature sensors scattered around the house talking to thingspeak and I can see the temperature of my tractor shed from anywhere in the world – but I just can’t get that sketch you are using to compile, am sure it’s something simple – but it seems like I’ll have to read the entire internet before I find what’s wrong – there’s so much info online, sadly not all of it is correct

Leave a Reply

Your email address will not be published. Required fields are marked *