I wanted to document here that Flotilla isn’t quite yet ready for the electro-bin as you might think from some places on the net.
It works really well on Raspberry Pi OS Bookworm in 2024 – and as a smaller project it’s even less bulky than it was before.
It seems it’s only lovely Rockpool/Cookbook which has ceased to work due to incompatibility with the modern OS. The Flotilla hardware works just as it did, without needing any modification or new stuff, and it all functions excellently with Python. As you’ll find elsewhere on this forum, the protocol was wisely designed and if you want to, you can talk to the hardware at a fairly low level. We’re likely going to be able to use the Flotilla hardware for a long time.
No one could argue that Python’s as intuitive as Rockpool, but it can do loads more and the Pimoroni library does a good job of making things more slick. For Python you don’t need to use any installer scripts, no background processes need to run and the whole library is tiny at about 50kB.
Without the Flotilla library present, in Python, typing:
import flotilla
generates:
ModuleNotFoundError: No module named 'flotilla'
… as you might expect.
To fix this, first download the code available from the official archive: https://github.com/pimoroni/flotilla-python/ – click on the green ‘<> Code’ button and choose ‘Download Zip’.
Expand or extract the Zip file to turn everything back to normal files and folders, then navigate to flotilla-python-master/library. Copy the whole ‘flotilla’ directory/folder (and all the files in it) from there to whichever folder you want to run your Python code from.
As long as the intact ‘flotilla’ directory/folder is saved next to your Flotilla code file(s), Python will find the code it needs, even if it’s not installed system wide.
Depending on what else is installed on your system, Flotilla may just work now. If you’re missing the Python serial library, the first time you try to ‘import flotilla’ you’ll see this message:
This library requires the serial module
Install with: sudo pip install pyserial
… but don’t type that, because the old ‘pip install’ method has changed in Bookworm and we now need to use the system-wide apt tool to manage Python packages better. I was testing on the ‘lite’ version of Raspberry Pi OS – it doesn’t have pip included by default, and although I could install it, the following is a way to avoid needing it.
So instead, in a Terminal (not Python), type:
sudo apt install python3-serial
If you’re not sure why you’d use that command, you can type:
apt search pyserial
first to see why.
The downloaded Zip file has a folder full of examples in there – beware though, some are either slightly unfinished or designed to be puzzles for coders. Just copy them next to the flotilla folder and run them to see what they do.
Updating the dock’s firmware may be trickier, but not impossible – 1.14 appears to be the latest.
You can check your firmware in Python with:
import flotilla
f = flotilla.Client()
f.dock_version
1.14
… so I’m on the latest (phew)
Tested in Python:
- 3.12.1 MacOS
- 3.11.2 Raspberry Pi OS Bookworm ‘Lite’
- 3.10.12 Linux Mint (essentially Ubuntu/Debian)
On other platforms, install pyserial as appropriate, otherwise it’s the same process – place the flotilla folder next to your code and you’re off!