Overview
This article mainly introduces
the application of
ESP-NOW technology
in the Internet of Things. ESP-NOW is a connectionless WiFi communication protocol developed by Espressif. It uses device MAC address identification and communication, and is suitable for low-power and low-latency data transmission among multiple devices.
DFRobot's Beetle ESP32 - C3 supports this technology and has advantages such as small size and low power consumption. The motion button project based on this development board has three modes: whack-a-mole, relay and pass the parcel.
Device synchronization and interaction are achieved through ESP-NOW
, demonstrating the application possibilities of this technology in games, smart homes and other fields.
The application of Internet of Things is developing rapidly, and the market needs an efficient and low-cost solution. This issue will discuss in detail the application of ESP-NOW technology in Internet of Things applications, including its technical characteristics, applicable scenarios, and how to use it to achieve efficient wireless communication between multiple devices.
In the third episode of this series, our old friend DFRobot senior engineer Xia Qing (Rockets Xia) brings you:
"In-depth Application: ESP-NOW Technology Introduction and Application"
Buy one get one free limited time offer in progress! Go to the fourth post
[Limited time offer! Countdown!]
Learn more about
the smart IoT development tool - ESP32
~
Keynote Speakers
Rockets Xia,
Senior Engineer at DFRobot, Co-founder of Mushroom Cloud Makerspace
Xia Qing is active in maker communities at home and abroad. Since 2008, he has been committed to promoting maker culture and promoting the development of the maker movement in China. In 2010, he and Chinese maker godfather Li Dawei created the first maker space in China, Xinchejian. In 2013, with the support of DFRobot and SPDR Group, he built the Mushroom Cloud Maker Space. As a co-founder of the Mushroom Cloud Maker Space, he often encourages and promotes the advancement of community maker projects. As a senior engineer at DFRobot, he is actively committed to promoting the implementation and promotion of advanced technologies such as artificial intelligence and the Internet of Things in the field of makers and maker education.
This video
This video first introduces ESP-NOW, a
connectionless WiFi communication protocol defined
by Espressif
,
similar to a low-power 2.4GHz wireless connection.
ESP-NOW requires device pairing before communication. After pairing, the connection is secure, point-to-point, and persistent, suitable for low-power, low-latency data transmission of multiple devices.
But at the same time, unlike traditional WiFi, ESP-NOW does not require a router or access point, but identifies and communicates through the device MAC address.
(Image source: DFRobot)
Next, let's take a look at
the Beetle ESP32-C3
provided by
DFRobot
. It not only supports ESP-NOW communication, but also has the advantages of low power consumption and small size.
(Image source: DFRobot)
Beetle ESP32-C3 has up to 13 I/O ports
in a coin-sized package
. The main control board also
integrates lithium battery charging management functions
and can directly connect to lithium batteries without the need for peripheral modules.
(Image source: DFRobot)
The expansion board that comes with the Beetle ESP32-C3 provides more interfaces without increasing the size,
making soldering more convenient
when making projects
. The onboard GDI display interface solves the wiring troubles when using the screen. The Beetle ESP32-C3 supports Wi-Fi and Bluetooth 5 (LE) dual-mode communication, and has a detailed example
tutorial
, through which you can easily use the wireless function of the controller and connect to the IoT platform.
(Image source:
DFRobot)
DFRobot's Beetle series development boards are known for their compact and powerful design, making them ideal for projects with limited space. Whether in terms of performance or flexibility, I believe they can perfectly meet everyone's needs.
Next, we will introduce the Sports Buttons
project
based on the Beetle ESP32-C3 development board
. The Beetle ESP32-C3 has the advantages of small size, low power consumption, support for WiFi and Bluetooth, which is very suitable for this project. The project includes 4 sports buttons, WS2812 light strips, buzzers and other components, and ESP-NOW is used to achieve synchronization and interaction between devices. The project has designed 3 game modes: whack-a-mole, relay and pass the parcel, which can be used in application scenarios such as multiplayer games or smart home control.
(Image source: DFRobot)
(Image source: DFRobot)
After the hardware is assembled, we will start programming. First, we will use the Arduino IDE to write and upload code. If you are used to using other programming environments, you can also choose the tools and codes you are familiar with. Select the sample code of ESP-NOW in Arduino to see what the capabilities of ESP-NOW are.
(Image source: DFRobot)
After uploading and burning, we can see that the delay of transmitting and receiving information is about 2~4 ms, and the delay of one-way transmission is about 2 ms, which is equivalent to 1/100 second, which is very fast.
(Image source: DFRobot)
After ensuring that each device can be recognized and communicated normally, we can proceed to the next step of function implementation. To facilitate your understanding, the program structure is organized in the form of a mind map for your reference.
(Image source: DFRobot)
Now let me briefly talk about the setting of the game rules. There are three preset modes in the existing program. You can use a short press to select, and a long press for 3 seconds to confirm the selection. When you need to switch, you can always use a long press to enter the menu.
Mode 1 is the whack-a-mole mode. In this mode, our program will randomly display red signals on the 4 sports buttons, which need to be pressed in the shortest possible time to get a score.
(Image source: DFRobot)
Mode 2 is the relay mode. In this mode, each time a green button appears on a sports button, the next sports button will turn into another color. That is to say, you need to press the buttons one by one. This is the relay mode.
(Image source: DFRobot)
Mode 3 is the pass the parcel mode. When entering this mode, the 4 buttons will light up blue in turn. Press the main button with the screen. The button that lights up blue at this time is the selected "Tianzhijiao Button".
(Image source: DFRobot)
In this project,
the button status will be synchronized to all devices in real time through ESP-NOW
, and the LED and buzzer will give corresponding feedback based on the button status. In addition, this project can also demonstrate different game modes, such as multiplayer or cooperative mode, so that everyone can see the various possibilities and interactive methods of this project in practical applications.
The motion button project can not only be used for simple games and interactions, but can also be extended to other fields, such as smart home controllers, IoT projects, etc. Welcome everyone to use your creativity to explore more possibilities of ESP-NOW and DFRobot development boards. Whether it is to improve existing projects or develop new applications, these technologies can bring you unlimited creative space.
That's all for this video. Thank you for watching. I hope you can get useful information and inspiration from it. In the next video, we will further introduce another advanced way to play with ESP32,
"ESP32 in Edge Computing Using TinyML Project"
. Welcome to follow us.
Related resources for this video:
-
DFR0868
: A control board based on the ESP32-C3 RISC-V 32-bit single-core processor chip, designed for Internet of Things (IoT) devices.
-
FIT0612
: Colorful WS2812 RGB LED Cuttable Black Light Strip.
-
DFR0032
: Gravity: Digital Buzzer Module.
-
DFR0468
: HT1632C LED Array Opto FireBeetle Platform Evaluation Expansion Board.
"Star" us to avoid missing out on new cases and industry information