Decentralized robotic fish – swarming and swimming with the Raspberry Pi Zero

Image courtesy of Self-organizing Systems Research Group

Researchers from the Self-organizing Systems Research Group at the Harvard John A. Paulson School of Engineering and Applied Sciences and the Wyss Institute for Biologically Inspired Engineering have created a swarm of robotic fish that can behave and adapt just like real fish (or at least an approximation of real fish!).

Each fish, called Bluebots, has on-board a Raspberry Pi Zero W and two camera modules, allowing stereoscopic (3D) vision. The Zero in each fish is attached to an Arducam Multi-camera adapter so that it can use the two camera modules at the same time.

Each Bluebot operates independently, using its cameras to spot LEDs on each of the other fish and coordinate its behaviour with its nearest neighbours. This leads to pseudo-emergent behaviour as the fish collaborate on a goal. This can be anything from following each other in a shoal to spotting food being dropped from above to doing more complicated things such as search-and-rescue. The Bluebot is armed with little more than the knowledge that the LEDs on the other robots are a specific distance apart. Very impressive stuff!

“Each Bluebot implicitly reacts to its neighbours’ positions,” explains Florian Berlinger, a PhD candidate at SEAS and Wyss and first author of the research paper, per a press release. “So, if we want the robots to aggregate, then each Bluebot will calculate the position of each of its neighbours and move towards the centre. If we want the robots to disperse, the Bluebots do the opposite. If we want them to swim as a school in a circle, they are programmed to follow lights directly in front of them in a clockwise direction.”

You can see a presentational video of the project below and read a lot more about it over at Harvard, IEEE, Wired, Gizmodo and Arducam. You can also read the team’s full paper over at Science Robotics, but you do have to be a subscriber for that.

Warning: the video below contains flashing lights which, frankly, gave me a headache, let alone anyone with visual/mental problems relating to that sort of thing!

Play Tetris on your Raspberry Pi Pico using this add-on board from Pimoroni

 

A Reddit user called Jools64 has created a fully-playable demo of the game Tetris using a Raspberry Pi Pico, the newest board from Raspberry Pi. It uses a Pico Display Pack from Pimoroni to show the game and the four included buttons carry out the usual actions of left, right, twist and drop.

You can find the code for the game here, on PasteBin.

The original Reddit post can be found here, together with a demo video of the game in action.

Thanks to Ash Puckett over at Tom’s Hardware for spotting this!

Connect your Raspberry Pi Pico to a MIDI output socket and play some Bach!

DIY electronic music enthusiast Kevin, who you can find on Twitter, has been experimenting with the new Raspberry Pi Pico and taking what he calls “a first look” at its capabilities in the electro-music arena. With a bit of MicroPython and via some wiring-up to a MIDI output socket, he’s managed to get the Pico to play Bach’s Prelude in C Major! You can see the playback in the video below and you can see a full description of the set-up (including wiring, via a Fritzing diagram), on his blogPlease note his warnings and caveats about what socket/module to use in particular, resistor values etc.

 

CircuitPython from Adafruit runs on the Raspberry Pi Pico

Image from Les Pounder on Twitter!

As highlighted by Les Pounder on Twitter and again by ‘tannewt’ (Scott Shawcroft) on the Raspberry Pi Forums, Adafruit’s CircuitPython will run on the Raspberry Pi Pico and, more generally, RP2040 boards, such as Adafruit’s upcoming Feather 2040.

According to this post on the Forum you just follow these instructions:

You load it just like loading MicroPython.

While CircuitPython is based on MicroPython, there are some key differences why you may want to use CircuitPython instead of MicroPython.

  1. Editing code is simpler because CircuitPython presents a CIRCUITPY drive with a code.py file on it you edit. When you save the file, your code is automatically rerun. See Welcome to CircuitPython for details.
  2. There are 260+ libraries for the standard CircuitPython API. Most of these will already work. Listed here
  3. Tons of guides and tutorials at https://learn.adafruit.com/category/circuitpython
  4. Most CircuitPython libraries also work on Raspberry Pis via the Blinka library.

You may want to use MicroPython for:

  1. Advanced APIs such as interrupts and threading.
  2. Complete PIO API (CircuitPython’s support is incomplete)
  3. Using existing MicroPython code

To get started, download CircuitPython for the Pico from circuitpython.org: https://circuitpython.org/board/raspberry_pi_pico/

For now, click “Absolute Newest“, then click your language code such as “en_US”, and finally download the UF2 file at the top. That will be the latest and greatest version of CircuitPython. As support matures, the download page will have beta and then stable releases.

After dragging the CircuitPython UF2 to RPI-RP2 the chip will reset and show a CIRCUITPY drive.

See the Welcome to CircuitPython and CircuitPython Essentials guides for CircuitPython basics. API Docs are here though they won’t include RP2040-specific modules until support is merged in. A Pico specific guide that will grow in time is here.

Join the Adafruit Discord for #help-with-circuitpython and feel free to mention Scott Shawcroft (@tannewt) for RP2040-specific questions.

The current code is available here: https://github.com/adafruit/circuitpython/pull/4031

Raspberry Pi Pico – a surprise, yet very exciting, new product from Raspberry Pi

Today, Raspberry Pi has announced the launch of their new board – and what a surprise it is! It is their first micro-controller and is called the Raspberry Pi Pico!

Raspberry Pi Pico has been built around Raspberry Pi’s own silicon, developed in-house by them over the last few years. The chip, the RP2040, is a dual-core ARM Cortex M0+ processor, with a flexible clock running up to 133MHz.

Key features:

  • RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom
  • Dual-core ARM Cortex M0+ processor, flexible clock running up to 133 MHz
  • 264kB of SRAM, and 2MB of on-board Flash memory
  • Castellated module allows soldering direct to carrier boards
  • USB 1.1 Host and Device support
  • Low-power sleep and dormant modes
  • Drag & drop programming using mass storage over USB
  • 26 multi-function GPIO pins
  • 2×SPI, 2×I2C, 2×UART, 3×12-bit ADC, 16×controllable PWM channels
  • Real-time clock (RTC)
  • Temperature sensor
  • Accelerated floating point libraries on-chip
  • 8×Programmable IO (PIO) state machines for custom peripheral support

Here’s the full datasheet with a lot more technical detail.

It runs both C/C++ and MicroPython and you can see a pinout of this very capable little board below:

One of the most impressive things about the Pico is the price – just $4/£3.60 or thereabouts.

You can read the full Raspberry Pi announcement here.

You can buy the Pico from The Pi Hut, and of course from the pirates at Pimoroni and other official resellers. Pimoroni, in particular, have gone all-out to release a set of extras – check them out here.

Pimoroni have also been working on the tinyest 2040-based board called the Tiny 2040 – it’s coming soon and is the size of the end of your finger!

If you subscribe to Hackspace magazine, or you’re lucky enough to find a copy in a newsagent/supermarket, there is a FREE one on the cover this month!

There’s even a book to help get you started – which you can buy here or download for free here.

Thinking to yourself “oh, it’s just a microcontroller”? Take a look at Dave Akerman’s post in which he uses the Pico as a high altitude balloon tracker! Take a look also at Russell’s experiments with Pimoroni breakout garden displays!

For a review of the Pico, take a look at Les Pounder’s piece over at Tom’s Hardware.

Take a look also at Jeff Geerling’s blog for his review. He highlights one of the flaws with the Pico – a lack of pin labelling on the top of the board which means that once it’s plugged into a breadboard, or even a carrier board, you have to consult a pin-out to find out which pin’s which. You can check out his review video below:

Here’s a lovely close-up picture of the new silicon, courtesy of The Pi Hut.

Pi Wars 2021 – Online Conference tickets now on sale! – Event is on 23rd & 24th January

Pi Wars 2021 at Home Conference logo

The Pi Wars team is delighted to announce that tickets for our 2021 Online Conference are now available. They are free but everyone viewing the Conference must have one. That’s one per device watching. You will need to register for the Hopin.to platform to get your ticket and get access to the Conference content.

There are two types of tickets, so please make sure you get the one that is appropriate for you and your viewing group:

  • Under 18s – please ensure you have permission from a parent or guardian to attend.
  • Adults – there is another type of ticket for you.

If you are a speaker or a member of a panel, please hold off for now as we will contact you to get you on the system by a different route.

You can get your tickets here.

A provisional running order for the two-day Conference is available here. Please note, this is subject to change, addition and refinement as we get closer to the event.

Please note, everyone is expected to agree to and abide by our Online Code of Conduct when attending the Conference.