Micropython Development Board with Ethernet: TPYBoardv201 temperature and humidity upload instance

Source: Internet
Author: User

Reprint please indicate the source of the article as a link, micropythonqq Exchange Group: 157816561, public number: Micropython player

has always been about the temperature and humidity of the detection is uninterrupted, this time we continue to detect temperature and humidity, the same or use DHT11 to detect. But this time detected temperature and humidity does not show, also do not alarm, this time to the detected data through the Ethernet upload to the server up.

  First of all, the desired device:

tpyboard_v201 Development Board piece;

DHT11 temperature and humidity module one;

One of the bread plates (can be omitted);

A number of DuPont lines;

  Let's take a brief look at each device.

  tpyboard_v201 Development Board

TPYBOARD_V201 is a Micropython development Board made by Turnipsmart company based on Micropython licensed by MIT, which transmits data via USB interface on the basis of stm32f405 MCU. The board features 4 LED lights, onboard V201 network ports, which can operate between 3.3v-10v voltages. It can be said that the Development Board in the network stability is not too much, the board of other hardware resources are also very rich, like a single bus, I2C,SPI, serial interface and so on, this time we will use the serial and single-bus function.

  DHT11

The DHT11 digital temperature and humidity sensor is a temperature-humidity composite sensor with calibrated digital signal output, which uses dedicated digital module acquisition technology and temperature and humidity sensing technology to ensure high reliability and excellent long-term stability of the product. The sensor includes a resistive sensing element and an NTC temperature measurement element, and is connected to a high performance 8-bit single-chip microcomputer.

The required devices are described above, so let's take a look at the environment required for the experiment. This only needs to be able to power the development Board, and can support wired network connection (can be connected to the Development Board cable).

The following experiment begins

I. Wiring according to the table below

DHT11

V201 Development Board

GND

GND

Vcc

Vin

DATA

X8

The second is to the Development Board to power and plug in the network cable, see the V201 network port on the green light up, indicating that has been connected to the Internet.

  Two. Configure the V201 network port

This step is to set up a series of information such as the destination address, local port, baud rate, data bit, check bit, etc. of the V201 network Port module.

Then let's take a look at the basic logic flow:

1. We are to the temperature and humidity data upload Server, the first step is now the Development Board to obtain the temperature and humidity data, about the use of DHT11, the Development Board this side provides a very detailed use of the method and DHT11 library, here do not do superfluous introduction.

2. After we have successfully obtained the temperature and humidity, the temperature and humidity data are segmented, which is to put it apart.

3. Before the data to be transmitted to deal with, the next is to carry out the transmission, in order to ensure that the network unobstructed, set the serial port 6, that is, Y1 and Y2, the specific baud rate of this to refer to your front set to V201 the baud rate of the network port to be determined.

4. Here is the need to say that the development Board in the use of Ethernet functions, the y1,y2,y3 these three pins are occupied, wherein Y1 and Y2 are serial ports, to perform communication functions.

5. Here you need to introduce the Y3,Y3 is the V201 network port setting pin, when the Y3 is not low, the V201 network port is in normal operation, you can upload data, you can also use the Setup software through the network configuration. When the Y3 is low, the V201 network port enters the serial configuration mode, which can be configured by the serial port, and the data cannot be uploaded at this time.

6. After all the above work is complete, the rest is to put the configured data, through the serial port 6 sent out.

7. Finally we just need to monitor whether the data is uploaded properly.

  Physical and data graphs

Here is the physical map of my experiment and data monitoring, I was on my computer opened a simulated port, although low point, but the same effect.

Physical map

Data monitoring

  Source

Below is the source code that I do, share to everybody.

  

Import pybfrom pyb import uartfrom pyb import pinfrom ubinascii import hexlifyfrom ubinascii import *from DHT11 import DHT 11# define the temperature and humidity sensor library Ulan = UART (6, 115200) #定义串口, My network port set 115200 baud rate k=1#******************************* Main program ***************** Print (' while ') while (k>0):    s=dht11 () #调用温湿度传感器的方法    a=s.read_temps () #读取温湿度的值    Print (' A: ', a)    Print (' A: ', A[0:2])    print (' A: ', A[3:5]) #打印温湿度的值    ulan.write (' temperature is: ' +a[0:2]+ ' \ r \ n ') #上传温度    Pyb.delay (+) #做延时是为了让给模拟服务器一个反应时间    ulan.write (' wet is: ' +a[3:5]+ '% ' + ' \ r \ n ') #上传湿度    pyb.delay (12000)

  

Micropython Development Board with Ethernet: TPYBoardv201 temperature and humidity upload instance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.