piezo sensors to OSC messages
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nonmateria 2dff5c503e fixes cli option in README 5 months ago
bin gitkeep 5 months ago
hardware updates links 6 months ago
src cleaning 1 year ago
.clang-format cleaning 1 year ago
.gitignore initial version 1 year ago
LICENSE.md initial version 1 year ago
Makefile cleaning 1 year ago
README.md fixes cli option in README 5 months ago



This is a system composed by a shield to mount on the raspberry pi and a server application for translating piezo sensors signals into OSC messages.


rpiezos [options]

option list:

-i [destination IP] : sets the destination IP address, localhost if not given
-p [destination port] : sets the destination port. This is mandatory to set.
-a [destination address] : sets the destination OSC address. defaults to /piezo
-s [piezos options] : sets the active piezos and range, see below     
-u [usec sleep] : sets the delay in the main loop in usec, defaults to 500     
-v [verbose] : activate a verbose output, doesn't need any argument      

after the -p option you can give a list of number from 0 to 5, to activate the correlated sensors, optionally you can add some : to set ranges, value outside the ranges won't be sent. For example:

rpiezos -p 12345 -s 012345

sends all the sensors values to localhost:12345

rpiezos -i -p 3333 -s 01:10:512

sends sensors 0 and 1 values to, only if the values are from 10 to 512

rpiezos -a /test -p 3333 -s 2:10:1024 -s 3:5:1024

sends messages to localhost:3333, at the OSC address /test, sends just the values from 10 to 1024 of sensor 2 and from 5 to 1024 of sensor 3.

The messages will be sent to the set address (default to /piezo) and they will have two arguments: an int for the sensor number and a normalized float for the signal value (low-high 10 bit range is remapped to 0.0f <--> 1.0f ).


First, remember to enable SPI with sudo raspi-config or by putting dtparam=spi=on into your /boot/config.txt.

Then you need liblo installed (included dev packages) in your system, then you can build with make. On raspian buster for example:

sudo apt-get install build-essential
sudo apt-get install liblo7 liblo-dev
git clone https://git.sr.ht/~npisanti/rpiezos
cd rpiezos 

then you will have an executable in bin/rpiezos.


For more info on how to build the hardware, go to the hardware readme.

Thanks to

Dario Longobardi's ofxGPIO, most of the code is ported from the mcp.h file.


Nicola Pisanti MIT License 2020.