IoT Wireless Monitoring with the ESP8266 and ThingSpeak :: Student Project
One of our students, James Trace, has been working on an IoT project: wirelessly monitoring the performance of a Solar Geyser. He is uploading 9 fields of data to ThingSpeak and measuring temperatures, humidity, light exposure, the list goes on. All with an Arduino Nano and an ESP8266 (ESP01).
While this project is something James has been tinkering on at home, it’s partly driven by work he is exploring for low cost wireless sensors in mining applications.
If you like real data graphs, you have to check out James ThingSpeak Channels:
I asked James if he could tell me about his challenges in developing this project, and the first line of his response feels like a golden nugget to me:
Yes many – but they are all solved one at a time and it is still work-in-progress.
That is the kind of attitude that embodies someone who is willing to makes things happen!
Here are some of the challenges James has had in his own words. I have bolded those items that stand out to me:
“The mission is to be able to understand why this does not perform as well as it should and to compare its type to other types.
I noticed early on that the water temperature was dropping significantly during the nights and suspect that the direct coupled vacuum tubes were sucking the heat out again at night.
So, the plan was to measure and learn as much as possible using a small Arduino Nano and the ESP01 WiFi chip to communicate with the web.
First issue was to get the thermistors to read the same temperatures when they were all in the same place.
I got the 3rd order polynomial equation converting resistance to temperature from the data sheet. To get them more accurate, I measured the voltage divider resisters individually and set up the sketch to account for this variation as well as the difference in input voltage.
This got all these thermistors reading within 0.1ºC of each other. They are now more accurate than the analog to digital converter steps available on the Arduino.
The DHT11 and BMP180 sensors were very easy, thanks to great libraries available for them both.
I found the DHT11 temperature steps of 1ºC too large so only use the humidity from that. I use the BMP180 temperature and pressure values.
Finding data on the LDR conversion from resistance to Lux is not so easy. I have just changed the calculation to Lux = 500 / ldrR ^1.3 but will keep an eye on that and may change it if I find a better approximation.
The old equation of Lux = 500/ ldrR was unstable with high light levels where ldrR approaches zero. I may have the same issue – we will see.
The biggest issue was to understand and get the ESP01 to communicate to ThingSpeak.
I am using the AT commands and need to send data to two ThingSpeak channels as I have 9 fields and would like to add more. I have found that I am running out of local variable memory and have had to really trim the sketch to save space to get these 9 working.
I know I can reduce the accuracy and use some integers in place of floats, but that would be a compromise.
We also have regular power failures, intermittent internet connection, and the threat of lightning strikes so getting the sketch to restart automatically after any of these has been an ongoing problem.
Then it’s been just doing it and work out the issues as you go along.
It will never be perfect but I have already made progress and understand a lot more now than before.”
In addition to showcasing James projects, we are always happy to include his kind plug!
This is what James had to say about our courses:
Your courses are excellent; they explain the concepts well and I have learnt why code is there and what it does.
This understanding has allowed me to push the boundaries and measure some cool stuff. Thank you very much and well done.
This is a home project to learn some programming and what can be done.
It started off as a copy and paste code, but thanks to your lessons I am now able to do some stuff on my own.
While I have used the ESP8266 as a stand-alone wireless microcontroller, I have not used it like James has used it, as the wireless bridge between an Arduino and the Internet. Definitely makes me want to explore it more.
I hope this project inspires you as much as it did me!