Riot-os Drivers for actuators in IOT

Hi everyone and thank you for reading this. I am developing a small project using RIOT OS in Ubuntu. I have added two analogical sensors to the main board, an STM32F401RE. This work and display the values measure by the sensors. Now I would like to know how to add an actuator, actually a small summersion 5V water valve. what must be added into the make file and what library to include into the main.c ? Thank you very much for your help. Bye

SAUL is probably the way to go. The best way forward is probably to add another board with your sensor. You can add the driver configuration to the board description. Just take a look into the ruuvitag. You can pretty much copy the way how it is done there. With your drivers, of course. Just flash the SAUL example with your board configuration. You should be able to read the actuators via the shell. You can also just add the configuration to your application and the dependencies in your app makefile, but it’s cleaner, from my point of view, to just define another board.

You would be able to drive the valve using the gpio interface. For the main.c

#include "periph/gpio.h"
#include "xtimer.h"
#include <stdio.h>

static const gpio_t pin_valve = GPIO_PIN(PORT_A, 10);

if (gpio_init(pin_valve, GPIO_OUT) < 0) {
    puts("Error while initializing GPIO pin_valve as output\n");
    return 1;
// Set the pin to 0V
xtimer_usleep(1000 * US_PER_MS);
/ Set the pin to 3.3V

For the Makefile just add:

FEATURES_REQUIRED += periph_gpio
1 Like