What are the advantages of using 'flotilla-python'



After getting Rockpool to play nicely with Ubuntu 14.04 I though I would take a look at ‘flotilla-python’.

I grabbed:

git clone https://github.com/pimoroni/flotilla-python -b shipshape

Ran the install script and got into all sorts of choppy waters about ‘pyserial’.

I noticed in the script that it uses ‘pip’ to get ‘pyserial’

Do I need to install that first or is there an ‘apt-get install’ alternative ?
(And is it pip for python2 or python3).

I think that I’m beginning to fathom all of this out, but to make better headway I’d like to add some python goodness.

What are the advantages of using ‘flotilla-python’ ?

e.g. Would I be able to cobble something together to add a LCD screen to the Dock and use it as a Flotilla output?



yes, the install script is not ready for Ubuntu yet, I tripped over myself in several places initially and corrected some of the issues last night… a new version should be up sometime today.

that said, yes, you should install pip using apt-get, so you can install pyserial. But you’ll also need to remove the outdated pyserial that comes pre-installed with trusty.

Right now though, I don’t think the API works on Ubuntu so I would recommend you sit tight for now and come back to it at a later point.


You wouldn’t be able to add it to the Dock, but you could connect it to the Pi and merge a couple of Python examples into one whole.

In a nutshell, Python is a faster and more flexible way to interact with the Flotilla modules.


You wouldn’t be able to add it to the Dock
No… we would’n’t be able to add it, but you could…

i2c 16x2 text LCD screens are cheap enough that you could easily build a module based on one. Yes, you can display the same information on the computer screen, but that’s way less fun, and there are other ways of hooking up screens, but then there are other ways of hooking up all of the modules.

It would be a great addition to the fleet.


Funnily enough I dug one out last night !

Haven’t got a spare Pi at the moment (One in a media box and one in a Picade) so unfortunately I had to visit the PiShop.


I’ll start tinkering once the postie has been and let you know how I get along.


I wonder if you could use something like this ?

(A USB Serial LCD)


That’s neat device… not seen those. Adafruit make some great stuff, but it is expensive. You could do the same with an Arduino and an i2c LCD, or LCD shield (exactly the same display) for about 1/3rd the price, and it would be functionally identical.


I completely agree.

It’s a straightforward task to hook up an Arduino and a breadboard and LCD display.

I was thinking of ways to connect the Flotilla dock to a display.
(I’ve just ordered some USB-B breakout boards so that I can start tinkering.)

In my naivety I cant imagine it would be too difficult to get a Flotilla rope, attach it to a breadboard and a display.
(I’m sure it’d way more complicated than that.)

I think that adding a little display for showing say, a barometric graph over time would be neat.

I’m sure there a multitude of other viable uses too.


hum, the firmware space on the dock is limited, not sure using it up to drive a display type module would be the best use of it… I guess it depends what you see flotilla as.

anyhow, the dock detection on flotilla-python shipshape should now play nice on Ubuntu. Just run the install script and it should hopefully perform everything needed to get it working for you. Let us know if it does not.


Thanks for the advice.

It’s not just an LCD as an output I’m curious about. :-)

I’ve got a box full of bits from my Arduino tinkering that may be able to be used as inputs too.

Stuff like a light break sensor, a voice sensor and a knock sensor.

My Pi2 is on its way so hopefully I’ll get chance to have a play this weekend.


You’ll need an Arduino to act as the brains, and translate your sensors into something that Flotilla can understand. But what you propose certainly isn’t impossible!

Your best bet for a single value is to spoof either a Dial, or a Slider. These use i2c slave address 0x15 and 0x16 respectively and each have two registers at 0x00 and 0x01 which represent the MSB and LSB of their 16bit values.


I was thinking about one of these a General Purpose USB to GPIO+SPI+I2C.

Do you think that will work rather than an Arduino?


Nope, it wont work at all. Flotilla wouldn’t know what on earth it was talking to :D

Although Flotilla uses microB USB connectors, the protocol it talks is absolutely nothing like USB. It speaks I2C.

You’d need an Arduino, and something like this to break out its I2C lines to a microB USB connector: https://shop.pimoroni.com/products/sparkfun-microb-usb-breakout

I can’t recall the pinout off the top of my head, but Power/Ground are as normal, “ID” is unused, and D- and D+ are either SCL/SDA or SDA/SCL.

If you cast your eye back over A Brief History Of Flotilla, you’ll see we originally started just talking plain I2C with big, ugly connectors and nothing much more than a multiplexer. We’ve come so very, ver far! https://www.kickstarter.com/projects/pimoroni/flotilla-for-raspberry-pi-making-for-everyone/posts/1261840


Bumped this very old thread…

Phil, do you have any documents for the flotilla module i2c registers that I could get hold of?

I’ve been tinkering and I’ve got exactly the Dial and Slider working over i2c using your ‘clues’ in this thread. I’ve not been very successful with reading the touch module or with writes to the matrix, number, etc.

The rainbow module doesn’t even show up with i2cdetect, very strange.

I’m not expecting the complete dock firmware source, just some useful info for finding where the module registers are lurking in the depths!


That’s a massive clue as to what the driver IC is :D

I don’t have any documents I’ve written, but pretty much every part we’ve used (apart from Dial, Slider and Joystick) is standard with available datasheets, and has been used elsewhere on one of our products. Enviro pHAT, for example, has “Weather” and “Colour” onboard IIRC.

Matrix and Number are the same chip as used on Scroll pHAT (IIRC) and Micro Dot pHAT.

Touch is the same chip family as on Display-o-Tron HAT, Touch pHAT.

Most of the answers are in one Python library or another, and getting something like Matrix or Number up and running would be challenging, but especially rewarding. Neither of them do anything special, mind, like the bonkers insanity you’ll find on Micro Dot pHAT.

(Trivia: I actually prototyped a two-digit Micro Dot pHAT with an unpopulated Flotilla Matrix prototype PCB before moving onto the 6-digit pHAT layout)


Arrr, more clues!

Thanks very much, I shall continue with the tinkerage!

And that is not a clue, but a very obtuse hint at where I’m going with flotilla! ;)


Just tell me that I can’t destroy a flotilla module by writing an ‘incorrect’ value to a register, then I will be happy!

If I can irrevocably destroy a module like that then I’d rather leave the precious things alone.

You wouldn’t want to be trapped in the flotilla wreckage with no chance of escape, now would you? ;)


I’m fairly certain you can’t do any permanent damage by writing an incorrect value. I’d probably have left a trail of destruction in my wake if that were the case!

I’ve never tried fuzzing them, though, that might be an interesting thing to do and write-up :D


IS31FL3730 found (again) and read (again)
Looks like the pesky lighting effects register might be getting in the way of it actually working at the first attempt.
Alas the sands of time have run out for today, but more diving will commence tomorrow evening.
And ta very much for playing the game and making me learn without simply copying and pasting.
Now I realise that there’s a bit more going on in the dock than I originally thought. Fascinating!