Friday, July 03, 2020

Vendor-Neutral Zigbee Gateway with Raspberry Pi

A one-script installer that turns a Raspberry Pi + CC2531 USB adapter into a vendor-neutral Zigbee home automation gateway running Domoticz — supporting 800+ Zigbee devices from any manufacturer.

Pimoticz hardware setup — Raspberry Pi with CC2531 USB adapter

Raspberry Pi with CC2531 USB Zigbee adapter — the complete Pimoticz hardware.

The problem

Cheap Zigbee home automation devices are everywhere, but they're locked to the manufacturer's gateway — limiting you to a small set of supported devices. With commercial off-the-shelf (COTS) hardware, you can build your own vendor-neutral gateway, but it requires setting up multiple components:

  1. Raspberry Pi
  2. CC2531 USB Zigbee adapter (with Koenkk firmware, ~$12 on Amazon)
  3. Raspberry Pi OS (32-bit)
  4. Node.js (v12 or higher)
  5. zigbee2mqtt
  6. Mosquitto MQTT broker
  7. Domoticz
  8. zigbee2mqtt plugin for Domoticz

For beginners, getting all these components working together is a challenging task. Pimoticz simplifies this with an automated installer script — in about 5 minutes you should be ready to pair your first Zigbee device.

Items needed

  • Raspberry Pi
  • Micro SD card
  • 5V power adapter
  • CC2531 USB Zigbee adapter

Important: To avoid the CC2531 programming setup, buy a pre-programmed USB adapter with Koenkk firmware (CC2531_DEFAULT_20190608.zip or higher).

Raspberry Pi OS setup

CC2531 USB adapter, keyboard, mouse, monitor, and internet connection are only needed during the initial setup.

Step 1 — Prepare the SD card using Raspberry Pi Imager and install Raspberry Pi OS 32-bit.

Step 2 — Insert the SD card, connect keyboard/mouse/monitor and internet to your Raspberry Pi, then power on.

Step 3 — On first boot, the setup wizard will guide you through:

  • Language and keyboard layout (important for correct local time — Domoticz needs it)
  • Set a new password for the pi user
  • Black border check (not important — Raspi will run headless after setup)
  • Wi-Fi setup (skip if using Ethernet)
  • Software update (optional — can skip to save time)
  • Reboot to apply settings
Pimoticz architecture diagram

Pimoticz software stack — zigbee2mqtt, Mosquitto, and Domoticz working together.

Pimoticz installation

Open a terminal on the Raspberry Pi (locally or via SSH) and run:

git clone https://github.com/hackboxguy/pimoticz.git
cd /home/pi/pimoticz
sudo ./setup.sh -h my-pimoticz    # -h hostname is optional
# wait ~5 minutes for setup to complete
sudo reboot
Pimoticz setup script running

Setup script in progress — installing all dependencies automatically.

After reboot, open a browser and navigate to http://127.0.0.1:8080 or http://my-pimoticz:8080 — Domoticz will show the detected CC2531 Zigbee coordinator.

Domoticz dashboard showing CC2531 coordinator

Domoticz running on Pimoticz — CC2531 Zigbee coordinator detected and ready to pair devices.

Your Pimoticz gateway is ready. You can now pair Zigbee devices from any manufacturer — Xiaomi, IKEA, Philips Hue, Sonoff, and 800+ more.

SOURCE CODE

github.com/hackboxguy/pimoticz — installer script and documentation

Thursday, February 27, 2020

YARMP: Lightweight Raspberry Pi Media Player

A lightweight Buildroot-based media player image (<65 MB) for Raspberry Pi that autoplays video, audio, or images in a loop — booting in under 20 seconds.

  • Supports all Pi 1 variants (Pi Zero, Pi Zero W, Pi A/B, Pi A+/B+)
  • Works on older Pis with just 256 MB RAM and a 1 GB SD card
  • Autoplays media from the internal SD card or an external FAT-formatted USB drive
Pi Zero running YARMP as digital photo album on 7-inch LCD

Battery-powered Pi Zero running YARMP as a digital photo album on a 7-inch LCD — under $50 total.

Quick start — 3 steps

  1. Download raspi-yarmp.img.xz to your PC
  2. Write the image to an SD card using Balena Etcher
  3. Insert the SD card into your Pi and power on — the default video starts playing in a loop
Balena Etcher step 1 — select image

Step 1: Select the YARMP image in Balena Etcher.

Balena Etcher step 2 — select target

Step 2: Select the SD card as target.

Balena Etcher step 3 — flash

Step 3: Flash the image to the SD card.

Flashing in progress

Flashing in progress.

Flash complete

Flash complete — SD card is ready.

Playing your own media

  1. Remove the SD card from the Pi and plug it into your PC
  2. Browse to USRDAT:\media-files\ and find sample-video.mkv
  3. Delete or back up the sample file, then add your own media (video, audio, or images) to the media-files directory
  4. Insert the SD card back into the Pi and power on — your media plays in a loop

If you can't find the USRDAT drive on Windows, try a USB SD card reader or mount it on Linux. Alternatively, copy your media to a FAT-formatted USB drive and plug it into the Pi — on boot, external USB media takes priority over the internal SD card.

Playback priority

When multiple media types are present, YARMP follows this priority order:

  1. Video files (highest priority)
  2. Audio files (e.g. MP3)
  3. Image files (e.g. JPG, PNG)
  4. If no media is found on USB or SD card, the default BBC motion gallery video plays

Seamless looping

By default, a single video file plays in seamless loop mode — no black screen between loops. For multiple videos to play seamlessly, merge them into one file using the melt tool.

For photo slideshows, adjust the display delay by editing /mnt/userdata/rc.local on the Pi (look for the fbv command line section).

Use cases

  • Digital signage
  • Portable HDMI audio/video test source (Pi Zero + battery bank)
  • Art installations — display your work on a loop
  • Museum exhibits — low-cost media playback
  • Science projects — small HDMI display with custom content
  • Digital photo album on an HDMI display

Hardware photos

Pi Zero YARMP setup — front view

Pi Zero with 7-inch LCD — front view.

Pi Zero YARMP setup — rear view

Pi Zero with 7-inch LCD — rear view showing battery bank.

DOWNLOADS

raspi-yarmp.img.xz — pre-built SD card image (<65 MB)