#9th LCSC Electronics Design Contest# - Temperature and Humidity Detector Training Camp
1. Project Introduction
The main function of a simple temperature and humidity detector is to measure and display the current ambient temperature and humidity in real time and accurately, helping people understand and monitor environmental conditions, and thus make corresponding environmental adjustments as needed.
The desktop temperature and humidity meter project uses the STM32G030K6T6 chip as the main control chip. The

STM32G030x6/x8 mainstream microcontroller is based on a high-performance Arm® Cortex®-M0+ 32-bit RISC core with an operating frequency of up to 64 MHz. This series of microcontrollers has high integration, suitable for various applications in consumer, industrial, and home appliance fields, and can also fully meet the needs of IoT solutions.
These devices integrate a memory protection unit (MPU), high-speed embedded memory (8 KB SRAM and up to 64 KB Flash program memory with read/write protection), DMA, rich system functions, enhanced I/O, and peripherals. They provide multiple standard communication interfaces (2 I2C, 2 SPI/1 I2S, and 2 USART), a 12-bit ADC with up to 19 channels (2.5 Msps), a low-power RTC, advanced control PWM timers, four general-purpose 16-bit timers, two watchdog timers, and one SysTick system timer.
They operate in ambient temperatures from -40 °C to 85 °C and with supply voltages from 2.0 V to 3.6 V. Optimized dynamic power consumption combined with power-saving modes easily enables low-power application designs.
The VBAT direct battery input allows for continuous power supply to the RTC and backup registers.

2. Project Design
2.1 Schematic Design
The sensor used in this design is the Sensirion SHT40 temperature and humidity sensor module. This

±1.8% / max. ±3.5% RH digital temperature and humidity sensor
conforms to the industry-proven Sensirion SHT40 temperature and humidity sensor, offering excellent cost-effectiveness. It uses tape and roll packaging and standard SMD assembly technology, making it ideal for high-volume applications.
The SHT40 is based on a newly optimized CMOSens® chip, featuring lower power consumption and optimized accuracy specifications. Its extended supply voltage range from 1.08 V to 3.6 V makes it ideal for mobile and battery-powered applications. Its small size and rugged DFN housing allow for integration into challenging designs while meeting high reliability requirements, as demonstrated by its JEDEC JESD47 certification. Furthermore, the SHT40 complies with healthy building standards such as RESET® and WELL Building Standard™. In a desktop
thermo-hygrometer,
an SHT40 temperature and humidity sensor module is used to detect temperature and humidity. The SHT40 uses IIC for communication; resistors R8 and R9 on the module are pull-up resistors for IIC communication, acting as a "wired-AND" connection, supporting the connection of multiple devices.

IIC Introduction:
IIC is a two-wire bidirectional synchronous serial bus protocol. Bidirectional means that both communicating parties can send and receive data; synchronous means that both communicating parties have the same clock pulse (SCL line).
In IIC, devices are divided into master and slave devices. Generally speaking, the device that controls the clock line is the master device.
Each IIC device has a device address, which is used to identify multiple devices when they are communicating.
IIC is half-duplex communication, supporting only unidirectional communication (only one data line) at a time.
The IIC pins of a microcontroller are usually set to open-drain output, and a high level is output through an external pull-up resistor. The advantage of this is to prevent signal confusion when multiple devices are communicating.
The entire IIC communication process mainly includes the following steps:
master start timing;
master address sending timing;
master waiting for slave response timing;
master sending read/write data timing;
master waiting for slave response timing;
stop timing;
master control circuit

crystal oscillator circuit

tri-state output 8-bit shift register

SWD download debugging interface

common cathode 3-digit digital tube (displaying temperature and humidity)

two AA battery box + reverse connection protection

wake-up button

test LED

fixing hole

2.2 PCB design
PCB design can be learned and explained in detail on Bilibili - LCSC EDA official account
(freebie monster's daily life - has been upgraded to coin-operated version, doge head for protection)

PCB top layer design

PCB bottom layer design

3D preview effect (black solder mask with immersion gold process looks great)


2.3 3D shell design (first simple design - drill positioning holes, convenient and quick, then import into UG for secondary design)
LCSC EDA professional version supports simple 3D shell design, making it convenient for users to quickly draw and manufacture a simple shell.
If the simple 3D shell design in JLCPCB EDA doesn't meet your needs, you can export the 3D shell in STEP or OBJ format and continue designing in other professional 3D design tools. A
simple

secondary design was added (a bottom cover was added to clamp the PCB; magnets can be added for a magnetic back cover, facilitating battery replacement).
3D printing can be done at JLCPCB's subsidiary, 3D Monkey (the 3D shell has been shared in the attachment).
You can also purchase it yourself.
3. Physical demonstration (Xiaomi's rainbow battery is a perfect match).



The temperature and humidity detector is finally complete!
Finally, heartfelt thanks to JLCPCB and Sensirion for their strong support!