January 18, 2015 | Circuits |
I had previously written about using the ESP8266 WiFi module to make an Internet Of Things (IoT) device that plots temperature data on the web, at thingspeak.com. That was a mess of wires on a breadboard. I have now refined this project - simplified some components, put them on a PCB, given some thought to saving battery life, as well as built a laser-cut enclosure for the device, which is now installed in my balcony garden.
The schematic for the device is below. I am using the “01” version of the ESP8266 WiFi module here. I am also using a 3.3 V version of the Arduino Pro Mini (or a clone in my case) to talk to the ESP8266, since the latter works at this voltage and I don’t need to worry about shifting voltage levels from 5V to 3.3V. As before, I am using an LM35 temperature sensor, and I use an Arduino analog pin (ADC) to read it. The whole thing is powered by a 9V battery. An LD33 3.3V regulator takes care of the supply to the ESP8266, and since the Arduino has a built in regulator, I can directly connect 9V to the RAW pin. For conserving battery life, I do the following:
- Take a temperature reading every 10 minutes.
- Plot it on thingspeak.com.
- Put the Arduino to deep sleep using a watchdog timer. (I use the Narcoleptic library for this purpose.)
- Use the CH_PD pin of the ESP8266 for disabling the chip when not needed, using a digitalWrite on the Arduino.
I also use the SoftwareSerial library on the Arduino to communicate with the ESP8266. That way I can keep the hardware serial pins connected to the USB to TTL adapter and use it for debugging. But you could do the opposite.
I also assume here that the ESP8266 module has been setup to connect to your WiFi network. I’ve covered this part in my previous post. The SSID and password are stored on the ESP8266 once you set it up, and you don’t have to keep sending that information in your Arduino code.
Here is the Arduino code.
For enclosure, I designed a T-slot based acrylic box using the Inkscape T-Slot Boxmaker plugin. It uses M2x10 hex screws and has slots for the LM35, PCB spacer, as well as one for hanging the box on a nail. The acrylic thickness is 3 mm. Here’s what it looks like:
I built the circuit on a general purpose PCB. Here’s what it looks like in the process of assembly. (Thanks to my pal Ravi for getting the enclosure laser cut quickly!)
Here is what the device looks, hanging out on my balcony:
This is what the plot looks like after a night of data collection:
Click here for a live feed of temperature data from my balcony garden.
You can find all the necessary files for this project at my github link here.
Need help with a hardware project or product? Drop us an email at firstname.lastname@example.org. We offer consulting services on AVR and Nordic nRF BLE - hardware design, firmware development, prototyping, PCB design/assembly, sourcing and manufacturing. We can help you bring your product to market!
Bluey nRF52 BLE IoT dev board
We love hearing from our readers. Email us at email@example.com for questions or comments on this article. If you found this article useful, please support us by buying some of our hardware products.