βοΈ The purpose of this project is to design a simple prototype of an interactive leds tree that was controlled using a Raspberry Pi Pico and Hexabiz IR sensor module.
βοΈ We can use this to decorate walls and rooms. So in this tutorial, I am showing how I designed and made this Christmas tree.
βοΈ The LEDs are switched on sequentially if the distance between the person and the tree is greater than one and a half meters. The LEDs at the top of the tree are turned on intermittently, and the rest are turned off when approaching them. This sequence can be changed as required.
βοΈ A relay module can also be used if we want to decorate a real tree with strip lights.
How I build it π οΈβοΈ Bring green paper and a perforated board to make a prototype of the tree before designing a printed circuit or for ease if your country doesn't have a place to manufacture PCB.
βοΈ Connecting and soldering components.
βοΈ I tested the LEDs by connecting them to Hexabitz power module and 9 volt battery.
βοΈ The next stage is to connect UART GPIOs of the Raspberry Pi Pico to Hexabitz module then connect the tree circuit wires with pico GPIOs as well.
βοΈ I hid the IR sensor module behind the snowman βοΈ, with the need to cut a small hole in the sensor's place.
All you need to do is perform the following steps :
- Import the machine module.
- Import the time module.
from machine import UART, Pin
import time
UART objects can be created and initialized using:
uart = UART(0, baudrate= 921600, tx=Pin(0), rx=Pin(1)) # init with given baudrate
uart.init(921600, bits=8, parity=None, stop=1) # init with given parameters
A UART object acts like a stream
object and reading and writing to Hexabitz module is done using the standard stream methods.
We obtain the filtered and calibrated value of the IR in units of cm or inch using the following command from the IR module factsheet:
For more information see the following project:
https://www.hackster.io/aula-jazmati/how-to-use-hexabitz-modules-with-raspberry-pi-pico-69516c
Test the System βοΈπβHappy Holidays π
Comments