aOaVWQ8Q

Curtain control based on the [LCSC-Liangshanpai Development Board]

 
Overview
I. Raindrop Detection Principle
The common working principle of raindrop sensors is to determine whether it is raining by detecting the conductivity of water droplets. It utilizes the change in conductivity between two electrodes to measure the presence of water droplets. There is an air gap between these two electrodes, which is normally an open circuit. When a water droplet comes into contact with the electrodes, the conductivity of the water droplet causes current to flow through it, forming a current loop, thereby changing the resistance between the electrodes. By measuring the change in resistance, the presence of water droplets can be determined. ![XVuY7qQLH9rRITbVLPnt6QlfSmZgNOrCZTcEaCff.png]

II. Infrared Remote Control Function
Infrared remote control is used for mode control using the NEC protocol. A complete NEC protocol transmission includes: a preamble, an 8-bit address code, an 8-bit address inverse code, an 8-bit command code, and an 8-bit command inverse code. Here we mainly explain how to receive the NEC protocol content sent by the infrared transmitter.
Preamble: Consists of a 9ms low level followed by a 4.5ms high level.
The 4-byte data consists of: address code + address inverse code + command code + command inverse code. The inverse code is used to verify whether the data transmission was correct and whether there was any packet loss.
Important: When transmitting data bits using the NEC protocol, the distinction between 0 and 1 is based on the duration of the received high and low levels. This is crucial for decoding.
Data transmission 0: 0.56ms low level + 0.56ms high level.
Data transmission 1: 0.56ms low level + 1.68ms high level.
Therefore, the complete time representation of receiving a data bit is as follows:
Data bit 0: 0.56ms low level + 0.56ms high level;
Data bit 1: 0.56ms low level + 1.68ms high level.
Important: When transmitting data bits using the NEC protocol, the distinction between 0 and 1 is based on the duration of the received high and low levels. This is crucial for decoding.
Data transmission code 0: 0.56ms low level + 0.56ms high level;
Data transmission code 1: 0.56ms low level + 1.68ms high level;
Therefore, the complete time representation of receiving a data bit is as follows:
Data bit 0 received: 0.56ms low level + 0.56ms high level;
Data bit 1 received: 0.56ms low level + 1.68ms high level;
There is also a repeat code, which consists of a 9ms low level and a 2.5ms high level. When an infrared signal is continuously transmitted, it can be transmitted quickly by sending repeat codes.
The tick here should be changed to a 1µs timer!
![Screenshot 2023-10-16 214212.png]
III. The
HLK-V20 voice control module is a high-performance, purely offline voice recognition module launched by Hailink Electronics for numerous purely offline control scenarios and products. It can be widely and quickly applied to smart homes, various smart small appliances, 86-type set-top boxes, toys, lighting fixtures, industrial applications, medical devices, IoT devices, automobiles, security and lighting, and other products requiring voice control. The HLK-V20 supports offline recognition of 150 local commands, and allows for free customization of wake-up words, command words, and response broadcast words. It also has rich peripheral interfaces. Offline voice recognition refers to the ability to recognize only fixed command words and does not require a network connection.
This case study comes from the HLK-V20 voice recognition module in section 4.13 of the module porting manual. Following the configuration process of the reference case, the voice module pin settings in this case also select B2P3 as the serial port!![Screenshot 2023-10-16 214154.png] IV. Program Description
1. ADC Acquisition
The raindrop sensor and photosensitive sensor here use an ADC to acquire changes in sensor voltage to determine the sensor status.
![1698285787255.png] The configuration of any peripheral should first configure the clock, then the working mode, etc. The clock of GD32F470 can be configured to 200M, and the maximum clock of ADC is 40M. Care needs to be taken when dividing the frequency.
![1698286129129.png] 2. Serial Port The serial
port configuration is for two reasons: to interact with the voice module and to facilitate debugging. This serial port uses DMA mode. Of course, interrupts can also be used without them. When using interrupts, care should be taken not to print data in the timer in the motor driver, as two interrupts will have an impact, causing the motor to run slowly and not stop.
![1698286302793.png] 3.
Infrared transmission time is very short, so the tick is configured to 1µs, and the high and low level times of the infrared signal are obtained to determine whether the infrared transmission is normal.
![1698286804891.png] 4. Motor drive:
The rotation of the motor is controlled by the high and low levels at different positions. Here, an array and a for loop are used to control the number of loops to make the motor rotate. A timer is used here to make the motor rotate at a regular high speed.
![1698287126209.png] V. Physical demonstration
![a2a6fd735995d03f14fa00e4cbdf847.jpg] Video: ![Uploading_daf7b76e-78d4-46da-b28c-be83f741b5a7]()
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-27 11:55:43
  • What is a patch antenna?
  • Ask a few questions about display control
  • Keil's question
  • [TI star product limited time purchase] +LAUNCHXL-CC2640R2 development board
  • I drew a package of AM3715, please help me proofread it.
  • DIY design request

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号