We just added the SARADC to the wiring tool. These steps won’t be needed in the future once we merge the SARADC into the base tree.
git clone https://github.com/libre-computer-project/libretech-wiring-tool.git
cd libretech-wiring-tool
make
Merge the SARADC overlay:
cd libretech-wiring-tool
./ldto merge saradc
sudo reboot
First make sure the voltage range is confined to 0V to 1.8V, excessive voltage will damage the board.
To grab the SARADC voltage:
cd /sys/bus/iio/devices/iio:device0
cat in_voltage0_raw
cat in_voltage1_raw