In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "how to use the MicroPython development board with Ethernet". The editor shows you the operation process through the actual case, the operation method is simple, fast and practical. I hope this article "how to use the MicroPython development board with Ethernet" can help you solve the problem.
MicroPython, which runs on micro-control, has become a very popular program language, especially in the field of microprocessors. Python can complete the single-chip microcomputer such a high real-time requirements of the development environment, Python migration is relatively easy, there are many versions.
MicroPython development board of Ethernet
PYBoardV201 is a MicroPython development board made by TurnipSmart Company on the basis of MicroPython licensed by MIT. It is based on STM32F405 single-chip microcomputer and transmits data through USB interface. The development board has built-in 4 LED lights and on-board V201 network port function, which can work normally between 3.3V-10V voltage. It can be said that this development board is not too hegemonic in terms of network stability, and other hardware resources on the board are also very rich, such as 1-wire, i2C, SPI, serial port and other interfaces. Below, we will use the functions of serial port and single-bus. Purchase address: https://item.taobao.com/item.htm?spm=686.1000925.0.0.y9nxnh&id=546026829923
Hardware introduction:
MCU (main control chip): STM32F405RGT6
ARM CORTEX-M4
Maximum running speed of MCU: 168MHz
Flash:1024KB
SD Card (maximum 8GB)
Micro USB, which can work within the 3.5V-10V voltage
2x USB 2.0
RST key: in the lower left corner of the development board
USR key: above RST key
Ethernet to serial port
LED*4 (red, yellow, green and blue from outside to inside)
An example of TPYBoardV201 temperature and humidity upload
The detection of temperature and humidity has always been uninterrupted, this time we continue to detect temperature and humidity, also using DHT11 to test. But this time, the detected temperature and humidity will not be displayed, and the alarm will not be given. This time, the detected data will be uploaded to the server through Ethernet.
First, let's talk about the devices we need:
TPYBoardV201 development board
One DHT11 temperature and humidity module
One bread board (can be omitted)
Some DuPont lines
A brief introduction to each device
The development board does not introduce too much, but mainly talks about the temperature and humidity sensor-DHT11. DHT11 digital temperature and humidity sensor is a temperature and humidity composite sensor with calibrated digital signal output. It uses dedicated digital module acquisition technology and temperature and humidity sensing technology to ensure that the product has high reliability and excellent long-term stability. The sensor includes a resistive humidity sensor and a NTC temperature measuring element, and is connected with a high-performance 8-bit single-chip microcomputer.
The required devices are introduced above, and let's talk about the environment needed for the experiment. All you need here is to be able to power the development board and to support a wired network connection (which can connect the development board to the Internet).
The following experiment begins.
one。 Follow the table below for wiring
DHT11
V201 development board
GND
GND
VCC
VIN
DATA
X8
The second is to power the development board and plug in the network cable, and see that the green light on the V201 network port lights up, indicating that it has been connected to the network.
two。 Configure V201 network port
The purpose of this step is to set the destination address, local port, baud rate, data bit, check bit and other information of the V201 network port module. For details of the configuration direction, please see: V201 network port configuration and use document.
Then let's talk about the basic logical flow:
This time, we are to upload the temperature and humidity data to the server. The first step must be to get the temperature and humidity data on the development board now. With regard to the use of DHT11, the development board provides very detailed usage and DHT11 library, so there is no more introduction here.
After we have successfully obtained the temperature and humidity, we divide the temperature and humidity data into segments. To put it bluntly, it is to separate the temperature from the humidity.
After all the data to be transmitted have been processed, the next step is to carry out the transmission. on the premise of ensuring a smooth network, set serial port 6, that is, Y1 and Y2. The specific baud rate should be determined by referring to the baud rate you previously set to the V201 network port.
What needs to be said here is that when this development board uses the Ethernet function, the three pins Y1 and Y2 are occupied, in which Y1 and Y2 are serial ports and perform communication functions.
Here we need to introduce that Y3Jing Y3 is the setting pin of V201 network port. When Y3 is not in low power level, V201 network port is in normal working state, which can be uploaded or configured through the network using setting software. When Y3 is a low power level, the V201 network port enters the serial port configuration mode, which can be configured through the serial port by using the setting software, and the data cannot be uploaded at this time.
After all the above work is completed, all that is left is to send the configured data through serial port 6.
Finally, we just need to monitor whether the data is uploaded normally.
The following is the physical picture and data monitoring screenshot of my experiment. I opened a simulation port on my computer. Although low is a little bit, the effect is the same.
Physical drawing
Data monitoring screenshot
source code
The following is the source code, shared with you.
Import pybfrom pyb import UARTfrom pyb import Pinfrom ubinascii import hexlifyfrom ubinascii import * from DHT11 import DHT11# defines the library of temperature and humidity sensors ulan = UART (6, 115200) # defines serial port My network port has set a baud rate of 115200 Kappa (while') while (K > 0): S=DHT11 () # to call the method A=S.read_temps () # of the temperature and humidity sensor. Read the value of temperature and humidity print ('aura' A) print ('ARV') print ('ARV') A [3:5]) # print temperature and humidity ulan.write ('temperature is:'+A [0:2] +'\ r\ n') # upload temperature pyb.delay (2000) # delay is to give the simulation server a reaction time ulan.write ('wet is:'+A [3:5] +'%'+'\ r\ n') # upload humidity pyb.delay (12000) about "with" This is the end of the content of how to use Taiwang's MicroPython development board. Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.