当前位置:网站首页>[flower carving experience] 14 line blank board pingpong library test external sensor module (one)
[flower carving experience] 14 line blank board pingpong library test external sensor module (one)
2022-06-30 07:59:00 【Lvyou flower carving】
1、pinpong Library is a set of software that controls the main control board of open source hardware Python library , be based on Firmata Protocol and compatibility MicroPython grammar ,5 You can use it in minutes Python Control open source hardware . With the help of pinpong library , Direct use Python Code can be used to program various common open source hardware . The principle is to burn a specific firmware for open source hardware , So that the open source hardware can communicate with the computer through the serial port , Carry out various orders .
pinpong The name of the library is given by “Pin” and “Pong” form ,“Pin” Guide foot ,“PinPong” by “ Table Tennis ” Homophony of , Refers to the reciprocation of signals .pinpong The design of the library , It is to let developers not be bound by complex hardware models in the development process , And shift the focus to the implementation of software . Even if it is used in the initial stage of programming Arduino Development , It is changed to the control board during deployment , As long as you modify the parameters of the hardware, you can run normally , Realized “ Write once and run everywhere ”.

2、pinpong Library import method
pinpong The library supports many mainboards and open source hardware , So it is divided into 3 A package ,board、extension and libs,board The package contains functions supported by the motherboard and common libraries ,extension It is a custom class master ,libs An extended library for placing other sensors in .pinpong The library supports the use of multiple master boards , Therefore, you can specify the board type and port number and generate objects , Because the line blank board is fixed as a coprocessor and the port number is fixed , Therefore, you can omit these parameters and initialize directly .
from pinpong.board import xxx #board Libraries in packages
from pinpong.libs.xxx #libs Libraries in packages
from pinpong.extension.xxx #extension The motherboard in the package
Board().begin() # initialization , Connect coprocessor , If the firmware is empty or the version is incorrect, it will be automatically burned

3、 Experimental hardware

4、9G The steering gear
It's a position ( angle ) Servo driver , It is suitable for those control systems that need to change and maintain the angle . The steering gear is mainly composed of a shell 、 Circuit board 、 Coreless motor 、 Gear and position detector . Its working principle is that the receiver or single chip microcomputer sends a signal to the steering gear , There is a reference circuit inside , The production period is 20ms, Width is 1.5ms The reference signal of , The obtained DC bias voltage is compared with the voltage of the potentiometer , Get voltage difference output . Via... On the circuit board IC Judge the direction of rotation , Then drive the coreless motor to start rotating , The power is transmitted to the swing arm through the reduction gear , At the same time, the signal is sent back by the position detector , Determine whether the location has been reached . It is suitable for those control systems that need to change and maintain the angle . When the motor speed is fixed , The potentiometer is driven to rotate by the cascade reduction gear , Make the voltage difference 0, The motor stops turning . Generally, the rotation angle range of the steering gear is 0 C to 180 degree .

PWM Relationship between signal and steering gear rotation angle
Speaking of the steering gear control signal , Generally, it is pulse width modulation (PWM) The signal , Here's the picture , It's a direct reflection of PWM Relationship between signal and steering gear rotation angle , You can also simply understand it as , Time control by energizing the steering gear , Combined with the feedback signal detection and control of the angle sensor , The precise angle control of the steering gear is realized . The control signal period of the steering gear is 20MS Pulse width modulation signal (PWM), The pulse width ranges from 0.5ms-2.5ms, The corresponding rudder position is from 0-180 degree , Change linearly . in other words , Provide certain pulse width for the steering gear , His output shaft will maintain a certain corresponding angle , No matter how the external torque changes , Know to give him another pulse signal , The output will change to the new position . There is a reference circuit inside the steering gear , The production period is 20MS, Width is 1.5MS Pulse signal of , There is a comparator , Compare the applied signal with the reference signal , Determine the direction and size , Thus, the rotation signal of the motor is generated . The steering gear is a position servo driver , The rotation range cannot exceed 180 degree , For drives that need to be constantly changing and can be maintained , Metaphorically speaking, robot joints 、 The rudder of an aircraft, etc .


【 Flower carving experience 】14 Empty board pinpong Library test external sensor module ( One of )
The line blank board tests the external sensor module ——Mind+ Code programming
Test procedure XXI : Empty board P21 Mouth control steering gear
Experimental wiring : Empty board P21 Mouth to mouth 9G Steering gear module
#【 Flower carving experience 】14 Empty board pinpong Library test external sensor module ( One of )
# The line blank board tests the external sensor module ——Mind+ Code programming
# Test procedure XXI : Empty board P21 Mouth control steering gear
# Experimental wiring : Empty board P21 Mouth to mouth 9G Steering gear module
from pinpong.extension.unihiker import *
from pinpong.board import Board,Pin
from pinpong.board import Servo
import time
Board().begin()
servo1 = Servo(Pin((Pin.P21)))
while True:
servo1.write_angle(45)
time.sleep(2)
servo1.write_angle(90)
time.sleep(2)
servo1.write_angle(180)
time.sleep(2)
servo1.write_angle(0)
time.sleep(2)
Experimental test video (29 second )
https://v.youku.com/v_show/id_XNTg4MTgyMDg0OA==.html
【 Flower carving experience 】14 Empty board pinpong Library test external sensor module ( One of )
The line blank board tests the external sensor module ——Mind+ Graphic programming
Test procedure XXII : Empty board P21 Mouth control steering gear
Experimental wiring : Empty board P21 Mouth to mouth 9G Steering gear module

Experimental serial port return

Experimental scene

5、DHT11 Temperature and humidity sensor
DHT11 It is a temperature and humidity composite sensor with calibrated digital signal output . It uses special digital module acquisition technology and temperature and humidity sensing technology , Ensure high reliability and excellent long-term stability . The sensor consists of a resistive humidity sensor and a NTC Temperature measuring element , And with a high performance 8 Bit single chip microcomputer connected . So this product has excellent quality 、 Super quick response 、 Strong anti-interference ability 、 High cost performance advantages . Every DHT11 Sensors are calibrated in a very accurate humidity calibration room . The calibration coefficients are stored in the form of a program OTP In the memory , These calibration coefficients are called in the process of signal processing inside the sensor . Single line serial interface , Make system integration easy and fast . Super small size 、 Very low power consumption , The signal transmission distance can reach 20 Meters above , Make it the best choice for all kinds of applications and even the most demanding applications . Products for 4 Single row pin package . Easy to connect , Special packaging forms can be provided according to user needs .

Module description
(1) It can detect the humidity and temperature of the surrounding environment
(2) The sensor uses DHT11
(3) Humidity measurement range :20%-95%(0 degree -50 Degree range ) Humidity measurement error :±5%
(4) Temperature measurement range :0 degree -50 degree Temperature measurement error :±2 degree
(5) Working voltage 3.3V-5V
(6) Output form Digital output
(7) There are fixing bolt holes , Easy to install
(8) Microplate PCB Size :3.2cm*1.4cm
(9) Power indicator ( Red )
(10) Each set weighs about 8g

【 Flower carving experience 】14 Empty board pinpong Library test external sensor module ( One of )
The line blank board tests the external sensor module ——Mind+ Code programming
Test procedure XXIII : Empty board P21 Mouth reading DHT11 Temperature and humidity sensor value
Experimental wiring : Empty board P21 Mouth to mouth DHT11 Temperature and humidity sensor module
#【 Flower carving experience 】14 Empty board pinpong Library test external sensor module ( One of )
# The line blank board tests the external sensor module ——Mind+ Code programming
# Test procedure XXIII : Empty board P21 Mouth reading DHT11 Temperature and humidity sensor value
# Experimental wiring : Empty board P21 Mouth to mouth DHT11 Temperature and humidity sensor module
from pinpong.extension.unihiker import *
from pinpong.board import Board,Pin
from pinpong.board import DHT11
import time
Board().begin()
print(" Empty board P21 Mouth reading DHT11 Temperature and humidity sensor value ")
DHT11 = DHT11(Pin((Pin.P21)))
while True:
print(" temperature =")
print(DHT11.temp_c())
print(" humidity =")
print(DHT11.humidity())
time.sleep(1)
Experimental serial port return

【 Flower carving experience 】14 Empty board pinpong Library test external sensor module ( One of )
The line blank board tests the external sensor module ——Mind+ Graphic programming
Test procedure XXIV : Empty board P21 Mouth reading DHT11 Value and control LED
Experimental wiring : Empty board P21 Mouth to mouth DHT11 Temperature and humidity sensor module
Empty board P22 Mouth to mouth LED modular

Experimental serial port return

Experimental scene

( To be continued )
边栏推荐
- 深度学习——循环神经网络
- July 30, 2021 [wgs/gwas] - whole genome analysis process (Part I)
- Lexicographic order -- full arrangement in bell sound
- November 16, 2021 [reading notes] - macro genome analysis process
- 深度学习——序列模型and数学符号
- Deep learning -- recurrent neural network
- Multi whale capital: report on China's education intelligent hardware industry in 2022
- 期末复习-PHP学习笔记5-PHP数组
- right four steps of SEIF SLAM
- MySQL加索引语句不加锁:ALGORITHM=INPLACE, LOCK=NONE
猜你喜欢

25岁,从天坑行业提桶跑路,在经历千辛万苦转行程序员,属于我的春天终于来了

CRM能为企业带来哪些管理提升

Personal blog one article multi post tutorial - basic usage of openwriter management tool

Research Report on search business value in the era of big search in 2022

Vulfocus entry target

为什么大学毕业了还不知道干什么?

想转行,却又不知道干什么?此文写给正在迷茫的你

Digital white paper on total cost management in chain operation industry

Tencent and Fudan University "2021-2022 yuan universe report" with 102 yuan universe collections

mysql无法连接内网的数据库
随机推荐
【花雕体验】12 搭建ESP32C3之Arduino开发环境
F12抓包用于做postman接口测试的全过程解析
NMOS model selection
你了解IP协议吗?
Permutation and combination of probability
Calculate Euler angle according to rotation matrix R yaw, pitch, roll source code
July 30, 2021 [wgs/gwas] - whole genome analysis process (Part I)
深度学习——循环神经网络
JS code case
C. Fishingprince Plays With Array
25岁,从天坑行业提桶跑路,在经历千辛万苦转行程序员,属于我的春天终于来了
Use of nested loops and output instances
Development technology sharing of Jingtan NFT digital collection system
Recurrence relation (difference equation) -- Hanoi problem
Arm debug interface (adiv5) analysis (I) introduction and implementation [continuous update]
F12 packet capture is used for the whole process analysis of postman interface test
Miracle Mu server rental selection is real and easy to use, stable and intrusion proof
December 13, 2021 [reading notes] | understanding of chain specific database building
【花雕体验】13 搭建ESP32C3之PlatformIO IDE开发环境
Want to change careers, but don't know what to do? This article is written for you who are confused