Nerves libraries & Raspbian

At some point (Real Soon Now!) I expect to receive my Maslow 4.1 “Accessible Large Format CNC Router”. And, although the M4 has its own onboard processor, I’d like to add a RasPi 5 to support additional sensors and effectors (e.g., some cameras and a laser engraver).

I don’t expect to be running Nerves on the RasPi, at least initially: I won’t need most of what Nerves offers, in terms of read-only file systems and such. So, Raspberry Pi OS is probably the Golden (read, easiest) Path.

In addition, some of the available devices (e.g., the Raspberry Pi AI Camera) seem to want Raspberry Pi OS:

The IMX500’s tight integration with Raspberry Pi’s camera software stack allows users to deploy their own neural network models with minimal effort. To get started, we’ve developed a guide to get you running either a pre-packaged or custom-made neural network model on the camera.

Still, I suspect that Nerves may have libraries to support assorted interesting devices. So, I’m wondering how decoupled these are, in general, and whether they would play nicely with Raspberry Pi OS, etc. Can anyone fill me in on the current situation and/or near-term prospects? ELI5…

1 Like

Even if you don’t use Nerves, there’s definitely still some cool libraries in the ecosystem which can help you out. If you want to connect sensors via I2C, SPI, UART or GPIO, check out the elixir-circuits (github) project. You can see on the webpage that there’s quite a few sensor drivers already published.

I’ve not used the Raspberry Pi AI camera (it might be different), but in general cameras are supported via V4L2 bindings. You can use the excellent evision project on a Raspberry Pi without Nerves. It wraps OpenCV to read frames from cameras and do a whole bunch of cool image processing. It even interfaces well with Nx/Axon/Bumblebee if you want to run ML models (albeit slowly) on the CPU.

Otherwise, running Elixir on a Raspberry Pi is just like running Elixir any other machine. You need to install compatible versions of Erlang/Elixir (use a tool like ASDF, the versions in the package manager are really out of date). You could use releases, but I think there will be some complexity with compiling for the correct architecture, especially if you use one of the libraries linked above which uses NIFs. It would be easier to just use mix.

Seems like a cool project - post back here if you make something neat with Elixir! :slight_smile:

3 Likes

Gus is entirely right about being able to use Nerves-related libraries on other Linux-based machines. Most of them can/will work. Though with Raspberry Pi OS you already have a network manager so VintageNet might not be desirable and so on.

The AI camera has on-camera processing via some Sony piece of kit and an RPi 2040. I haven’t bought one or looked into the software they offer for that. You can assume it is not entirely straightforward to get running without Python.

Now whether we can run Python under Elixir is a very interesting question… (see Cocoa’s pythonx for example)

For the AI camera I’d say you can shell out using MuonTrap to run whatever RPi OS offers :slight_smile:

2 Likes

MuonTrap looks cool, simple, and probably quite sufficient for my needs; if need be, NimblePool (or whatever) could be used to support pools of Python interpreters.

More generally, I’m very happy to hear that most Nerves-related libraries will play nicely with Raspberry Pi OS.

1 Like