Last night, I worked on my ESP8266 project code so that the data would be sent to both Thing Speak and the MySQL database on my webhost. After working out some reliability issues, the information from my ESP8266 project is now in three places: Thing Speak, an LCD, and a MySQL database on my webhost.
Since I’m using my ATmega328p breakout, I can’t see what’s happening in a serial monitor, but I was able to print out messages on the LCD that helped me debug. The problem was that it was sending values fine to my webhost but it kept failing at sending anything to Thing Speak except for one lucky time. I recall seeing some delay when closing the TCP connection when the project was still on the Arduino Uno so I tried adding delays to give it some time to close the TCP connection to my webhost before attempting the Thing Speak transmission. After some trial-and-error with the delay value, it finally became reliable.
The new code is available on GitHub. I also took the time to clean up the folders so that it’s easier to find the different versions of code.
I’m still waiting on some mini slide switches in the mail before I can put everything into an enclosure. I had a beefy switch in my spare parts bin that I was going to use for the input power but I measured the input current during a full cycle with the LCD on. It seems to go between 50mA and 100mA, 100mA presumably whenever it’s taking a measurement from the DHT22 and when it’s sending data through the ESP8266. I had the impression that the ESP8266 drew more current than that so I’m pleasantly surprised it stays that low. The mini switches I’m waiting for have a current rating of 500mA so that should be fine for the power supply.
Thanks for reading!