Meshing Pi's With Batman and MagicQ for Woodland Light Show
I had the task of remote controlling lights in a woodland using MagicQ. The topography was relatively simple, two pies, six moving head lamps and a laptop to control them.
Of course the fun part was getting about in the mud, the trees, the hills, the undergrowth, tripping over cables etc. :)
I had previously tried using a conventional network with (expensive waterproof) access points lofted up into trees. This was partly successful but suffered intermittent network failures. Other pies were being used as video projectors and/or audio players so these could also becom part of the mesh.
Then I discovered BATMAN-ADV a mesh networking controller and decided to give this a go.
The webite is https://www.open-mesh.org/projects/open-mesh/wiki
Installing on the pies and the laptop was trouble free, just download the source files install some dependencies, compile, install each component. I ceated a script to setup each pi and laptop, and started that with a systemd.service file. This time only some high gain USB antennas were zip-tied, at about head height, to the nearest sapling. No ladders to climbing gear required.
I say trouble free but I trialled this for six months beforehand and ran into several issues. Mostly due do mixing BATMAN versions. Using the latest matching git versions solved almost all the issues.
I then left it to the lampy to set up his light show.
Success! Very few network issues, no call-outs in the cold mid-winter rain.
Oh! On the pie side I used £15 USB-DMX dongles and OLAD with ArtNet.
https://www.example.comhttps://www.openlighting.org/ola/getting-started/using-ola/
batsetup.sh for the pi is listed below.
#!/bin/bash
pgrep alfred
if [ ! -z "pid" ]; then
pkill alfred && pkill batadv-vis
fi
# Try to ascertain the correct WiFi device.
# First a "Rocket antenna"
meshdev=$(iw dev | awk '$1=="Interface"{print $2}' | grep wlx000f)
# If not then a Pi dongle
if [ -z "$meshdev" ] ; then
meshdev=$(iw dev | awk '$1=="Interface"{print $2}' | grep wlx086a0)
fi
# Now the internal device
if [ -z "$meshdev" ] ; then
meshdev=wlan0
fi
# What do we if there's no device?
if [ -z "$meshdev" ] ; then
echo "No suitable WiFi devices found! Quitting with error 1."
exit 1
fi
iw $meshdev set type ibss
ip link set $meshdev up
iw $meshdev ibss join <adhocnetworkname> 2432 key d:2:<password>
# replace <adhocnetworkname> with a ssid for example: rpiadhoc
# replace <password> with a password of length 5 or 13 (WEP) for example: abcdefghijklm
modprobe batman-adv
batctl if add $meshdev
ip link set up dev $meshdev
ip link set up dev bat0
batctl gw_mode client # optional if there is a gateway for internet in your network
sleep 10
alfred -i bat0 -m -p 1 &
sleep 10
batadv-vis -i bat0 -s &
All the pies had self designed UPS boards with just enough battery to allow them to power off safely after the mains power was cut each night. (10pm).
Last changed: 16. September, 2021 at 13:36
Back to OverviewComments
Add Comment
