Getting access to prerelease versions of a platform that you know is going to sell by the million is a great opportunity to get a jump on developing a new open-source product. But it's no guarantee of success: As the team responsible for StereoPi, we soon discovered in building a new version of our stereoscopic vision systems that preliminary hardware can introduce its own quirks into the development process.
In its original single-board computer form, the Raspberry Pi was created for tinkerers and learners. But it has become increasingly used as an industrial platform: Two years ago, it was estimated that at least half of the 6 million Pi computers sold were used commercially. To aid embedded developers, since 2014 each Pi model has also been released in a minimalist “compute module" format, which eliminates the Pi's user-friendly interface sockets and header pins. Not surprisingly, it's far less common to see compute modules in maker projects, but in 2018 we took advantage of the Pi 3 version of the compute module (CM3) to create a popular compact DIY stereoscopic camera, the StereoPi. The StereoPi is a circuit board that allows you to plug in a compute module and two cameras and restores some of the standard Pi's user-friendly interfaces, such as USB connectors. Consequently, our team was invited by the Pi Foundation to develop a revised version in tandem with the development of the Pi 4 compute module (CM4).
Double Vision: The StereoPi v2 relies on the Raspberry Pi 4 Compute Module for its brains. The StereoPi provides dual interfaces for camera modules, and also supplies other external interfaces, including for video, so that a complete handheld stereoscopic camera can be easily assembled.Illustration: James Provost
Since 2013, adding one camera sensor to a Pi has been a relatively trivial exercise, with standard single-board versions equipped with a dedicated CSI (camera serial interface) port. This led to the Pi being used in many computer-vision and digital photography projects, but stereoscopic imaging was relatively neglected, despite its utility in fields such as computer navigation, and hence the creation of the first StereoPi. The specs of the Pi 4 module offered a chance for new features and other upgrades that had been requested by users of the StereoPi, so we embraced the opportunity.
For the StereoPi v2, we realized we could offer the ability to do things like create point clouds within the camera—rather than having to stream images to a more powerful external computer for processing—and simplify our existing design.
Wireless Window: The Raspberry Pi 4 Compute Module has Bluetooth and Wi-Fi hardware built in. The StereoPi team had to ensure that no occluding metal traces or planes crossed under the module's antenna in any of the four layers of the StereoPi's printed circuit board.Illustration: James Provost
For example, the CM4 has a dramatically reduced set of voltage requirements: Instead of seven different power feeds, ranging from 1.8 to 3.3 volts, the CM4 runs from a single 5-V supply, generating the different voltages needed internally and also making them available to supply external components. The CM4 also has Wi-Fi and Bluetooth capabilities built in, eliminating the need for external hardware to support wireless operation. And a system architecture change has cleared a bottleneck that affected high-speed data exchanges; with the previous CM3, USB and network data flowed through a single USB 2.0 internal hub. On the CM4, wireless, Ethernet, and USB all have independent connections.
Our team asked the Pi Foundation for two engineering versions of the CM4, along with a debug board. We then promptly bricked one of the modules by accidentally shorting a 5-V line and a 3.3-V line—we'd gotten away with such a mistake with the CM3 without causing irreparable damage, but it seems the CM4's new power arrangement is more sensitive to abuse. We became very careful about safeguarding our remaining module, triple-checking connections and ensuring that no metal debris could cause an unexpected short.
The CM4's architectural improvements meant changes in form factors. Before the CM4, compute modules looked very much like PC memory modules, and used standard SO-DIMM-style connectors (albeit with a very different wiring plan!). We were able to use a SO-DIMM slot that provided enough vertical clearance to allow us to wire up large interface connectors such as USB or HDMI ports on the opposite side of the board and not have to worry about the soldered pins poking up and creating shorts on the compute module. This let us shrink the size of the StereoPi's printed circuit board. But the CM4 switched to using a more compact DF-40 style of connector, which we couldn't find in a version that provided sufficient clearance, so we were forced to move our interface ports off to the side, lengthening our PCB.
This led to a search for smaller connectors, replacing our original full-size HDMI connector with a micro HDMI connector. Both the full-size HDMI and micro HMDI connectors are functionally identical, with 19 pins, so in a rational universe the pinouts would be the same, yes? Hahaha! No. The pinouts are permutations of each other: Pin 1 on the full-size connector is pin 3 on a micro connector and so on, which caused much scratching of heads until we realized what was going on.
Another issue was the integration of wireless connectivity on the CM4. With the CM3, we could treat it as largely a black box, but wireless signals inevitably mean an antenna. Consequently, we had to keep the exact location of CM4's antenna in mind when we were routing the traces for our circuit board. Each one of its four layers needed to have an unmetallized window beneath the antenna for optimum performance.
After that, the issues became more subtle. Developers using Raspberry Pi hardware are used to excellent documentation, but as the team was more or less working from live engineering documents we were sometimes led astray by errors. (For full details of all our major issues, you can visit our website!)
We have finally completed the new design, and by the time you read this we should have launched the StereoPi v2 on Crowd Supply. We are also working on a complete handheld stereoscopic camera kit that we expect to release shortly for those who want to get up and running as quickly as possible. But the thing my partners—Sergey Serov and Sergey Roshupkin—and I are most looking forward to is seeing the wave of cool new projects we hope are enabled by our efforts!
This article appears in the February 2021 print issue as “Stereo Vision."