Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Raspberry Pi Pico-Based Smart Fan Controller with Touchscreen Interface

View and Edit Project In Cirkit DesignerImage of Raspberry Pi Pico-Based Smart Fan Controller with Touchscreen Interface

Circuit Documentation

Summary

This document provides a detailed overview of a circuit designed to control a fan using a Raspberry Pi Pico microcontroller. The circuit includes various components such as a DC-DC converter, a MOSFET, a rocker switch, a sensor, and an LCD display. The Raspberry Pi Pico is programmed to manage the fan speed based on temperature readings from the AHT20 sensor and user inputs from the LCD touch screen.

Component List

  1. Fan

    • Description: A simple fan used for cooling.
    • Pins: GND, 5V
  2. DCDC 12V/5V 3A

    • Description: A DC-DC converter that steps down 12V to 5V.
    • Pins: 12V (+), GND, 5V (+), Vin (+), Vin (-)
  3. Seeed Mosfet CJQ4435

    • Description: A MOSFET used for switching the fan.
    • Pins: 5V (+), GND (-), OUT (+), OUT(-), Schwarz, Rot, Weiss, Gelb
  4. Rocker Switch (SPST)

    • Description: A single-pole single-throw switch.
    • Pins: 1, 2
  5. Raspberry Pi Pico

    • Description: A microcontroller used to control the circuit.
    • Pins: pin 1 to pin 43
  6. 2.1mm Barrel Jack with Terminal Block

    • Description: A barrel jack for power input.
    • Pins: POS, NEG
  7. USB power

    • Description: USB power input.
    • Pins: +, -
  8. Logic Level Converter 3.3V 5V TTL

    • Description: A logic level converter for interfacing 3.3V and 5V logic.
    • Pins: GND (Raspi), GP14 (Raspi), 3.3V (Raspi), Mosfet Gelb, 5V (+), 5V (-)
  9. AHT20 Sensor

    • Description: A temperature and humidity sensor.
    • Pins: Schwarz, Rot, Weiss, Gelb
  10. Nextion Touch LCD 2.4"

    • Description: A touch LCD display.
    • Pins: VCC, GND, RX, TX

Wiring Details

Fan

DCDC 12V/5V 3A

Seeed Mosfet CJQ4435

Rocker Switch (SPST)

Raspberry Pi Pico

2.1mm Barrel Jack with Terminal Block

USB power

Logic Level Converter 3.3V 5V TTL

AHT20 Sensor

Documented Code

Arduino Sketch (C++)

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

MicroPython Code

import time  # Importiert das time-Modul zur Handhabung von Zeitfunktionen
time.sleep(0.1)

from machine import Pin, I2C, SPI, PWM  # Importiert die notwendigen Module Pin, SPI und PWM aus der machine-Bibliothek
import framebuf  # Importiert das framebuf-Modul, das für die Displaypuffer-Verwaltung zuständig ist

import os  # Importiert das os-Modul zur Handhabung von Betriebssystemfunktionen (wird in diesem Skript nicht verwendet)
#import time


# Definiert die Pins für das LCD-Display und das Touchpanel
LCD_DC   = 8
LCD_CS   = 9
LCD_SCK  = 10
LCD_MOSI = 11
LCD_MISO = 12
LCD_BL   = 13
LCD_RST  = 15
TP_CS    = 16
TP_IRQ   = 17
luefter_pwm_pin = 14 #Lüfter = GPIO15 (Pin 20)
buzzer_pin = 2


# Definition von Variablen
temperatur_soll=20
temperatur_ist=0
#ventilator_soll=0
luefterlast=100