Demo project to sync color changes to an Raspberry Pi Mood Light via iOS/Android

Overview

Raspberry Pi Mood Light

Demo project to remotely control an Raspberry Pi Mood Light over Bluetooth via iOS and Android.

trim 1EDE8B51-10E3-491E-B8B4-0F16D0B93A21

๐Ÿ“บ Watch the video

Overview

In this demo, we are using the Unicorn HAT or Unicorn HAT Mini with the Pimoroni Mood Light Kit which is powered by a Raspbery Pi Zero WH.

There are two companion apps - one for iOS and Android - which offer the ability to control the mood light via Ditto's P2P data sync. The mood light itself is powered by a Rust application which listens for data change events from the companion apps and then changes the light color. The Rust app uses pyo3 to call the python libraries from Pimoroni to control the Unicorn HAT.

Requirements

  • Pimoroni Mood Light Kit
  • 32 bit Raspberry Pi OS
  • iOS app requires iOS 16 as it is using a new SwiftUI Color Wheel component
  • Python shared library installed

Setup

  1. Request an offline license token through the Portal and replace "YOUR_OFFLINE_TOKEN" with that value in all apps (iOS, Android, and moodlight-rs).

  2. Install Raspberry Pi OS (32 bit) and follow the Unicorn HAT or Unicorn HAT Mini getting started guide to install the required firmware for the light.

  3. Copy moodlight-rs to the Raspberry Pi.

scp -r moodlight-rs [email protected]:~/
  1. Install rust on the Raspberry Pi
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  1. Configure the Raspberry Pi to support Bluetooth Low Energy with Ditto
// Typical requirements needed for BLE
sudo apt-get install libglib2.0-dev libdbus-1-dev libudev-dev libical-dev libreadline-dev docutils-common
  1. Compile moodlight-rs manually on the Raspberry Pi:
cd moodlight-rs

// If cross-compiling to original RPi-Zero-W
rustup target add arm-unknown-linux-gnueabihf

// Install the Python shared library
sudo apt install python3-dev python3-venv python3-pip

[PYO3_CROSS_LIB_DIR=/usr/lib] DITTOFFI_SEARCH_PATH=./ LIBDITTO_STATIC=0 cargo build [--target arm-unknown-linux-gnueabihf]
  1. Run moodlight-rs:
// Pass --mini argument if Unicorn pHAT Mini
// Add additional RGB values to set initial light color
sudo LD_LIBRARY_PATH=./ ./target/debug/moodlight-rs [--mini true] [-- 0 0 0]
  1. Run iOS or Android apps on a companion device to control the light!

Troubleshooting

  • Ensure you're using a high-quality SD card.
  • If Rust installation fails, you may need to increase the swap size on your Raspberry Pi. (see this issue)
You might also like...
This is a basic mobile app that allows the user to tap a button to change the color of a label.
This is a basic mobile app that allows the user to tap a button to change the color of a label.

MYAPP App Description `This is a basic mobile app that allows the user to tap a button to change the color of a label. App Walk-though Required User S

The app allows the user to change text color and text content when the displayed button is clicked
The app allows the user to change text color and text content when the displayed button is clicked

Hello World! App Description This application allows the user to change text color and text content when the displayed button is clicked. App Walk-tho

Codepath-prework - label color-changing app for codepath intro prework
Codepath-prework - label color-changing app for codepath intro prework

codepath pre-work App Description An app that changes the color of the Hello Wor

A fast-paced color matching game.

***DOCUMENTATION: WELCOME TO COLOURS. COLOURS is an iOS application built using XCode and Swift. COLOURS is a game, and the objective is to match al

Mi Card App for Android & IOS in Flutter
Mi Card App for Android & IOS in Flutter

Mi Card Our Goal Now that you've seen how to create a Flutter app entirely from scratch, we're going to go further and learn more about how to design

Magic 8Ball App for Android & IOS in Flutter
Magic 8Ball App for Android & IOS in Flutter

Magic 8 Ball ๐ŸŽฑ Our Goal The objective of this challenge is to solidify what you've learn't in the Dicee tutorial. This app will guide you through the

๐Ÿ€ iOS and Android NBA app created with React Native
๐Ÿ€ iOS and Android NBA app created with React Native

Swish An iOS and Android NBA app created with React Native. If you would like to request a feature, find a bug, have a question, or would like to leav

Joplin - an open source note taking and to-do application with synchronization capabilities for Windows, macOS, Linux, Android and iOS. Forum: https://discourse.joplinapp.org/
Joplin - an open source note taking and to-do application with synchronization capabilities for Windows, macOS, Linux, Android and iOS. Forum: https://discourse.joplinapp.org/

Joplinยฎ is a free, open source note taking and to-do application, which can handle a large number of notes organised into notebooks. The notes are sea

The Bitwarden mobile application is written in C# with Xamarin Android, Xamarin iOS, and Xamarin Forms.
The Bitwarden mobile application is written in C# with Xamarin Android, Xamarin iOS, and Xamarin Forms.

Bitwarden Mobile Application The Bitwarden mobile application is written in C# with Xamarin Android, Xamarin iOS, and Xamarin Forms. Build/Run Require

Owner
Ditto
An SDK that allows apps to sync without the internet
Ditto
Docker images for Swift on Raspberry Pi and other ARM devices from balena's base images.

Swift on Balena Welcome to Swift on Balena โ€“ a set of Docker images for Swift on Raspberry Pi and other ARM devices. These images are based on balena'

Will Lisac 173 Dec 5, 2022
This provides a bridge to use Sync with Tokamak instead of SwiftUI

Sync Tokamak This provides a bridge to use Sync with Tokamak instead of SwiftUI.

Mathias Quintero 5 May 7, 2022
Ported scrcpy for mobile platforms, to remotely control Android devices on your iPhone or Android phone.

scrcpy-mobile Ported scrcpy for mobile platforms, to remotely control Android devices on your iPhone or Android phone. Currently only supports control

Ethan 140 Jan 2, 2023
iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android).

FinanceReactNative iOS's Stocks App clone written in React Native for demo purpose (available both iOS and Android). Data is pulled from Yahoo Finance

kf 2k Dec 29, 2022
NetworkIcom - Project using Swift and SwiftUI to access Icom 7610 via Ethernet

Background This repository is an upload of a local Git repository from an Apple

Mark Erbaugh 9 Sep 25, 2022
Kushal Shingote 1 Feb 2, 2022
A demo project with VIPER architecture

AQIDemo What is it? A demo project with VIPER architecture. All views, Interactors Presenter and routers are in place with their respective folder. Ap

Vivek Agar 0 Nov 23, 2021
Control Nvidia jetbot which is based on Jetson Nano via iOS app

jetbot-remote-control This is very basic example project which control Nvidia Jetbot remotely via iOS app Based on jetbot of Nvidia, adding sample sou

Nguyen Quoc Thanh 13 Oct 6, 2021
Aplikasi iReader adalah Aplikasi Pemindai Barcode dan Teks untuk iOS & MacOS dengan fitur Text Scanner via Kamera & Import Files.

Aplikasi iReader adalah Aplikasi Pemindai Barcode dan Teks untuk iOS & MacOS dengan fitur Text Scanner via Kamera & Import Files. Aplikasi ini dibuat dengan SwiftUI, AVKit, dan VisionKit (On Device Machine Learning Processing).

DK 8 Oct 6, 2022
SecretSquirrel: A Demonstration of releasing Closed Source libraries privately via SPM

SecretSquirrel: A Demonstration of releasing Closed Source libraries privately via SPM. A demo repository that showcases how to properly vend a closed

Jerrad Thramer 2 Apr 27, 2022