Which types of solenoid valves, flowmeters, humidifiers and other sensors can we use with RP and Nerves?

Hello everyone

me and my colleague are developing software for optimisation and control of fuel cell stack. Now, we got stuck on hardware part of this project and we need your help. Please see a functional block diagram on the picture here.

First of all, we used Elixir (OS Linux) for server part, so we want to use Elixir (precisely Nerves framework) on Raspberry Pi for optimisation/control and for connection with a server.
Further, sensors from 7, 8, to N are thermocouples (type K) and voltmeters/ampermeters respectively, for individual fuel cells.

So we’re now dealing with following things:

Q1: We don’t know which types of solenoid valves, flowmeters, humidifiers and other sensors will be compatibile and supported by Nerves. What is the best choice of these sensors for RP?

Q2: Which type of RP can you recommend for these purposes?

Q3: What type of bus is suitable for Nerves (or Raspberry Pi) and for all electronic devices and sensors? Is I2C suitable for this project?


Nerves runs on top of a trimmed down version of the Linux kernel, so it’s possible to get drivers for quite a few things. You can also communicate directly with devices over I2C or SPI using a library called elixir_ale. That works for devices with relatively simple interfaces. If the device is really complicated or requires accurate timing, it’s better to go with the built-in Linux driver.

We don’t know which type of solenoid valves…

I recommend that you pick one or two that fit the needs of your project based on precision, sample rate, size, price. If they support I2C, SPI, or UART protocols and the control section in the device’s datasheet isn’t completely overwhelming, then they should work on the software side. I recommend prototyping the device control pieces using on Raspbian to start. Raspbian comes with so many kernel drivers available that it can save some time when you’re in the experimentation/not sure what you’re doing phase of a project. When you know what driver you need, they when you switch to Nerves, you’ll have a better idea of what Linux kernel option to enable.

Which type of RP can you recommend?

If your device is fine with the processing power and interfaces of a Raspberry Pi Zero, that one is particularly easy to work with using Nerves. Take a look at the nerves_init_gadget project. One USB cable is used for power, IEx console access, and Ethernet.

The other popular RPi is the Raspberry Pi 3 (and the faster 3 B+). To get started with that, you can also use nerves_init_gadget, but you’ll need to configure it to use the wired Ethernet port (eth0) or WiFi (wlan0). Most people who work with the RPi3 a lot end up buying a USB->UART cable (sometimes called an FTDI cable) and switching the IEx console to the UART pins on the GPIO header. Especially early on, this can be nice for getting debug info.

What type of bus is suitable for Nerves

I2C, SPI, UART are all fairly well used. USB is sometimes an option, but it may require additional kernel drivers unless you don’t mind getting into C and libusb. There are a few projects that have used CAN with Nerves. The problem will likely be that no one has published code for some of the sensors and you’ll have to write it yourself. Frequently there’s a Python or C library that you can translate if the datasheet for the sensor is complicated.


This may be of interest -> https://www.grisp.org/

Thank you for very helpful commentary.

Thx, we’ll look at it.

Should note that Gisp is a completely different beast than Nerves. Unless you absolutely need real time performance, Nerves can offer everything you need. Please note that when i say real time i don’t mean, fast, but the literal real time definition https://en.wikipedia.org/wiki/Real-time_computing