Z1TNK7zY

AD9834 signal generation module (DDS module)

 
Overview
This is a high-speed dual-channel DDS module based on the AD9834 chip. It features sine, triangle, and square wave outputs with adjustable frequency
 
. The two channels output waveforms with opposite phases (180° out of phase). The module uses SPI communication to control the output waveforms and frequency.
The square wave is a separate output channel for
 
sine and
 
triangle waves.
Sine wave and triangle wave demonstration.mp4
PDF_AD9834 Signal Generator Module (DDS Module).zip
Altium_AD9834 Signal Generator Module (DDS Module).zip
PADS_AD9834 Signal Generator Module (DDS Module).zip
BOM_AD9834 Signal Generator Module (DDS Module).xlsx
91880
Silergy SY8088AAC/SY8088IAAC DEMO Board
SY8088Demo Board [Verified]
A DC-DC power module based on SY8088, designed using JLCPCB EDA.
SY8088 chip basic parameters:
$qquad V_{in}=2.5Vsim5.5V $
qquad I_{Quiescent}=50mu A
$qquad I_{omax}=1 A $
qquad switching frequency 1.5MHz

The effect of 5V input is shown below
![e1ff9bc4a77b53178b30fd14980d79d4.jpg]
The inductor requirement in the BOM is 0420 integral molding (normal CNY 0.3).
Inductor addition suggestion: Yangtze Microelectronics C5832372 power inductor, which has a smaller power inductor and only costs CNY 0.23, or use 0630, which has a smaller DC resistance than 0420.

Suitable for SY8088/SY8089 or other ICs with the same pin definition. The SY8089 has a maximum output of 2A, and the chip costs approximately CNY 0.25~0.30.

LAYOUT updated on 2024/9/16.
September 22, 2024: Cover updated; copper pour under the molded inductor removed, copper area of ​​Vout increased; FB circuit and input/output capacitors now all use 0603 packages.
October 6, 2024: Via optimization.
PDF_Silicon Technologies SY8088AAC-SY8088IAAC DEMO Board.zip
Altium_Silicone SY8088AAC_SY8088IAAC DEMO board.zip
PADS_Silicon Technologies SY8088AAC_SY8088IAAC DEMO board.zip
BOM_Silicon Technologies SY8088AAC_SY8088IAAC DEMO Board.xlsx
91881
Orange Pie 3B DSI Adapter Board with External Expansion and 3.5mm Lineout
Designed for Orangepi 3b, MIPI screen model: d310t9362v1, screen initialization instructions and touch screen driver are the same as "Fat Girl Phone", backlight uses motherboard PWM11, audio is brought out from motherboard 40pin GPIO I2S1m1 series pins.
Designed for the OrangePI 3B, using the MIPI screen model d310t9362v1, the screen initialization commands and touchscreen driver are the same as those in the "Taishanpai 3.1-inch Screen Expansion Board - Integrated Power Supply, Audio, Serial Port, RTC". The backlight LED driver chip MT9201 is controlled by the motherboard's PWM11.
Connection method: DSI uses a 15-pin forward flexible cable, and GPIO uses two sets of 2x6-pin spring-loaded pins.
Audio DAC: PCM5102A. Power amplifier: LM4890S
pulls up the motherboard's GPIO pin 33 to enable the PCM5102A to output an analog signal; otherwise, it is muted.
The external speaker is 8 ohms and 1 watt, the same as the "Taishanpai 3.1-inch Screen Expansion Board - Integrated Power Supply, Audio, Serial Port, RTC". The external speaker automatically shuts off when the lineout is inserted.
The audio output is via a 40-pin GPIO from the motherboard: I2S1_LRCK_M1, I2S1_SDO_M1, I2S1_SCLK_M1, and I2S1_MCLK_M1 (I2S1_MCLK_M1 is not used by default as it is not mounted on R206). Enable these pins in the device tree as needed.
The two GPIO keys for volume +/-
referencing the device tree and the touchscreen driver are shown in the attached
video: https://www.bilibili.com/video/BV1yv19YmEiR
OP3B-D310T9362V1.zip
PDF_OrangePie 3B DSI Adapter Board with External Amplifier and 3.5mm Lineout.zip
Altium_OrangePie 3B DSI Adapter Board with External Amplifier and 3.5mm Lineout.zip
PADS_OrangePie 3B DSI Adapter Board with External Amplifier and 3.5mm Lineout.zip
BOM_OrangePie 3B DSI Adapter Board with External Amplifier and 3.5mm Lineout.xlsx
91882
Mini Type-C lithium battery charging protection module + DC-DC step-down module
This is a small Type-C charge/discharge module that supports lithium iron phosphate batteries, plus a DC-DC step-down module to 1.5V. These can be used separately.
The charge/discharge module uses a dedicated lithium iron phosphate chip, but it can also be replaced with a standard 4054 chip supporting standard 3.7V lithium batteries.
The DC-DC step-down module is a slight modification of the one described at https://oshwhub.com/jin3014/dc-dc-xiang-ya-xiao-ban-1-5v, with a more
aesthetically pleasing component arrangement. Its main feature is its small size, making it suitable for modifying lithium batteries in mice and electronic clocks. I've been using it for several months and am very satisfied. Using the DC-DC step-down module alone also provides discharge protection; the battery completely shuts off at a minimum voltage of 2.1V, whereas previously an LDO would completely discharge the battery.
PDF_Mini Type-C Lithium Battery Charging Protection Module + DC-DC Step-Down Module.zip
Altium Mini Type-C Lithium Battery Charging Protection Module + DC-DC Step-Down Module.zip
PADS Mini Type-C Lithium Battery Charging Protection Module + DC-DC Step-Down Module.zip
BOM_Mini Type-C Lithium Battery Charging Protection Module + DC-DC Step-Down Module.xlsx
91883
SkyStar-based automated test bench expansion board
Designed based on the GD32F4 SkyStar development board, it features four USB communication ports, four analog input ports, and four digital input/output ports. It can read recipe files from an SD card and execute test sequences independently of a computer, achieving automated testing. It also includes time, temperature, and humidity display and individual test functionality.
Project Overview:
In the automatic control industry, computers or industrial PCs are generally used as host computers for instrument testing and measurement control, such as digital input acquisition and output control, analog input acquisition, and USB communication. However, for simple testing and automatic control, using computers or industrial PCs for measurement and control is overkill and not conducive to cost reduction. To fully utilize hardware performance, the SkyStar system development board's GD32F407, a domestically produced microcontroller core, fully meets the needs of ordinary instrument automation testing. Based on this, the author developed an automated testing machine expansion board based on SkyStar and cleverly utilized the switch syntax in C language to develop the hardware and software for this project. LabVIEW was used for auxiliary test process monitoring, data viewing, and recipe file generation. This project is the author's original work and has not been published in any other projects. If you reprint or reference this project, please be sure to include the website link of this project. Thank you.
Project Functions:
The hardware in this project has the following individual or comprehensive testing functions, detailed below:
I. RTC Date and Time and Real-time Temperature and Humidity Monitoring Standby Display:
The hardware is powered via the USB interface of the SkyStar development board. When the upper left switch is in the bottom position, it is in standby mode. The red light on the right side of the screen is on, and the green light is off, indicating non-automatic testing. The upper right corner of the program screen displays "[Home]". The temperature and humidity data collected by the hardware via DHT11 and the date and time data from the RTC are displayed on the screen in real time, as shown in the figure below.
II. USB Serial Port Data Communication :
When the hardware is powered on and in standby mode, pressing the first button at the bottom of the screen will display the data received via USB in real time, with "[USB]" displayed in the upper right corner of the screen. Pressing the first button again ("send") will send a test string to the USB serial port. Pressing the fourth button ("back") will return to the standby interface, as shown in the figure below.
III. Four-Channel Analog Data Acquisition
: When the hardware is powered on and in standby mode, pressing the second button at the bottom of the screen will display the data from the four channels acquired by the ADS1115 module in real time, with "[ADC]" displayed in the upper right corner of the screen. Pressing the fourth button (back) again returns to the standby screen, as shown in the image below.
IV: Digital Input Acquisition and Digital Output Control.
When the hardware is powered on and in standby mode, pressing the third button at the bottom of the screen displays the high/low level status data of the four digital inputs and four digital outputs in real time. 0 represents low level, and 1 represents high level. The upper right corner of the screen displays [DIDO]. Pressing the second button (all_0) again sets all four digital outputs (DO) to low level (0). Pressing the third button (all_1) again sets all four digital outputs (DO) to high level (1). Pressing the fourth button (back) again returns to the standby screen, as shown in the image below.
V: Automated Test Recipe File Reading.
When the hardware is powered on and in standby mode, pressing the fourth button at the bottom of the screen enters the automated test interface. The red light on the right side of the screen goes out, and the green light turns on, indicating that the automated test program has started. The upper right corner of the screen displays [TEST]. The system will then read the recipe file from the SD card. If the reading is successful, it displays "Read FILE OK!" and displays the first line of the recipe file (test date and time information) in the middle of the screen. The number in the center of the bottom of the screen displays the number of bytes read from the recipe file. Pressing the first button (start) again initiates automated testing, and pressing the fourth button (back) returns to the standby screen, as shown in the image below.
Six: Automated Test Execution.
In the automated test interface, pressing the first button (start) initiates the test process. The screen displays the name of the read test item. Hardware acquisition and control are performed sequentially according to the test sequence. Acquisition and control items include USB transceiver communication, analog AI acquisition, digital input acquisition, digital output control, and test delay. The real-time test interface is shown in the image below.
After the test sequence in the recipe is completed, the screen displays "Test Finish." Pressing the fourth button (back) returns to the standby screen, as shown in the image below.
Seven: SD Card Mode
. When the switch in the upper left corner of the hardware is moved to the top, it enters SD mode. In this mode, the Skystar development board releases control of the SD card, allowing normal removal of the SD/TF card for data reading and recipe file writing. The SD mode interface is shown in the following figure:
Project Parameters
The hardware parameters of this project are as follows:

The development board is a Skystar LCSC development board with an SD card slot. The specific chip on the board is the domestic GD32F407VET6 chip;
The USB serial port chip is CH340N, which converts the microcontroller's TTL signal into a USB signal for communication with equipment, instruments, or computers;
The ADC channel uses the ADS1115 four-channel analog acquisition module, which has 16-bit precision and IIC communication features;
The DIDO digital input/output uses the microcontroller's built-in GPIO ports, with four digital inputs and four digital outputs;
Temperature and humidity acquisition uses the DHT11 module; The hardware display uses a 0.96-inch dual-color OLED screen with IIC communication;
2.54mm pin headers are reserved for CAN communication, buzzer, infrared communication, and power supply for future expansion.

Principle Analysis (Hardware Division)
The hardware module area division of this project is as follows:
The Skystar development board is used as the main controller to read the Recipe.txt recipe file stored in the SD card, and then controls the USB serial port, ADC acquisition module, digital input/output port, DHT11 temperature and humidity sensor, buttons and display screen in sequence.
The development board can control test and measurement hardware such as programmable power supplies, stepper motor controllers, and power meter data acquisition via USB serial port. It sends acquisition control commands to the USB serial port and records and parses the data returned from the serial port.
The ADC acquisition module uses the readily available ADS1115 high-precision 16-bit analog acquisition module, configured with single-ended four-channel acquisition and IIC communication. Acquisition channels are switched by sending commands. The
digital input/output ports use the GPIO ports provided by the development board, configured with four digital inputs and four digital outputs. The digital input ports can monitor switch closure signals, and the digital outputs can control actuators controlled by high and low levels, such as relays and buzzers.
The DHT11 temperature and humidity sensor uses single-wire communication; note that the DATA line needs to be pulled up.
Buttons and switches determine whether they are pressed by monitoring the port level; software delay is used to confirm button presses and reduce input signal jitter.
The display uses a 0.96-inch dual-color screen, with yellow text for the title bar and blue text for the content bar, making interaction and display convenient and aesthetically pleasing. The core code of the lower-level
machine
in this project is shown in the figure below. Each test corresponds to a numerical sequence number. After the SD card reads the recipe file, it splits the test sequence number by line, and then uses the array index of the pre-compiled test sequence to find the corresponding test sequence number. The switch conditional case branches are used to execute the test control content of the specified test sequence number in sequence. Currently, 27 sequences are specified. Sequence number 0 is a separator, generally used at the beginning and end or as a dividing line for dividing the test into several parts. The actual content is not executed: case1 to case8 are the send and receive instructions for the four USB serial ports, respectively; case9 to case20 are the four digital input acquisition instructions, the four digital output level setting instructions, and the four digital output level setting instructions; case21 to case24 are the four analog channel acquisition instructions; case25 and case26 are the instructions with delays of 100ms and 1000ms, respectively, used to perform necessary hardware test pauses during the test.
The automated testing machine expansion board in this project can run test sequences independently of a computer. However, when conditions permit, this hardware can also be connected to a computer via USB cable for necessary monitoring, data reading, and test recipe generation via a host computer.
Host Computer Auxiliary System Interface:
The image above shows the Test Monitoring tab. During testing, the expansion board sends the current test sequence number to the serial port, so the current test progress can be determined by parsing the sequence number.
The image above also shows the Host Computer Data Reading tab. This page can read test data and test recipe information from the SD card. The
image above shows the Test Recipe File Generation page. This page has multiple test buttons. Pressing the corresponding button generates the corresponding sequence in the string display control. In the real-time test recipe preview and editing, the actual recipe file content can be modified, and the string control content can be cleared or saved as a Recipe.txt file in the current folder.
The following are links to some of the code references for this project:
SD Card Read/Write:
GD32+FATFS+SDIO; OLED Video Playback Porting Troubleshooting (Bad); Apple
ADS1115 Analog Input Acquisition:
ADS1115 Multiplexer Module Porting Document
; DHT11 Temperature and Humidity Acquisition:
DHT11 Temperature and Humidity Sensor Module Porting Document;
0.96-inch IIC Screen Display:
0.96-inch IIC Monochrome Screen Module Porting Document.
Notes:

The display screen is located below an RTC battery holder, requiring a CR2032 battery to save date and time data even when power is off;
using a programmer like STLink v2 on the development board can cause insufficient power to the DHT11, resulting in incorrect data acquisition, and the SD card cannot read Recipe files correctly. Therefore, power must be supplied via the development board's Type-C port;
this hardware utilizes the chip's RTC function, so a 32.768kHz low-speed crystal oscillator needs to be soldered onto the development board.
This hardware uses an SD card slot. The ESD protection pads for the TF card next to the SD card slot must not be directly soldered or shorted, otherwise the SD card will not be readable
. The casing requires very long screws and is not stable enough; it is recommended to modify it to a sliding casing later.

Assembly Process
: This project uses a four-layer board design. The unsoldered PCB board is shown below:
Front:
Back:
During soldering, first solder the surface-mount components, such as LEDs, resistors, CH340N capacitors, and capacitors. Then solder the headers, buttons, USB sockets, battery holders, and other connectors. Headers are used here for easy removal of the development board from the board. Finally, solder the development board's headers to the display screen and ADS1115 module, inserting them into the corresponding headers.
In addition, this project also designed a corresponding 3D hardware casing, using a top and bottom casing. The actual casing image is shown below:
[Image of the actual casing] [
Image of the completed assembly can be inserted here]:
Bare machine without casing:
Finished product appearance after casing assembly:
Finally, this project inevitably has some problems; please leave comments for discussion. Thank you.
auto_test.mp4
Auto Test is an automated testing system supported by a host computer-based auxiliary system.
Automatic Test-keil lower-level machine source code.zip
PDF_SkyStar-based Automated Test Machine Expansion Board.zip
Altium_SkyStar-based Automated Test Machine Expansion Board.zip
PADS_SkyStar-based Automated Test Machine Expansion Board.zip
BOM_SkyStar-based Automated Test Machine Expansion Board.xlsx
91886
ChisFlash v1.1 Celebi Flash 1M/RTC
ChisFlash V1.1, codenamed Celebi, is designed specifically for Pokémon (RTC, crossover) and Flash native save games. It offers low cost and high reliability.

ChisFlash version introduction for supporting Flash 1M save file type:
ChisFlash V1.1 (Celebi) uses 256Mbit Flash and 1Mbit Flash to adapt GBA games with save file types such as Flash 1M and Flash 512, and supports burning to NDS and GBcartRW.
Important Notes:
When making the PCB, please ensure the thickness is 0.8mm.
Currently in beta testing, the firmware needs to be obtained from the QQ group. After beta testing, the firmware code will be open-sourced on GitHub.
Regarding firmware arrangements
 : 1. Due to rate limiting considerations, the RTC firmware is not fully open. EPM240 chips with firmware will be provided by group members at near cost price. The group has a large inventory of S-3511A RTC chips, so there's no need to worry about unscrupulous merchants inflating prices.
 2. The Flash1M firmware is in the group files, supporting a perfect save patch and crossover (FireRed and LeafGreen are available).
Regarding Flash512:
 ChisFlash's proprietary perfect save patch allows Flash1M cartridges to also support Flash512 save-type games.
Learn more about
the GitHub project address, which will include firmware source code and GBA cartridge principle analysis (to be uploaded): https://github.com/ChisBread/ChisFlash.
QQ group: 771688226.
For project progress, self-made tutorials, material pitfalls, black gold PCB material card group buying (voluntary group buying, no profit), and finished product exchange and display, please go to the QQ group.
 
Product showcase
video demonstration
[[ChisFlash] You can use a 2u gold-plated flashcart under 30 yuan? The first batch of DIY all-purpose GBA flashcarts has already left - Bilibili] https://b23.tv/K90WHhc
 
 
 
Thanks to
@mori for the excellent schematic design and layout,
@白橙 for the silkscreen design
, and all the players who selflessly contributed to the GBA, let us permanently preserve our childhood in the memories of the internet!
PDF_ChisFlash v1.1 CelebiFlash1M-RTC.zip
Altium_ChisFlash v1.1 CelebiFlash1M_RTC.zip
PADS_ChisFlash v1.1 CelebiFlash1M_RTC.zip
BOM_ChisFlash v1.1 CelebiFlash1M_RTC.xlsx
91887
Remote-controlled balance car based on LCSC Dikuoxing STM32F103C8T6 development board
Two LCSC STM32F103C8T6 development boards are used as the main controllers to remotely control the balance car, supporting both joystick and gyroscope remote control methods.
Project Overview:
This project is a remote-controlled balance car built using the LCSC STM32F103C8T6 development board. It features both joystick and gyroscope control. The components
used include an MP1584EN step-down module, a TB6612 module, a 0.96-inch OLED display, an MPU6050 module, an SR04 ultrasonic module, a joystick module, a 3V3 to 5V upgrade module, and an HC-05 Bluetooth module .
Project Functions

: Ultrasonic obstacle avoidance: Blocks forward speed when too close to an obstacle to prevent collisions.
Pick-up detection: Automatically detects when the car is picked up and disables balance.
Placement detection: Enables balance when the car is placed down and pushed forward.
Joystick and Gyroscope Control: Supports both joystick and gyroscope remote control modes.
8b9bf7804c3805861ced087066ec3280.mp4
5cef51c81a5d020af0f31b1e6594724a.mp4
7c06c101116d2b452c9fa4ea177d632c.mp4
Code and Acrylic Sheet.zip
PDF_Remote-controlled self-balancing car based on LCSC STM32F103C8T6 development board.zip
Altium-based remote-controlled self-balancing car using the LCSC STM32F103C8T6 development board.zip
PADS Remote Control Balance Car Based on LCSC STM32F103C8T6 Development Board.zip
BOM_Remote-controlled self-balancing car based on LCSC STM32F103C8T6 development board.xlsx
91888
Color silkscreen STM32F412 development board
An STM32F412 development board integrating an 8-bit interface screen with automatic download, an XPT2046 display, two microphones, a nine-axis ICM42688+LIS2MDLTR, a BH1730 light sensor, an AHT40 high-precision temperature and humidity sensor, and an LPS22HHTR barometer.
Project Introduction :
A high school student (actually, it was during the summer vacation after junior high) created an STM32F412RET6TR development board.
As of October 7, 2024, all onboard sensors have been verified, and all circuit issues have been fixed.

STM32F412RET6TR Overview
: Execution speed: Up to 100 MHz;
Internal memory: 512kbyte flash memory, 256kbyte SRAM;
DMIPS/MHz: 1.25 DMIPS/MHz.
Learn more:

Four-wire SD card slot;
Class 10 SD card write speed of 12.4MB/s in four-wire mode .
Project Features
: Integrated high-speed automatic download debugger;
High-speed downloader borrowed
from the CH32V305-based high-speed DAP-LINK design;
Supports up to 4M serial port transmission; SWD clock supports up to 10MHz;
Very fast, meeting the download requirements of 512kbyte flash memory;
8-bit interface; Screen : Supports 800*480
resolution.
It features an 8080 parallel port, supports both RGB565 and RGB888 displays, an
onboard XPT2046 touch chip,
two MSM261S4030H0R microphones
for excellent
recording (16-bit 44.1kHz audio quality far surpasses that of mobile phones – no exaggeration!), and supports up to 24-bit audio. It also boasts
a powerful motion sensor
(ICM42688), a three-axis gyroscope + three-axis accelerometer
(LIS2MDLTR), and a three-axis magnetometer for
high precision and ultra-low power consumption
. Official data shows power consumption of 200 µA in high-resolution mode and no more than 50 µA in low-power mode (at 20...). (Hz output data rate)
Sensor
light sensor BH1730
high-precision temperature and humidity sensor AHT40
barometer LPS22HHTR
principle analysis (hardware description)
This project consists of the following parts: power supply section, main control section. The power
supply interface uses TYPE-C-16P interface as the power supply interface.
It connects to SC662K-3.3V to power the downloader.
It connects to TLV62569DBVR to power the main control, microphone, screen, and XPT2046.
The 3.3V generated by TLV62569DBVR powers LP5907MFX-3.0 to generate 3V to power the sensors.
5.1K pull-down resistors have been added to the CC1 and CC2 pins to facilitate identification and configuration by different hosts.
The SC662K-3.3V can be replaced with XC6206-332, etc.
The TLV62569DBVR can be replaced with TLV62568DBVR.
The download circuit design uses a
CH32V305FBP6
with a switch to control the operation of the download circuit (power saving).
The crystal oscillator must be 12MHz. Because the software is not written by me but comes from CV,
I directly followed the method in the high-speed DAP-LINK based on CH32V305 to download the program.
The main control circuit design
uses an STM32F412RET6, which can be replaced with
an STM32F413RET6 . The
STM32F412RGT6
crystal oscillator has no mandatory requirement; 8 to 25MHz is acceptable.
32.768kHz is optional.
The board has 38 pins;
the remaining pins can be converted from a 40-pin 0.5mm to a 40-pin 2.54mm pin. The TH
software code
uses HAL and CUBEMX for development.
Hardware I2C doesn't work, but the software does (
see attached file for details ; the code
is poorly written but will be gradually optimized)
. Note:

Sliding the switch up or down does not affect the main controller's operation.
90% of problems are due to improper soldering.
To connect
an SD card to the FPC socket, you need to initialize it with one wire first, then switch to four-wire mode.

Assembly process
suggestion: open the stencil and bake on a hot plate.
Actual product photos
are available.
stm32f412RETX.7z
PDF_Color Silkscreen STM32F412 Development Board.zip
Altium_color silkscreened STM32F412 development board.zip
PADS_Color Silkscreen STM32F412 Development Board.zip
BOM_Color Silkscreen STM32F412 Development Board.xlsx
91889
Network-connected solar water heater controller
A network-connected solar water heater controller
with a corresponding WeChat mini-program: That Year, That Month, That Day
I. Video Link:
Bilibili Video - Function Demonstration and Introduction Collection
II. Project Introduction The
network-connected solar water heater controller
mainly solves two problems
: 1. The problem of high power consumption of traditional solar water heaters in winter.
The control logic of traditional solar water heater controllers is as follows: At two fixed times each day, the current water temperature is checked to see if it is lower than the set value. If it is lower, electric heating is started and stopped when the set value is reached. In summer, solar energy is abundant, and electric heating is basically not needed, resulting in very low power consumption. However, in winter, solar energy is scarce, and the solar water heater tank is outdoors with poor insulation, so it basically heats up twice a day, resulting in very high power consumption. However, the water demand is lower in winter, which leads to energy waste.
The current control logic involves making reservations via a WeChat mini-program. If hot water is needed, a reservation is made through the mini-program. The controller then determines the current water temperature n hours before the scheduled time (n can be modified via the mini-program) and decides whether to use electric heating.
Some may find this inconvenient, as having to make reservations every time is too troublesome. Indeed, I also find it inconvenient. However, considering my family's situation—we're not often home—this reservation mechanism is quite suitable for our circumstances.
2. Stainless Steel Water Tower Water Level Detection and Control:
The solar water heater controller has a reserved interface for a water tower water level detection module. The solar water heater is installed on the top floor, and the tap water pressure is insufficient, so a stainless steel water tower was added as the source of water for the solar water heater during the summer. Normally, water is pumped from the first floor into this water tower to maintain the required level. Water supply for solar water heaters; stainless steel water towers often experience over-discharge and over-charge without a water level sensor, which is very inconvenient. Therefore, it is very necessary to add a water level detection function to the stainless steel water tower.
III. Introduction to each board in the project
(1). Water tower water supply control board:
installed next to the water pump that supplies water to the stainless steel water tower, it can display the water volume of the stainless steel water tower, the water volume of the solar water heater tank, the water temperature of the solar water heater tank, the electric heating status of the solar water heater, the water supply status of the solar water heater, and can control the water pump to pump water to the stainless steel water tower (pump water according to the target time or target water volume), turn off the electric heating of the solar water heater, and turn off the water supply of the solar water heater; the appearance after installation is as follows:
when the water volume of the water tower is lower than 8%, the buzzer will sound an alarm (once every 10 minutes), and the brightness of the digital tube is controlled by the photoresistor.
Regarding the circuit of this board, the initial idea was to make it a universal board for all modules, with each module using this circuit board. Therefore, some explanations were made on the schematic. Later, to perfect the project, this idea was abandoned.
One aspect of the board's circuitry that can be discussed is the button expansion. The schematic is as follows:
A BAT54C with three GIO pins is used to implement 7 button detections . The original
intention was to use one board for multiple purposes, so GPIO was insufficient, hence
this method. Module usage instructions (for my own reference only, in case I forget): Upon

power-up, the module displays the water level of the stainless steel water tank by default. When the water level drops below 8%, a buzzer sounds every 10 minutes. The six buttons arranged side-by-side, from left to right, are S1, S2, S3, S4, S5, and S6. The single button on the top is S0, which stops the water supply to the stainless steel water tank.
A short press of S1 will cause the digital display to flash "20." Pressing S1 again during this flashing process will start pumping water into the tank until the water level reaches 20%. If no action is taken during the flashing process, the display will return to normal after 5 seconds.
A short press of S2 will cause the digital display to flash "40." Pressing S2 again during this flashing process will start pumping water into the tank until the water level reaches 40%. If no action is taken during this flashing process, the display will return to normal after 5 seconds.
Short presses of S3, S4, S5, and S6 function as above, representing 50%, 70%, 80%, and 100% respectively.
The selected value can be changed by short-pressing other buttons while the digital display is flashing.
The above describes pumping water according to a target water volume. In addition, water can also be pumped according to a target time, such as stopping after 10 minutes. The switch between pumping according to target water volume and pumping according to target time is S6. Press and hold S6 (if the digital display is flashing, a long press has no effect) for 2.2 seconds until the buzzer sounds once, indicating a successful switch. After switching from pumping according to target water volume to pumping according to target time,
briefly press S1. The digital display will flash "10". While the display is flashing, press S1 again to start pumping water into the stainless steel water tower. Pumping will stop after 10 minutes. If no operation is performed during the flashing process, it will return to normal after 5 seconds.
A short press of S2 will cause the digital display to flash "15". Pressing S2 again during this flashing process will start pumping water into the stainless steel water tower, continuing for 15 minutes. If no operation is performed during this flashing process, it will return to normal after 5 seconds.
Short presses of S3, S4, S5, and S6 function as above, representing 20 minutes, 25 minutes, 30 minutes, and 35 minutes respectively.
Similarly, the selected value can be changed by short-pressing other buttons during the flashing display.
Regardless of the pumping method, pumping will immediately stop when the water tower reaches 100% capacity or when there is no water in the tank (the water source for the pump is a float switch that detects water availability).
Press and hold S1 (if the digital display is flashing, pressing and holding has no effect) for 2.2 seconds until the buzzer sounds once. The digital display will then show the water temperature inside the solar water heater. After releasing the button, it will return to its original state (showing the water level in the water tank). If you continue to hold the button for 5 seconds after pressing and holding it for 2.2 seconds, the buzzer will sound again, and then a command will be sent to the solar water heater control module to turn off the electric heating of the solar water heater.
Press and hold S2 (if the digital display is flashing, pressing and holding has no effect) for 2.2 seconds until the buzzer sounds once. The digital display will then show the water level inside the solar water heater. After releasing the button, it will return to its original state (showing the water level in the water tank). If you continue to hold the button for 5 seconds after pressing and holding it for 2.2 seconds, the buzzer will sound again, and then a command will be sent to the solar water heater control module to close the solenoid valve for water inlet to the solar water heater.
This module has two LEDs (circled in the actual picture), one pink and one blue, representing the water inlet status and the electric heating status of the solar water heater, respectively.

(2). Water Tower Water Quantity Measurement - Motor Schematic
: The schematic is straightforward, consisting of a motor driver, an RS232 converter, an AT24C02 microcontroller, and a single-chip microcomputer.
Water level measurement principle:
1. When water is added, the water level rises, the float switch touches the water, and the encoder motor controls the turntable to retract the float switch upwards until it leaves the water, repeating this cycle.
2. When no water is added, the water volume in the tower decreases with domestic water usage, the water level drops, the float switch leaves the water, and the encoder motor controls the turntable to lower the float switch downwards until it touches the water, repeating this cycle.
3. Once the water level changes, the current encoder value is immediately recorded and saved to the EEPROM. Combined with certain logic (each time power is applied, if the float switch touches the water, it rises to leave the water; if it doesn't touch the water, it falls to touch the water; simultaneously, the encoder value in the EEPROM is read, and the value of the encoder timer register is calculated), it can accurately measure the water level after power failure and upon power-up.
(Bilibili video - Introduction to Water Tower Water Quantity Measurement Principle)
The water tower water level detection module can be used independently in other places without this system. It uses RS232 bus communication with a baud rate of 9600. Upon receiving the following data, it will return the current water level (0~100), module MCU temperature, and fault information:



Receive








0xDD
0xBB
Water supply/use
reset fault
checksum.



Here, "Water supply/use" is 0x2 representing water supply mode and 0x0 representing use mode. "Reset fault" is 0x1 representing a reset sensor fault. A sensor fault occurs when the safety float switch is triggered, but the water level measured by the encoder motor is not 100, which will generate a fault message. The checksum is: ("Water supply/use" + "Reset fault")%256.
The format of the returned data is:
| Return | | | | |
| | --- | --- | --- | --- | --- | --- |
| 0xEE | 0xAA |Water volume (0~100)|Fault information|MCU temperature|Checksum|
The checksum is: ("Water volume" + "Fault information" + "MCU temperature")%256.
The water tower water supply control module needs to be calibrated once before use. The calibration method is as follows:
Turn off the power to the module, manually rotate the rope reel to retract the rope to the position you think represents 100% of the water tower water volume (below the position of the safety float switch), then press and hold the calibration button and turn on the power again. After turning on the power, release the button, and the rope will automatically drop down to the position you think represents 0% of the water tower water volume. Then press the button again to complete the calibration. During the calibration process, it is best not to have water in the water tower. After calibration, power it on again and it will be usable normally.
This is what it looks like after installation.
Bilibili video -- Water tower water volume measurement module working demonstration
Bilibili video -- Water tower water volume measurement module installation
(3).
The schematic diagram of the solar water heater control board is too conservative (too many materials are used), mainly reflected in the drive of the solenoid valve and relay and the power supply part; the power supply part uses two Hailingke HLK-10M12 modules, with a total power of up to 20w. It is very cheap to buy it on Taobao (purchase with sign-in coupon).
Use ready-made AC-DC power modules, and focus on leaving professional things to professionals, saving time, effort and worry (actually, it is just that I don't know how to use power supply~).
One 12V 10w power supply to the board, and the other 12V 10w power supply to the solenoid valve (3.6w) and RS232, that is, the RS232 interface has a power supply capacity of 6.4w.
12V is supplied to the main controller, LoRa module, and MAX232 via three LDOs.
(Bilibili video - Control Module Introduction)
The difficulty in the solar water heater control module program is driving the four-wire solar water heater sensor. The driving method will be explained later.
(
4) The two discs PCB7 and PCB8
are used to make a winding wheel with the smart car wheel
. (5) The relay module (not used in the project)
consists of a LoRa module (HC-14) and an ESP8266. It is best to power the LoRa module separately.
The circuit part is very simple. The first version of the relay module is used directly, so the second version does not have the relay module circuit.
[ESP12F Relay Module] https://www.bilibili.com/video/BV1xaxjejEZL/?share_source=copy_web&vd_source=68337adbea96c8cef50403a4b2809df6
IV. Software Part
(1). Design of Inter-Module Communication Protocol
In my opinion, for projects with multiple modules communicating, before writing the program (you can write the driver part first), you should first clarify the requirements, figure out what data needs to be transmitted between each module, fully consider the requirements, and then design the communication protocol between each module. Write it into a document or a table, and then start writing the program. At this time, as long as you write the code according to your communication protocol, the efficiency will be much higher, and you can better deal with subsequent problems or add new functions. The screenshot of the communication protocol of this project is as follows, and I will not show the details.
The communication block diagram of this project is as follows
. Note: The relay module, solar water heater control module, and water tower water supply module all transmit data through the nodeless LoRa module. That is, if one party sends data, the other two parties can receive it. This needs to be considered in the program design. In addition, if one party is sending data and the other party also starts sending data, it will cause the LoRa module communication failure. Therefore, this problem should be avoided when designing the communication protocol (two modules cannot send data at the same time at any time). In addition, the transmitted data frame must be equipped with a check code, and important instructions need to be accompanied by an acknowledgment mechanism.
(2). Watchdog
When doing a real project, as long as the microcontroller has a watchdog, it must be used! In applications with more complex logic, it can avoid unexpected logic bugs; at the same time, it can also enhance the product's temperature performance in harsh environments.
(3). The four-wire solar water heater sensor
is essentially a variable resistor. The microcontroller's ADC collects the voltage and converts it into the target value we need. It should be noted that the target voltage after voltage division should be followed by a voltage follower before being input to the microcontroller's ADC. This is because the sensor has a large resistance. If it is directly connected, due to the impedance at the ADC input, it may form a parallel relationship with the external voltage divider resistor, resulting in the actual voltage division value not matching the theoretical value, thus affecting the acquisition accuracy. In addition, for systems that need to operate at high temperatures for a long time, it is best to add a clamping diode to the ADC pin.
Difficulty: How to convert the ADC value into the target value we need; Taobao sellers of this type of sensor basically do not provide useful data, and there is very little information online, so it is almost impossible to find. Therefore, if we want to use this type of sensor, we must measure the data and calibrate it ourselves.
Water level sensor (red and blue lines):
The microcontroller collects the ADC value of the water level sensor at a period of 400ms and outputs it to the serial port assistant. At the same time, the water level sensor is slowly placed in the water until it is completely submerged, and then slowly taken out. Then the data received by the serial port assistant is imported into Excel and a curve of the data is plotted.
After multiple measurements, and by changing the temperature, water quality, and container, all the data curves were obtained, as shown below:
Different colored curves represent different environments. The curves show a five-segment trend under various conditions. We then identified the thresholds between different segments on the curves (each segment must be a different colored curve). By comparing the measured ADC value with these four thresholds (there are only four thresholds for five segments), we can determine the current water level. We define these five segments as 0%, 20%, 50%, 80%, and 100% of the water volume (this is how the original controller defined it). This gives us the water volume in the solar water heater tank.
Water temperature sensor (white-green line):
First, we collected the ADC value of the temperature sensor and observed that it is a positive temperature coefficient resistor. However, the resistance value does not conform to common thermistors such as PT100 and PT1000. Fortunately, our requirements for water temperature accuracy are not high, so we can use a sensor that can accurately measure temperature to calibrate this water temperature sensor. The temperature sensor I used here for calibration is a 10K B3950. NTC thermistor (negative temperature coefficient);
First, put the water temperature sensor and NTC thermistor into the electric kettle. Then, the microcontroller outputs the temperature measured by the NTC thermistor and the original ADC value of the water temperature sensor collected by the ADC through the serial port, as shown below:
The first data is the temperature measured by the NTC thermistor, the second is the original ADC value of the water temperature sensor, and the third is the ADC value of the water volume sensor.
Then start heating the electric kettle until the NTC thermistor outputs 76 degrees. In this way, we get the original ADC value of the water temperature sensor at different temperatures. Then import these two sets of values ​​into a linear regression analysis website, as shown below:
As can be seen from the figure, all the data basically fall on a straight line. The data is very linear. Based on the linear function calculated by the website, we can calculate the approximate real temperature using the original ADC value of the water temperature sensor. The calculation relationship is as follows
(4). Data storage
does not use a database. The appointment event, the historical water temperature of the last 24 hours, the historical water volume of the last 24 hours, the running mode, the threshold temperature, and the execution advance data are all stored in the relay module; the user information is stored in the code of the WeChat mini program constant (only 7 users).
V. WeChat Mini
Program Name: That Year, That Month, That Day 9
Don't ask why I chose this name; all the names related to solar water heaters are already taken.
The mini program requires a key verification before it can control my home devices. Why use this primitive verification method instead of one-click verification of user information using a phone number? Because WeChat's official review process is very strict regarding anything involving user privacy. As an individual developer with no qualifications to guarantee this, I shouldn't even think about obtaining users' phone numbers. Some might ask, why is verification required? Because WeChat mini programs are open; anyone can use them. If verification wasn't needed, wouldn't everyone be able to control my home devices at will?
The WeChat mini program has four
operation pages:
Real-time data page,
Historical data page, and
Extended page.
At first glance, it may seem complicated, but most functions and data do not require attention. Only two require human intervention: one is to add water to the stainless steel water tower, and the other is to schedule events. The solar water tank will automatically add water (when the water level in the stainless steel water tower is greater than 8%, it will automatically add water to 100% at 1:00 AM every day). The solar electric heating will decide whether to turn on the electric heating based on the scheduled events, real-time temperature, and execution advance.
Different users use different keys for verification. The WeChat Mini Program distinguishes different users based on the entered key. Each user corresponds to a device in the Alibaba Cloud public instance, as shown below:
The viewing method for appointment events is as follows:
An appointment event consists of the user name + specific date and time + water temperature. Each appointment event is automatically deleted after execution. A maximum of 50 appointment events can exist. Users cannot delete other users' appointment events. When the Mini Program adds or deletes an appointment event, the data format sent to the relay module is as follows:
The format of the appointment data reported by the relay module to the Mini Program client is as follows:
The data source code of the appointment data reported by the relay module to the Mini Program client is as follows:
void yy_event_updata(){
mqtt_tbuff[0] = 0x95;//The appointment event is updated
mqtt_tbuff[1] = yy_event_num+1;//Total number of events, must be +1 for processing!
uint8_t con = 0;
for(uint8_t i=0;i<50;i++){
if(yy_event_list[i].xh!=0xFA){//Indicates this position is a valid reservation event
mqtt_tbuff[2+con*7] = yy_event_list[i].xh+1;//Increment the sequence number by 1
mqtt_tbuff[4+con*7] = ((yy_event_list[i].time&0xFF000000)>>24);//The first byte from the left of the timestamp
mqtt_tbuff[5+con*7] = ((yy_event_list[i].time&0xFF0000)>>16);//The second byte from the left of the timestamp
mqtt_tbuff[6+con*7] = ((yy_event_list[i].time&0xFF00)>>8);//The 3rd byte from the left of the timestamp
mqtt_tbuff[7+con*7] = (yy_event_list[i].time&0xFF);//The 4th byte from the left of the timestamp
//Change the +1 processing, because for the timestamp, it is possible that a byte is exactly 255, and +1 will just return to 0. This +1 method cannot solve the problem, so add a separate byte to record whether it is 0.
The lower 4 bits of this byte record whether the four bytes of the timestamp are 0, and the highest bit 1 is to ensure that this byte is not 0
mqtt_tbuff[3+con*7] = 0x80;//Ensure that this byte is not 0
for(uint8_t t=0;t<4;t++)//Traverse the four timestamp bytes and see if there is a byte that is 0
if(mqtt_tbuff[4+con*7 + t]==0){
// Ensure the sent value is not 0. This byte of timestamp data is no longer needed. The mini-program detects that the t-th bit on the right of `mqtt_tbuff[3+con*7]` is 1, so it directly treats this byte as 0.
`mqtt_tbuff[4+con*7 + t]+=1;
` `mqtt_tbuff[3+con*7] += 0x01<<(3-t);` // Tell the mini-program that this byte of timestamp data is 0.
} `
mqtt_tbuff[8+con*7] = yy_event_list[i].temp;` // This is the actual temperature, ranging from 40 to 80, so no need to add 1. `
con++;
`
} `
mqtt_tbuff[8+con*6] = 0;` // Add 0 at the end.
`logln(con);` `logln(yy_event_num);` `
pubMQTTmsg((char*)mqtt_tbuff);`

The source code for parsing the appointment event sent by the relay module in the mini program client is as follows: }
else if(payload[0]==0x95){//appointment event
var str = ''//'Xuhua 2024-02-13 10:00 40℃'
this.globalData.yuyueshijian_data=[]//clear the original appointment event
for(i=0;i<(payload[1]-1);i++){//total number of events, which was sent by +1 over there, to prevent 0
str=this.globalData.u_n_font[payload[i*7+2]-1]//the sequence number was also sent by +1
let sjc = 0;
if((payload[i*7+3]&(0x08))!=0)sjc=0;
else sjc=payload[i*7+4]<<24;
if ((payload[i*7+3]&(0x04))!=0)sjc+=0;
else sjc+=payload[i*7+5]<<16;
if ((payload[i*7+3]&(0x02))!=0)sjc+=0;
else sjc+=payload[i*7+6]<<8
if ((payload[i*7+3]&(0x01))!=0)sjc+=0;
else sjc+=payload[i*7+7];
let dt = new Date(sjc*1000)//The unit passed in here should be ms
if ((dt.getMonth()+1)<10)
str +=' '+dt.getFullYear().toString()+'-0'+(dt.getMonth()+1).toString()+'-'
else
str +=' '+dt.getFullYear().toString()+'-'+(dt.getMonth()+1).toString()+'-'
if(dt.getDate()<10)str += '0'+dt.getDate().toString()
else str += dt.getDate().toString()
if(dt.getHours()<10)str +=' 0'+dt.getHours().toString()+':'
else str +=' ' +dt.getHours().toString()+':'
if(dt.getMinutes()<10)str += '0'+dt.getMinutes().toString()
else str += dt.getMinutes().toString()
str += ' '+payload[i*7+8]+'℃'//This is the real temperature, ranging from 40 to 80
this.globalData.yuyueshijian_data=this.globalData.yuyueshijian_data.concat(str)
}
if(this.globalData.esp_ack_enable)this.globalData.esp_ack = 2 // Relay execution complete response
console.log("Received appointment event")
}
The relay module reports appointment events, and the WeChat mini program parses appointment events according to the specified protocol. Therefore, as long as the communication protocol is designed well, the code part is very simple.
In WeChat Mini Programs, during user verification, if successful, the following messages will appear sequentially: "Verification successful" -> "MQTT connection in progress..." -> "Waiting for relay response" -> "Data acquisition successful". If the network is stable, the entire process should take no more than 3 seconds.
If no data is received from the relay module, a dialog box will pop up to prompt the user.
All operations will have dialog boxes to ask the user again whether they are sure they want to execute the operation
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-27 02:45:37

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号