Rich_Morin

Rich_Morin

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…

Most Liked

gus

gus

Nerves Core Team

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:

lawik

lawik

Nerves Core Team

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:

Rich_Morin

Rich_Morin

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.

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement