Home Automation System with Raspberry Pi Pico

About The Project

In this project, we’ll learn about the home automation process with the Raspberry Pi Pico. Now-a-days, demand for automation has increased exponentially as most people want a comfortable life. With the current growth in the electronics industry with its creative design and powerful programming, many people are developing their projects to make the world a better place. We are now using the Raspberry Pi Pico-based home automation system to build a technologically advanced house.

Know Your Raspberry Pi Pico

Raspberry Pi has quite a well-reputed foundation in the tech-industry and with the launch of Raspberry Pi Pico, it got a large fan base in the business. If we understand Raspberry Pi Pico and summarize it then Raspberry Pi Pico has a compact design with the powerful IC RP2040 which surprisingly provides high power to Raspberry Pi Pico at a low cost. It consists of a most energy-efficient ARM processor, dual Arm Cortex-M0+ processors that increase the performance of the Raspberry Pi Pico. The majority of the RP2040 microcontroller pins are connected to the user IO pins on the left and right edges of the board, according to the configuration of the Raspberry Pi Pico. The RP2040 IO is used for internal board functions such as driving an LED, controlling the onboard Switched Mode Power Supply (SMPS), and sensing the system voltages to ensure that the system runs efficiently.

Insight of Pico Relay Board

SB Components has created a Raspberry Pi Pico Relay Board that can power up to four appliances and loads up to 250VAC @ 7A, 30V DC @ 10A. It gives users a way to power high-voltage/high-current machines. The Raspberry Pi Pico Relay Board was created by our research and development team to improve the intelligence of the appliances. It includes a "Optocoupler," which enables an electrical signal to be transmitted between two isolated circuits using light energy. Optocouplers are used to keep high voltages in one part of the circuit from influencing the other. It provides security to the device, allowing the user to save money, time, and energy.

Getting Started with a Home Automation System

To develop an advanced home automation system, we need to have the following things

  • Raspberry Pi Pico - The Raspberry Pi Pico is a powerful microcontroller with an RP2040 Dual Core ARM Cortex-M0+ clocked at 133MHz, 256KB RAM, 30 GPIO pins, and a variety of interfacing choices.
  • Raspberry Pi Pico Relay Board - The Raspberry Pi Pico Relay Board was designed to power up to four appliances and loads up to 240V AC @ 7A and 30V DC @ 10A. It's easy to use because all you have to do is stack the Raspberry Pi Pico on top of it.
  • HC-05 Bluetooth Module -It's a serial Bluetooth module for microcontrollers with a 4V to 6V operating voltage and 30mA operating current. Serial communication (UART) and TTL compatibility are supported.
  • USB Cable - For Programming with Raspberry Pi Pico.

Installation Procedure

  • Stack Raspberry Pi Pico on 40 pin Pico header of Pico Relay board.
  • Connect HC-05 Bluetooth module RX and TX pin on Pin GP0 and GP1 of external header of Pico relay board. Follow below circuit arrangement to connect everything together.Home Automation System with Raspberry Pi Pico
  • Now copy below code and paste it in any micropython supported ide (for example: Thonny IDe) and select the interpreter as MicroPython (Raspberry pi pico) .

Source Code :

from machine import Pin, UART

import utime


Relay1 = Pin(18, Pin.OUT)

Relay(0)


uart = UART(0, baudrate=9600,

                    bits=8, parity=None, stop=1)


print(uart)


while True:

    #uart.write('h')

    command= uart.read(1)

    command= command.decode("utf-8")

    print(command)

    if command=='1':  #Turn Relay1 on

        Relay1(1)

    elif command=='b':   #Turn Relay1 off

        Relay1(0)

  • Click on the Green play button to run the program on Raspberry Pi Pico.
  • Now use any Serial terminal app from play store to send data to your Bluetooth module. Send "1" to turn on Bulb and send "2" to turn off Bulb.

Application

You can use the above method to make your home smart and automate devices. One of the best utilizations of home automation is to connect the sensors with it and take the data from it to make things better. There are protocols like MQTT that can be used for a large number of devices that would increase the network in the automation system. There are following applications 

  • Home Automation 
  • Industrial Automation
  • Smart Appliances
  • Automated Gardening
  • Security system

Leave a comment

All comments are moderated before being published