Arduino IOT: Easily Learn IOT with Arduino Web Tutorials. Learn How to connect your Arduino to the Web. Find out how to implement web servers with example tutorial programs.

Arduino IOT revolutionises the way you can connect and automate your devices. It used to be that you had to use an Internet Shield that plugged into your Arduino and then connect that shield to the internet via an internet cable to your router.

iot revolution

However, with the fantastic ESP range of devices, it is now simpler than ever to setup an internet connection because they implement WiFi operation with radio hardware built into the ESP board; so there's no tricky setup.

For programming you simply plug into a USB port as you do for all Arduino boards.

You can put an ESP device anywhere and, as long as it has a power source, it can connect to your local internet. No wires in sight!

Understanding Arduino IOT

Arduino IOT and IOT in general involves networking of your Arduino boards, attached sensors and circuits so that you can interact with your board through the internet. You can exchange data in both directions, typically displaying gathered data on a web page, but also allowing you to control the board directly from the web page.

For instance you could control a relay from the page to turn lights on or off. Alternatively you could measure temperature and automatically turn a heater on or off with another relay. The Wifi connection would allow you to override the automatic action - say you were out all day and did not want the heater on at all. You could even set the temperature lower to save electricity by sending data from the web page to the WiFi connected circuit.

You can even gather data to a cloud service so you don't have to have the PC switched on all the time. You can just access that cloud data to see updates of your WiFi connected sensor outputs.

Benefits of Arduino IOT

  1. Simple connectivity: Boards with built in WiFi capability are simple to use as they also allow you to program them as if they were an Arduino Board e.g. ESP8266 or ESP32.

  2. Sensor integration: Since the boards can be programmed as standard Arduino boards, they use the same software architecture. It means libraries are easily used on the WiFi boards to support existing sensors such as humidity or temperature sensors etc. The sensors become more useful as you can send the data to a web page or to the cloud which you can then view in real-time. You can then use that  sensor data in environmental monitoring or home automation etc.

  3. Data processing: Since the requirements to operate a WiFi link are high, the processors are typically 32bit and run at 100s of MHz frequencies. They are actually DSPs which means thay can also do a lot of computation locally. You can use the processing capability yourself (when the Wifi is inactive for instance) to process input data.

  4. Automation: Connecting your boards over Wifi allows you to control and automate processes and even remotely control your systems. You could have a door bell and camera connected to the internet but also control a relay powered door lock. So you could asses who is at the door and let them in if needed.

  5. Easy prototyping: As with all Arduino boards, ESP boards connect using a USB connector that also acts as a power source during development. The pre-programmed bootloader allows upload of your programs at the push of a button. So you can quickly develop code and try out different sensors very easily.

Starting out with Arduino IOT

Most of the following C/C++ examples deal with the WiFi aspect of using the ESP32 or ESP8266 and some libraries will be different for each but the web code ideas are the same. The question is which device should you choose ESP32 or ESP8622.

The following pages give you a tutorial on setting up and using Arduino iot:

Arduino IOT: ESP32

ESP32 Programming

This tutorial shows you how to program an ESP32 CAM but the process is the same for any ESP32 board  - just select the different board in the IDE.

First off you'll need to get an ESP32 board and program it using the Arduino IDE. The link shows you how to program an AI thinker (Arduino CAM board) but you can choose any of the available boards and follow the same process for programming any ESP32 board (the libraries used are the same for any ESP32 board).

ESP32: Arduino web server

You will also want to know about serving web pages using an Arduino Web Server. You an choose between a synchronous or asynchronous web server. In that link find out what the difference is between the two and run code examples to show their action.

ESP32: What is a WebSocket?

There's one problem when you use just a plain old web server and that is: Every time you went to get an update to the page you have to reload the page. If you wanted to see sensor readings every second you don't really want to have to keep clicking the refresh button - that's where WebSockets come in.

ESP32: Implementing WebSockets

The ESP32 WebSocket Server page shows you exactly how to implement websockets on an ESP32. There  are four steps showing you the various parts of the WebSocket operation :

  1. Server.
  2. Client to Server.
  3. Multibroadcast (There can be more than one active WebSocket).
  4. Server to Client.

The code required to implement each of these elements is in that link and shows you exactly how WebSockets work.

Arduino IOT: ESP8266

ESP01 or ESP01S?

There are many boards that use the ESP8266 and one of the most popular is the ESP01 (because it is the smallest ) but there are now two versions so which should you use the ESP01 or the ESP01S?

ESP 01 Programming

Exactly how can you program an ESP01. This tutorial walks you thorugh programming and ESP01 using only another Arduino board. In this case it is an Arduino Uno but you could use any board with a built in USB to serial interface (if the Rx/Tx are sent to pins). Click on the link ESP 01 Programming for more information.

Arduino IDE for NodeMCU

How to setup and program the NodeMCU V3 (ESP8266 ESP12e) board using the Arduino IDE. This example shows you how to program the boot loader back into an ESP8266 (if you want to change back  from using LUA) and the it shows an example for scanning for available WiFi network names.

Alexa Voice Control

The Easiest Alexa Voice Control Library Fauxmo; Easily Emulate WeMo devices with simple code for custom smart home devices. You can control relays and dimmable lights very easily with minimal code. Talk to your projects to control them.

Arduino IOT: LUA programming

Lua is an interpreted programming language (in the same way that python is also interpreted) meaning that you don't have to program the entire Flash memory every time you update 'your' program. Lua uses a slightly different programming language idea in that all actions are event driven.

Once the ESP8266 is programmed with Lua functionality you can upload your program over the serial port. You only upload your program and then use a Lua editor (Esplorer) to manage your Lua programs.

LUA Webserver

Setting up the ESP8266 as a webserver using the LUA language.

LUA Examples

Once you have got LUA running you can investigate example programs that
control an LED.

ESP-01

ESP-01 vs ESP-01S

Did you know there are two similar boards:

  • ESP-01   (Older)
  • ESP-01S (Newer)

Confused about these board variants? Which one is right for you? Find out the exact differences between the ESP-01 and ESP-01S here and choose the right one.


Note: Parts of this page were written using chatgpt as a research assistant. Some images were created using leonardo.ai.


Comments

Have your say about what you just read! Leave me a comment in the box below.

Don’t see the comments box? Log in to your Facebook account, give Facebook consent, then return to this page and refresh it.



Privacy Policy | Contact | About Me

Site Map | Terms of Use