The goal of this project is to connect a rpi with ledstrips with individually adressable leds. It will then be controllable with a bluetooth connection using a phone app. Enjoy :)
The motivation behind this project is too decorate our homes, bicyles and anywhere you can think of with awesome controllable led. Moreover, the second goal is too learn how to make an electronic project, how to use bluetooth and how to connect everything through an app.
The bluetooth server and ledstrip connection on the rpi are made with Python3. I use Snake Case as code style.
- Raspberry pi zero w
- WS2812B Led strip
- Electric cables
- 5 volt power supply with 10 amps
- 2 small buttons
The phone app used to connect and control the ledstrip is made with Xamarin. I use C# convention as Code Style.
- Being able to control the device using a phone app and without internet connection
- Being plug and play as much as possible
- User will be able to select a bunch of animations
- User will be able to create an animation playlist with loop or not
- User will be able to divide the strip in different section and target those sections individually with animations
- sudo bluetoothctl
- system-alias 'alias'
- discoverable on
- pairable on
- agent on
- default-agent
- On Android, select the device with the alias name. Follow pairing instruction on rpi and phone.
- sudo nano /lib/systemd/system/lightyourhearth.service
- sudo chmod +x /lib/systemd/system/lightyourhearth.service
- sudo systemctl daemon-reload
- sudo systemctl enable lightyourhearth.service
- sudo systemctl status lightyourhearth.service
- sudo crontab -e
- sudo crontab -l
- Enable SSH, VNC and SPI in interfaces configuration
- Install bluetooth components
- sudo apt-get install bluetooth bluez blueman libbluetooth-dev
- sudo apt-get install python-bluetooth
- Add SP profile to bluetooth
- sudo nano /etc/systemd/system/dbus-org.bluez.service
- A file will open and add the compatibility flag, ' -C', at the end of the 'ExecStart=' line. Add a new line after that to add the SP profile. The two lines should look like this:
- ExecStart=/usr/lib/bluetooth/bluetoothd -C
- ExecStartPost=/usr/bin/sdptool add SP
- Install Git, Python and Pip :
- sudo apt install git
- sudo apt install python3
- sudo apt-get install python3-pip
- Download repo to Desktop Folderand navigate to root folder. Make sure it is in this path /home/pi/Desktop/LightYourHearth-rpi
- Install requirements : sudo pip3 install -r requirements.txt
- Add LightYourHearth-Update script to crontab
- Open terminal and type : sudo crontab -e
- Add this line to start server update check on system boot : @reboot sh /home/pi/Desktop/LightYourHearth-rpi/LightYourHearth-Update.sh >/home/pi/Desktop/LightYourHearth-rpi/Logs/cronlogs 2>&1
- Save, you can confirm using sudo crontab -l
- Add Systemd unit file to systemd deamon
- sudo cp lightyourhearth.service /lib/systemd/system/
- sudo chmod +x /lib/systemd/system/lightyourhearth.service
- sudo systemctl daemon-reload
- sudo systemctl enable lightyourhearth.service
- sudo systemctl status lightyourhearth.service
- Reboot
- sudo reboot
n/a
MIT
August 2020
- RPI - Create the device with the rpi, wires, ledstrip and power supply
- RPI - Control the ledstrip using a python script
- RPI - Add a bluetooth server to communicate with a phone
- RPI - Configure Raspbian to autolaunch the script on bootup
- RPI - Auto update the bluetooth server from git
- RPI - Remove bluetooth security when pairing a device
- APP - Create a phone app using Xamarin and learn the basics
- APP - Add bluetooth client connection
- APP/RPI - Add handshake when initializing connections to discover servers capabilities (animations, etc)
- APP - Create a dynamic UI for animations
September 2020
- APP - Create playlist for animations
- APP - Create sections on the ledstrip for animations to target those sections
- RPI - Add more animations
- RPI - Add different ledstrip type (SK6812)