Have you ever wanted to introduce yourself to Introduction to IoT? This blog will do just that. We will start with hardware, setup the hardware support libraries and proceed to code development. Once we have our basis covered we can progress with IoT fleet management, architecture, connectivity options and cloud components available to us. Welcome an IoT journey that will change your life!
There has been lot of questions circling around the IoT scene recently about connectivity, usage scenarios and how to put these devices into good use. To answer some of these, I decided to write a series of blogs that will guide through the basics of IoT with cloud connectivity.
Most of the topics will be hands on development with readily available inexpensive physical SDK:s. We will cover at least connectivity to push and pull data from and to the cloud. We will also cover usage of WiFi and LoRa networks, basic data display and some of the Microsoft's cloud offerings that can be used with IoT devices. What we will not cover is a fridge that can count how many sausages or eggs it contains.The ingredients to achieve all this:
- WiFi network
- Setting up the development environment (this is the hardest part).
- Creating a solution that will retrieve data from the interwebs and display that.
- Creating a second solution that will push data to a web service that will persist and present the data.
For the IoT we need the T, meaning the thing on this context. For the whole series we will use HHeltec ESP32 development board with WiFi and LoRa networks. Cost for such a board is roughly 15 euros. These can be sourced with relative ease from Ebay (search for “heltec lora 32 sx1276”). There is a newer version V2 of the board. However, I have only used V1 so there is no guarantee that V2 works with the code provided.
Board itself looks like this:
Installer for the Arduino development platform can be found here >>
Download this version: Windows Installer, for Windows XP and up. In case you are a MAC or Linux user you must figure out the installation procedure yourself.
Once the download has finished, start the exe to run the installer. Here are the instructions to complete this: I agree, Next, Install, then go get some coffee. Driver installation should await you when you get back. Choose to install this.
Another driver installation prompt comes, choose to install this also, and then one more time. Close is the final step on completing the development environment installation.
Next thing that needs to be done is to setup the libraries for the board we are using:
Open the Arduino IDE from the windows start menu. Navigate to file-preferences and locate: Additional Boards Manager URL:s and click the Icon. Then add: https://dl.espressif.com/dl/package_esp32_index.json as a new line.
Next step to install the support for the dev board is:
Go to Tools – Board:”xxx” – boards manager. Then write ESP into the textbox and install esp32 by Espressif Systems. Wait patiently as download will take some time. Also install support for the U8x8 display.
From IDE select Sketch – include library – manage libraries – then key in “u8x8” and install the latest version available of u8G2 library.
Do not close this window yet as we also need a parser library for Json data.
Change the search string to json and install ArduinoJson library. Do not select the latest one as that is in beta still, version 5.13.1 is the one we need.
All done! Now we are ready to proceed to the next chapter, which will guide through data acquisition from a REST based internet service.