Nearly all the devices we use today — from smartphones, tablets, wearables, and even many of our appliances — connect to the Internet via a home (or office) WiFi network. Internet access to smart devices is typically managed through a web interface or mobile app. Similarly, when we’re out and about, we’ll access WiFi for…
How to use MicroPython’s watchdog timer in ESP8266 and ESP32
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,…
MicroPython based online weather station on ESP8266 and ESP32
MicroPython is one of the best microcontroller firmware that supports a variety of embedded platforms. The WiFi development boards like ESP8266 and ESP32 are among the MicroPython-supported ports. With MicroPython, it is extremely simple to implement top-notch IoT applications. MicroPython has wide support for network programming along with implementing all basic hardware functions. It combines…
How to animate text on SSD1306 using MicroPython and ESP8266
Organic light-emitting diode or OLED displays have become essential for many embedded devices. OLEDs are considered one of the highest-quality displays to showcase device information. Typically, embedded devices use single-screen graphics, but complex interfaces are required when there are several user interactions. For example, such interfaces might use menus or other graphical navigation. Adding a…
MicroPython: How to write and read text files on a MicroSD card using ESP32
Data logging is an integral part of many embedded projects. Typically, data logging is used to record sensor readings, with or without a timestamp. For example, many IoT applications use data logging to store network changes or data for troubleshooting or verification. The ideal way to log data locally is using an SD or MicroSD…
ESP8266/ESP32-based WiFi access point using MicroPython
Many IoT applications are controlled with the help of a webpage or an HTML website running within a Local Area Network (LAN) or Wireless Local Area Network (WLAN). Some examples of such IoT applications include home automation, office automation, and smart farming. The HTML webpage or website controlling the things is hosted on a microcomputer…
Getting started with MicroPython on ESP8266
MicroPython is an implementation of Python 3 for microcontrollers. It’s an awesome firmware that combines the powerful features of Python programming language with the low-level access of microcontrollers. Following is a list of microcontrollers supported by the MicroPython framework. Arch Mix, Actinius icarus, Arduino Nano RP2040 Connect, Arduino Primo, B_L072Z_LRWAN1, B_L475E_IOT01A, blueio_tag_evim, C3 mini, CERB40,…
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…
Using MicroPython SSD1306 driver to interface an OLED display with ESP8266 & ESP32
You’ve likely heard about SSD1306 or SSD1315 organic light-emitting diode (OLED) displays. These monochrome screens are typically in a similar price range as character displays, providing a more aesthetic appeal. More significantly, they provide a truly graphical interface for an embedded device. The OLED displays are available in ready-to-use breakout boards that can easily push…
How to use ESP8266’s sleep modes in MicroPython
Networking applications consume a lot of power. If such applications are battery-powered, there’s a risk the battery will exhaust because of the high power demands of networking functions. Frequently, power is also wasted in non-essential microcontroller activities. For example, the power might remain on for various built-in peripherals irrespective of their use or relevance in…
MicroPython – Reading analog signals in ESP8266 and ESP32
The majority of sensors have an analog output. Few sensors come with a built-in controller and can stream the output measurements over a digital protocol. That is why analog to digital conversion is one of the basic features that every microcontroller/port has. The other basic features include digital input/output, analog output, PWM generation, and serial…
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 interface a DS18B20 temperature sensor with MicroPython’s Onewire driver
The 1-Wire protocol is a proprietary standard for serial data communication from Maxim Integrated. This protocol is a low-speed, half-duplex, bidirectional, low-power master-slave data communication standard used by several devices, including temperature sensors, real-time clocks, EEPROMs, identification (intellectual property protection) devices, timers, and iButtons. There can be only one master device on a 1-wire standard…
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…
Understanding the basics of MicroPython programming
MicroPython is a software implementation of the Python 3 programming language for microcontrollers. Nearly all major microcontroller platforms are supported by MicroPython’s firmware. MicroPython eases the development of embedded systems in a couple of ways. For one, it lets users program microcontrollers and microcomputers in a common programming language (such as Python, which is currently…
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…
What is MicroPython?
MicroPython implements the Python 3 programming language for microcontrollers and microcomputers. It is a firmware solution designed to implement high-level language features of Python into low-level hardware platforms. The firmware is optimized to run in constrained environments while allowing a small subset of Python 3 standard libraries into embedded programming. MicroPython firmware can run in…