1. Blog>
  2. Temperature & Humidity Control Unit Using a Raspberry Pi Pico

Temperature & Humidity Control Unit Using a Raspberry Pi Pico

by: Aug 31,2022 10917 Views 2 Comments Posted in Technology

pic;Temperature & Humidity Control

By Hesam Moshiri, Anson Bao


Raspberry Pi Pico is a cute piece of hardware. It is equipped with a powerful dual-core RP2040 microcontroller that offers 2M (up to 16M) Flash and 264K SRAM memories. Such specifications make it suitable for a variety of hobby and industrial applications.

In this article/video, I used a Pico board, a digital SHTC3 sensor, and a 2.4” colorful TFT display to build a graphical temperature and humidity measurement/control unit that can be used to monitor the home, workplace, indoor garden, devices … etc. The board was also equipped with two Relays that allow the user to set the cooling/heating limits and adjust the parameters in the GUI.

The trickiest part of this project was the Pico code. I used the Pico C/C++ SDK library and invested a significant amount of time in designing the GUI and debugging the code. I should confess it was not an easy task.

To design the schematic and PCB, I used Altium designer 22 and installed the missing component libraries using Altium’s manufacturer part search. By using the Octopart website, I was able to quickly gather the necessary component information and generate the BOM. Finally, to get high-quality fabricated boards, I sent the Gerber files to PCBWay.

It's a cool piece of hardware for anyone, so let’s get started :-)


Download the Gerber or order 10Pcs high-quality boards [mainboard], for little 5USD

Download the Gerber or order 10Pcs high-quality boards [panelboard], for little 5USD

To order a fully assembled PCB board (FREE shipping). Please contact: anson@pcbway.com

You can order the Raspberry Pi Pico board HERE: https://www.pcbway.com/project/gifts_detail/Raspberry_Pi_Pico.html


Specifications

Input Power: 7.5V to 9Vmax

Current Consumption: 280mA(max)

Temperature Range: -40C to 125C

Temperature Tolerance: +/-0.2C

Humidity Range: 0%RH to 100%RH

Humidity Tolerance: +/-2%RH

Output Relay Control Statement: Temperature 

Screen Size: 2.4” colorful (320*240)


A: Circuit Analysis

The schematic diagram of the device consists of two parts: the main circuit and the panel circuit. Figure 1 shows the schematic diagram of the mainboard and figure 2 shows the schematic diagram of the panelboard. I used Altium Designer to design the schematic and PCB.

Figure 1

Schematic diagram of the temperature and humidity monitoring and control unit (main circuit)

Figure 2

Schematic diagram of the temperature and humidity monitoring and control unit (panel circuit)


A-1: Main Circuit

The main circuit can be divided into 3 essential parts: power supply, Pico board, and Relays. I explain each part separately.


A-1-1: Power Supply

VIN is a 2 pins XH connector that is used to connect the power to the board. The acceptable input voltage range is 7.5V to 9V. REG1 is a 78M05 +5V regulator [1] that provides a +5V supply rail for the relays. The maximum current draw of this section is 100mA because both relays won’t be activated at the same time, otherwise, the current consumption of each relay is around 90mA to 100mA. C1 and C2 were used to reduce the input and output noises. 

The combination of FB1 (zero-ohm ferrite bead) and C4 reduce the input voltage noises because the supply of the Relays and the rest of the board should not be identical. REG2 is another 78M05 regulator that provides a +5V rail for the processor, sensor, and TFT display.

D1 is an LED that indicates a proper supply connection and C5, C6, C7, and C8 were used to reduce the noise. REG3 is an AMS1117-3.3V regulator [2] that prepares a stable +3.3V supply rail for the Pico, SHTC3 sensor module, and TFT display.


A-1-2: Pico Board

I used the default Raspberry Pi Pico board for this project (Pico1) [3]. The flash memory size of this board is 2M. figure 3 shows a picture of the Pico board.

Figure 3

Raspberry Pi Pico board (2M Flash)


According to the Raspberry Pi Pico datasheet, the simplest method to power the Pico board without a USB connection is through a Schottky diode (D2). In general, a diode introduces a forward voltage drop, however since the input voltage is +5V, this would not cause any problem. Therefore, a series diode is the best solution for our application. C11, C12, and C13 soften the debouncing effect and reduce tactile push button noises. I used these capacitors as close as possible to the Pico pins. R7 is a pullup resistor for the Reset pin (active-low Reset pin of the LCD). P2 is the connector for the SHTC3 module and C3 is a decoupling capacitor. CON1 is a 40Pins FPC connector that provides a connection between the panelboard and the mainboard.


A-1-3: Relays 

P3 and P4 are power connectors to connect the heater and cooler to the mainboard. K1 and K2 are LM1-5D relays [4]. Q1 and Q2 are 2N7002 [5] Mosfets to control the relays and D3 and D4 protect the Mosfets against the reverse currents of the Relays’ coils. R8 and R9 are pull-down resistors to prevent unwanted triggering of the Mosfets. D5 and D6 are LEDs to indicate the activation of Relays. C9 and C10 are used to reduce the Relay activation/deactivation noises.

A-2: Panel Circuit

CON1 and LCD1 are 40Pins FPC connectors. CON1 provides a connection between the mainboard and the panelboard. C1 to C4 are used to reduce the supply noise. R1 is a pull-up resistor for the CS (cheap select) pin because this pin is active-low. R2 is a pull-down resistor for the MISO Pin, sometimes it is fine to act like this to reduce the possible noises on the high-speed SPI bus. R3, R4, and R5 are pull-up resistors for the SW1, SW2, and SW3 tactile pushbuttons.

B. PCB Layout

Figure 4 shows the PCB layout of the mainboard and figure 5 demonstrates the PCB layout of the panelboard. Both are two layers of PCB boards and the majority of the components are SMD. The board cut-out areas are clear in figure 5 because I assumed that the user might decide to control AC loads, so creepage areas must be implemented. Figure 6 shows the assembly drawing of the mainboard and figure 7 shows the assembly drawing of the panelboard.


Figure 4

PCB layout of the mainboard (Altium Designer)

Figure 5

PCB layout of the panelboard (Altium Designer)

Figure 6

Assembly drawing of the mainboard

Figure 7

Assembly drawing of the panelboard


C. Code

As you know, flashing the Raspberry Pi Pico is pretty easy. You just need to press and hold the BOOT button and connect the USB cable to the computer. The Raspberry Pi Pico folder pops up and you just need to drag & drop or copy-paste the UF2 file to the folder and that’s it. 

You can download the UF2 file here: https://www.dropbox.com/s/gva59f83ib1f4er/project1.uf2?dl=0

D. TFT Display

I used a colorful 2.4” 40-Pins TFT display. The resolution of the display is 32*240. The controller chip of the LCD is ILI9341. Figure 8 shows a picture of the LCD and pinouts. You must order a type without a touch screen.

Figure 8

2.4” ILI9341 TFT display pinout 


E. Assembly and Test

Figure 9 shows the fully assembled PCB board. The most difficult components to solder are the 40-Pins FPC connectors. If you don’t have experience in micro soldering and necessary equipment such as quality flux, soldering irons, hot air, and iron tips, please do some practice before, otherwise, it is pretty easy to damage the connectors, PCB board, or build several solder bridges between the tiny 0.5mm pitch pins. By the way, you have an option to order the fully assembled PCB boards as well. Be careful that you must use a reverse 40-Pins FFC cable between the mainboard and the panelboard. Please watch the YouTube video for more details.

Figure 9

Fully assembled PCB board of the Temperature & Humidity Control Unit


F. Bill of Materials

Figure 10 shows the bill of materials for the project. The Octopart website is not just a fast search engine for electronic components, it also provides a very nice tool to build any kind of BOM for free.

Figure 10

Bill of materials of the Temperature & Humidity Control Unit


G. References

[1]: 78M05: https://octopart.com/l78m05acdt-stmicroelectronics-2280839?r=sp

[2]: TLV1117-33C: https://octopart.com/tlv1117-33cdcyr-texas+instruments-669251?r=sp

[3]: Raspberry Pi Pico: https://octopart.com/sc0915-raspberry+pi-116090189?r=sp

[4]: LM1-5D: https://octopart.com/lm1-5d-rayex-53719411?r=sp

[5]: 2N7002: https://octopart.com/2n7002-t1-e3-vishay-55433894?r=sp

Join us
Wanna be a dedicated PCBWay writer? We definately look forward to having you with us.
  • Comments(2)
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
    Back to top