A watchdog timer is an internal or external timer that monitors a microcontroller’s program to ensure the application remains operative without failure. It serves as a safety feature in critical applications by monitoring the microcontroller’s output signal. The watchdog can operate in two modes: Timeout mode – the timer establishes the microcontroller is not working properly if it…
MicroPython: How to program a real-time clock (RTC) in ESP8266 and ESP32
A real-time clock (RTC) is a computer clock to keep time and is one of the more popular microcontroller features. Microcontrollers without a built-in RTC require an external RTC chip for keeping time. Typically, mid-segment to high-end microcontrollers have a built-in RTC because time-keeping is necessary for several embedded applications. RTCs count seconds, minutes, hours,…
Getting started with ESP8266 and ESP32 on Arduino IDE
ESP8266 and ESP32 are popular WiFi development solutions that can be programmed in several ways using different programming languages. Common languages include MicroPython, C, JavaScript, and LUA script. The choice of embedded firmware and software tools makes it possible to program ESP8266 and ESP32 in different languages. The versatility and flexibility to program ESP boards…
How to play a video on an SSD1306 OLED
Small organic light-emitting diode (OLED) displays are commonly used in embedded devices. This is because OLEDs generally cost the same as character LCDs but feature a better user interface (UI) and user experience (UX). Typically, embedded OLED screens are used to display textual messages, but what about videos? For example, is it possible to playback…
How to send messages to WhatsApp or Telegram from ESP32
In many Internet-of-Things (IoT) applications, it’s necessary to send alerts to the user in the form of messages. Typically, text messages are sent via WiFi or SMS. But sometimes text messaging is unavailable between devices. So, what if these messages could be sent via the IoT to a user’s WhatsApp or Telegram account instead? In…
How to send MQTT data from ESP32/ESP8266 to Raspberry Pi
It’s possible to set up a do-it-yourself home automation system with an ESP board and Raspberry Pi (RPi). Both offer Wi-Fi connectivity and can easily communicate via a home network. However, a communication protocol is required for wireless communication for devices operating in a wider network. Since conventional internet protocols like HTTP are typically too…
How to extend solar and battery power in a weather station
Experiment 2 Aim To run an MCU on low power mode, read the temperature, pressure, and humidity readings using AHT10 and BMP280 Sensors, and send the readings over wifi. Requirements MCU: ESP32-WROOM-32D (Generic Wi-Fi + Bluetooth + Bluetooth LE MCU module) Temperature/Humidity Sensor: AHT10 (Temperature and humidity sensor) Pressure and Altitude Sensor: BMP280(Absolute Barometric Pressure…
How to achieve longer MCU battery life with low power sleep mode
There are generally six power modes in an MCU: Run: In full run mode, an MCU consumes full current. This mode is best suited for applications where power efficiency is not essential. Doze: As we know, power increases proportionally to the frequency. Therefore, we can conclude that higher clock speeds tend to higher power consumption.…
How to use MicroPython with ESP8266 and ESP32 to connect to a WiFi network
ESP8266 and ESP32 are popular WiFi development boards. These single-board microcontrollers are supported by the MicroPython framework and are often used for the internet of things (IoT). Using MicroPython, ESP8266 and ESP32 can connect to the internet via WiFi and Ethernet. The MicroPython ports use Ethernet or the wireless local area network (WLAN). In this…
How to use ESP8266/ESP32 as a TCP server and client with sockets
ESP8266 and ESP32 are popular WiFi development boards. These microcontroller boards are ideal for building the internet of things (IoT). We covered how to connect ESP8266 and ESP32 (or any MicroPython port) with a network connection for use as a WiFi station here. We used the MicroPython network module. This network module provides a driver…
How to use ESP32’s sleep and wake-up modes in MicroPython
In a previous article, we covered sleep modes in ESP8266. ESP32 is another popular Wi-Fi development board from Expressif systems. It’s more feature-rich than ESP8266, but also more power-hungry. The power consumption of ESP32 can reach up to 790 mA when the Wi-Fi and Bluetooth are both operational — nearly double that of ESP8266, which…
MicroPython – Generating PWM on ESP8266 and ESP32
Pulse Width Modulation (PWM) is one of the five basic functionalities in any microcontroller. The other four are digital input, digital output, analog input, and serial data communication. Most microcontrollers do not have a built-in digital-to-analog converter to output analog signals. However, most of the microcontrollers have one or more PWM output interfaces. PWM signals…
MicroPython – Digital input/output in ESP8266 and ESP32
The first step in programming embedded devices is to perform digital input/output. Digital input/output refers to reading parallel data. The same logical signals are utilized for switching and control operations. MicroPython, an embedded firmware, essentially includes libraries to control digital input/output and other hardware functions. MicroPython can be uploaded and run on a variety of…