Graphical presentation of Sensordata with ESP8266

In an earlier post I described the use of a graph, showing results of a BME280 and DS18B20 sensor. This was based on an article from siblings Rui anď Sara Santos from randomnerdtutorials, but tailored to my needs. The biggest difference with the original article is that i used a JSON for data transfer in order to display more than one line per graph. The original code as well as my adaptation had some drawbacks, one of them being that after opening the chart, one had to wait the full interval (set to 30 secs) before the first value appeared. That is now fixed (thanks JB): the first value will appear immediately on opening the chart.

As an example I am using an ESP8266-01 that addresses a PCF8591 ADC/DAC. The 4 ADC’s read 4 soil humidity sensors and plot those in a graph. The battery voltage is also plotted. As i use a LiFePO4 battery, there is no need for a regulator and i can simply read the Vcc in order to know the battery voltage. In order to save the soilsensors from electrolysis, i switch them on when i take a measurement and switch them off in between. Rather than using the free gpio1 and gpio3 (Tx and Rx) for that I use the DAC output.

One could argue (and i would agree) that it is quite useless to check soilmoisture every 30 secs where maybe once every 4-6 hrs suffices, but just see it as example of how you could use it say for a slow cooker or your oven or CV.

*These pins hve internal pullup on the ESP01S, but not on the ESP01

You will find the code here.

Another ‘issue’ was that since an external library (highcharts) is called, one needs active connection with internet. This is not always desirable or possible. There are 2 ways around this: download the highcharts library and put it on your own server, or download it and put it in the esp8266 FS and make some small adaptations to your code (solution provided by J. Bredahl). You will find that code here.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.