Raspberry Pi Pico Projects

Raspberry Pi Pico Home Automation System

Introduction : Raspberry Pi Pico Home Automation

Here we will showing you how to build an Home Automation System Using Raspberry Pi Pico that can control Electronics devices like lights, plugs, fans, garage doors etc. using Android Smartphone. All you need is an Raspberry Pi Pico Board, Bluetooth module, relays, wires and an android phone for controlling. There is a large scope of home automation applications that we can build easily by using the Raspberry Pi Pico board.

Supplies for Raspberry Pi Pico Home Automation System

Components Required
  1. Raspberry Pi Pico –  https://amzn.to/3LgHC1s
  2. Bluetooth Module HC-05 – https://amzn.to/3MJOGnF
  3. 4 Channel Relay Module –  https://amzn.to/3Mr9UWZ
  4. Jumper Wires –  https://amzn.to/38fpnuy
  5. Breadboard – https://amzn.to/3OBy8jm

HC05 Module?

HC05 Bluetooth module pinout

The HC-05 and HC-06 modules are Bluetooth modules that we can use to communicate with Raspberry Pi Pico via Bluetooth. HC-05 Bluetooth Module one of the best ways to communicate wirelessly with the Raspberry Pi Pico.  For example, we can use it to control a LED Or Relay from a mobile or tablet.

The two modules, HC-05 Module, allow us to easily connect an Raspberry Pi Pico via Bluetooth.

HC-05 Pinout 

  1. Enable / Key : This pin is used to toggle between Data Mode (set low) and AT command mode (set high). By default it is in Data mode
  2. VCC: To give power or current to the module, Connect to +5V Supply voltage or 3.3V pin.
  3. GND: Connect to system ground(-).
  4. TXD: Transmit Serial data. It is used to wirelessly received data by the Bluetooth module.
  5. RXD: Receive Serial data. When the Bluetooth module transmit data, RXD pin is used to receive that data.
  6. State: The state pin is connected to on board LED, It tells whether the module is connected or not with bluetooth and used as a feedback to check if Bluetooth is working properly.

Raspberry Pi Pico ?

raspberry pi picoRaspberry Pi PICO is 32-bit  low-cost, high-performance microcontroller development board that build in the RP2040 processor, Dual-core Arm Cortex M0+ processor, flexible clock running up to 133MHz. develop by the Raspberry Pi foundation.

Schematics Raspberry Pi Pico Home Automation System

Raspberry Pi Pico Home Automation
Circuit Diagram

The Circuit diagram is very straightforward. You have to connect the HC-05 Bluetooth module and Relay pins with Raspberry Pi Pico pins as per the schematic diagram. The schematic diagram is shown above. You may also follow the following pin mapping

Hc-05->Raspberry Pi Pico

  • VCC -> 3.3V
  • GND -> GND
  • RX -> GP0
  • TX -> GP1

Relay -> Raspberry Pi Pico

  • GND -> GND
  • IN1 -> GP2
  • IN2 -> GP3
  • IN3 -> GP4
  • IN4 -> GP5
  • VCC -> 5V

Prepare the Thonny IDE for Raspberry Pi Pico Board

How to Set Up the Raspberry Pi Pico  https://www.tomshardware.com/how-to/raspberry-pi-pico-setup

Thonny is now prepared to program your Raspberry Pi Pico board

Source Code

from machine import UART, Pin

bt = UART(0,9600)

L1 = Pin(2,Pin.OUT)
L2 = Pin(3,Pin.OUT)
L3 = Pin(4,Pin.OUT)
L4 = Pin(5,Pin.OUT)

while True:
    
    br = bt.readline()
    
    if "ON1" in br:
        L1.value(0)
    elif "OFF1" in br:
        L1.value(1)
        
    elif "ON2" in br:
        L2.value(0)
    elif "OFF2" in br:
        L2.value(1)
        
    elif "ON3" in br:
        L3.value(0)
    elif "OFF3" in br:
        L3.value(1)
        
    elif "ON4" in br:
        L4.value(0)
    elif "OFF4" in br:
        L4.value(1)

 

Download Android App.

kodular app

Now , Let’s make mobile application, To make mobile app i used kodular.

[button color=”purple ” size=”small” link=”https://github.com/panchalnikunj/Raspberry-Pi-Pico-Projects/raw/main/Home%20Automation%20Using%20Raspberry%20Pi%20Pico/MyHomeControl.apk” icon=”” target=”true” nofollow=”false”]Download[/button]

Final Working

Now, give power to circuit and open app, and connect bluetooth and control your lights or Fan using smartphone.

 

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button