Connect a PICAXE to the IoT with ThingSpeak
2017-03-22 | By All About Circuits
License: See Original Project Wireless
Courtesy of All About Circuits
What is the IoT?
The Internet of Things is actually a pretty simple concept that gets convoluted. All the IoT does is connect "things" like appliances, cars, sensors of all types, and much more to the internet in order to send and receive data to/from those "things." The data can be simple information like whether a garage door is open or closed. Upon reading that data, control signals to open or close that garage door can be sent. There are specialized websites to facilitate the interchange, storage, and/or display of this data; this project uses one of those sites: Thingspeak.
Project Summary
This project uses a DS18B20 integrated circuit to measure temperature, a PICAXE 08M2 microcontroller to transmit the temperature via an ESP-01 Wi-Fi module, and an internet connection to Thingspeak.com, where it is displayed in a graph like the one below. Charles Hampton, the guy who made this project, has a library of PICAXE projects if you’d like to try some more.
The Mighty PICAXE 08M2 and the DS18B20
The central part of this project’s hardware is a microcontroller, and the PICAXE 08M2. The PICAXE 08M2 is small, powerful, inexpensive, and easy to program. The 08M2 has a built-in command to read the DS18B20 temperature sensor from Maxim, which will save you a lot of work. If you’d like to learn how to connect and use these two components together, this article, also written by Charles, will show you how. You can see a photograph below of the thermostat circuit on a breadboard and a pinout diagram for the DS18B20. Charles added an LCD to display the temperature info, but it isn’t required.
The breadboard layout
3.3VDC Power Is Required!
If you are a regular PICAXE user, you know that PICAXE µCs run well on 5VDC. So does the DS18B20. Since this project also uses the ESP8266 IC, which can’t hang with 5V; it needs to have 3.3V. Fortunately, the PICAXE 08M2 and the DS18B20 still work on 3.3V.
If you’re not sure what kind of voltage regulator to use, Charles actually designed one that you can make yourself. You can also use two AA batteries in series, but don't expect them to live long. The ESP8266 consumes a lot of power. Just, whatever you do, don't connect 5V to the ESP8266!
The ESP-01 Module
Charles has also written more articles about the ESP8266 integrated circuit, which is popular for projects with its 32-bit RISC µC and a built-in 802.11 b/g/n Wi-Fi circuit. If you’re not familiar with the ESP-01 module, his article on using the Arduino IDE to program the ESP8266 is a good place to start.
Most ESP-01 modules don't come with the latest firmware, and should be flashed with updated firmware. Don’t worry, Charles also wrote a tutorial for that.
Putting it Together
You can find the schematic, a diagram photo, and the bill of materials below.
You can find the bill of materials inside Scheme-It by clicking the image
Diagram photo
Thingspeak
You’ll need to create an account for Thingspeak, go there and follow the directions to open one.
Thingspeak allows you to create "channels" for your projects, and the process for creating a channel is described in a tutorial. Unfortunately, the tutorial is written around using an Arduino, but you can just ignore those references.
The PICAXE Code
The code uses a series of commands from the PICAXE that make the ESP-01 to communicate with Thingspeak. These commands are based on the AT Command Set. The code is "blind" because it sends commands, but it doesn’t "watch" for responses. Instead, it pauses for a short amount of time to allow the command to be sent and for the ESP-01 and/or Thingspeak to have time to react. You can find a more in-depth explanation and a downloadable version of the code on All About Circuits.
Once you have the code implemented, your temperature reader should report to Thingspeak every 15 minutes. It’s recommended to make two copies of the code so you can add additional functionality.If you have any ideas about expanding this project, let us know in the comments!
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum