The ESP8266 is an excellent piece of hardware for designing simple IoT projects. We posted a getting started guide a while back, so please refer to it. So you’ve setup your ESP8266 and connected it to your home WiFi and wants to transfer information to and from your ESP8266? This post will provide a concise tutorial on ESP8266 Data Transfer using UDP protocol. We will show how to send a message to the ESP8266 from a Windows 10 PC and get an “Acknowledgement” reply from the ESP8266.
ESP8266 “IoTBear” Breakout Board
The ESP8622 is a tiny little piece of hardware that makes it convenient for compact projects but its tiny size makes it troublesome for programming and connecting to other physical things. To make it easier for connections, there are many breakout boards that you can buy from places like eBay and they come in many forms. While looking for one, we stumbled across one breakout board that seems to come with a lot more features such as an on-board voltage regulator, a reset button and connections for the FTDI. The breakout board is called “IoTBear” and it is sold by majikthi5e on eBay. The breakout board supports ESP-07 upwards. It is well constructed and it comes with a lot of information:
Soldering your ESP8266 to the breakout board is fairly straightforward and you are ready to connect your FTDI and start programming:
This is by far the most impressive breakout board for the ESP8266 that we have ever used!
Follow the steps in our getting-started guide to connect the ESP8266 board to your FTDI. The information provided with the IoTBear breakout board also shows how to program your ESP8266.
ESP8266 DATA TRANSFER USING UDP
For this project, we wanted to transfer data from sources such as a PC or a Raspberry Pi to the ESP8266 using UDP protocol. The data can be information or something more substantial, such as commands to control the ESP8266’s GPIOs.
We accumulated a few code examples from various sources and came up with a simple code that sends a ASCII text to the ESP8266 from a PC and then an Acknowledgement is sent back to the PC. The code can be downloaded here and compiled with the Arduino compiler. This code simply sends “BehindTheSciences.com” to the ESP8266 using UDP. The data is then displayed on the serial monitor. The code can be easily changed to do more complex task of course.
Once you have added your router details in the code, upload it to the ESP8266 and wait for to connect to your router. Find the IP of the ESP8266 by logging into your router, you will need to know its IP address to send UDP packets to it. To send UDP packets from the PC, we are using Packet Sender.
Here is a quick demo of data being sent to the ESP8266 using Packet Sender on the PC:
The code provided here is a two way UDP communication. A reply is sent by the ESP8266 to the PC for any UDP packet sent from the PC. The acknowledgement packet from the ESP8266 to the PC can be replaced with a sensor data for example and can be made more responsive to specific UDP commands sent from the PC.
In our next post, we will show how to send temperature data from a DS18d20 connected to the ESP8266 to a PC.
If you have any comments or suggestions, please send us an email at firstname.lastname@example.org
Which a. viagra malaysia C3-c8 likely injured by the authors.