Pimoroni Flotilla and Rockpool on Ubuntu, without a Pi!

flotilla

I signed up for the Pimoroni Flotilla Kickstarter campaign (it feels like years ago now! 😉 ) and when the hardware turned up, I didn’t have a Raspberry Pi handy.

Yes, I could very easily have dug one out, but it gave me the idea – it’s a USB device, so why does it even need a Raspberry Pi? So, I plugged it into my Ubuntu PC, did a bit of light Googling (other search engines are available 🙂 ) and it turns out, that because those lovely pirates at Pimoroni like Open Source, it was very easy to make it run on Ubuntu, so here is what I did.

Why do this?

  • You just received the Pimoroni Flotilla and want to get something running very quickly
  • You don’t have a Raspberry Pi available to plug it into
  • You have a PC running Ubuntu Linux and you want Rockpool to run on that without bothering with a Pi

How Flotilla Rockpool seems to work

Rockpool provides a nice web interface to allow you to mess with all the flotilla hardware without writing any code.

“Where’s the fun in that?” you might be thinking. OK, if you want, you can program it in python instead, but then this guide is not for you!

Rockpool is fun, and it allows you to tinker very easily and get something up and running, which may be just what you want when you pull the Flotilla goodies out of their pretty bag (or impressive box, if you stumped up for the Mega Treasure Chest).

So, to run Rockpool, you just run a very simple python script, which starts a web interface, which then uses HTML and Javascript to present the Rockpool interface, which you can then use to control the hardware. BUT, before the javascript will work, you need to be running another piece of software, called a “daemon” in the background. Rockpool talks to the daemon, and the daemon controls the hardware.

Use the source, Luke!

Bet nobody’s ever made that joke before.

The daemon is unfortunately only available pre-built for the Raspberry Pi, which uses an ARM CPU architecture, so we can’t run that on our PC which uses either Intel x86 or AMD64 architecture. So, we’re going to need to build the daemon ourselves.

Fortunately, the source code is available, it’s written in C++ and has only a couple of dependencies, so we can build it ourselves easily.

The first thing we need to do is download the source code from github. If you don’t already have git installed, you’re going to need to install that first. Open a terminal and type the following.

sudo apt-get install git

Once git is installed, the following magic words will download the source code for the daemon.

git clone https://github.com/pimoroni/Flotilla-Daemon-VS.git

This will create a directory called Flotilla-Daemon-VS which contains the source code.

It really depends…

Now, before we can build the source code, we need to deal with a few dependencies.

Dependencies are libraries or other bits of code that we need to build or install before we can build or run the daemon.

The first is libserial. Unfortunately, the version of libserial currently available from the Ubuntu repositories isn’t quite bleeding-edge enough for the daemon, which needs really up to date code, which supports opening a serial port for bidirectional communication. However, the source code for the version we do want is included in the daemon source folder, so, let’s build it.

First, there are a couple of things we need to make sure we have installed (there may be others, but this is all I had to add to make it work – if you find more, let me know and I’ll update the post). Type the following:

sudo apt-get install autoconf libtool

These are a couple of build tools, from the standard Ubuntu repositories, which are needed for building the software.

Now we have those, we can do the build of libserial itself:

pushd Flotilla-Daemon-VS/libserialport
./autogen.sh
./configure --prefix=/usr/local
make
sudo make install
popd

Then, we need to install a couple more dependencies which are needed to build the daemon. Fortunately, these are available in the repositories:

sudo apt-get install libwebsocketpp-dev
sudo apt-get install libboost-all-dev

Now we can build the daemon, although there is a slight error in the Makefile which we need to correct first. A Makefile tells the compiler what to build and in what order, and there is an error in the link order in the file on github (at the time of writing).

So, open the file Flotilla-Daemon-VS/Flotilla/Makefile in your favourite text editor, find the line which looks like this:

$(CC) $(LDFLAGS) $(OBJECTS) -o $(BUILDDIR)/$@

and modify it, so it looks like this:

$(CC) $(OBJECTS) $(LDFLAGS) -o $(BUILDDIR)/$@

(Swap round the $(OBJECTS) and $(LDFLAGS) entries.)

Now we’ve done that, we can build it:

cd Flotilla-Daemon-VS/Flotilla
make

and run it (plug in your Flotilla Dock first!):

./Debug/flotilla

and hopefully you will see something like this:

daemon-runningIf you do, great! It worked! If not, check the instructions above and make sure you didn’t miss anything.

If you have trouble, post in the comments, and I’ll see if I can work out what went wrong.

Running Rockpool

Now we’ve got the daemon running, let’s run Rockpool. We’ll need to open a new terminal window for this, because our first one is busy running the daemon for us.

Type this into the terminal to download Rockpool:

git clone https://github.com/pimoroni/flotilla-offline

We don’t need to build this, because it’s written in python. We just need to tell python to run it for us:

cd flotilla-offline/rockpool
python rockpool.py

The python script will start the Rockpool web server on our machine, and then it will launch the web browser to show us the Rockpool interface. You should see a “Connect” button on there. Click it and it will connect to the flotilla daemon, then you’ll see the main Rockpool interface and you can play!

flotilla-ubuntuGood luck! 🙂

 

5 Comments


  1. Great work Steve!
    I don’t understand why they didn’t already do this if was was relatively simple to do.
    Well, you’ve saved them a job.

    Reply

    1. I think they’re just a bit busy, Tony, and supporting running on the Pi is their immediate priority.
      Happy to help with anything which scratches my itch – it’s the whole point of open source! 🙂

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *