Read moisture measurements from SEN-17731
Asked today
Modified today
Viewed 6 times
1
I am trying to read various measurements with a raspberry pi 4. I decided to use an i2c bus to keep the wiring clean and easy. For a soil moisture measurement I decided to go with the SEN-17731. Somehow I cannot find any sample code nor registers I need to address with i2c.
On the website mentioned above only the following is written:
Our Qwiic Soil Moisture Sensor utilizes the I2C protocol with the existing signals and the ATtiny85 MCU as the I2C gateway, which does all the nitty gritty stuff for you. The default I2C address is 0x28. The Qwiic connector should be self-evident, and this board also has pins broken out for SPI programming.
Apparently this code is the firmware on the ATtiny85, since they listed the git repo under “Documents”.
It which defines:
#define COMMAND_GET_VALUE 0x05
and later uses this within:
if (command == COMMAND_GET_VALUE) {
ADC_VALUE=analogRead(ADC_PIN);
ADC_VALUE_L=ADC_VALUE;
ADC_VALUE_H=ADC_VALUE>>8;
TinyWire.send(ADC_VALUE_L);
TinyWire.send(ADC_VALUE_H);
command = COMMAND_HAS_BEEN_CHECKED;
}
Tinywire seems to be an Arduino library (equivalent to SMBus for python?) but how can I address it from outside the Arduino Universe? Am I on the right path here?
ShareCite
EditFollowFlag
asked 52 mins ago

111 bronze badge
New contributor
- SparkFun Qwiic Soil Moisture Sensor – US$10$9.50 sparkfun.com/products/17731 (1) The Sensor is a simple breakout for measuring the moisture in soil and similar materials. It is pretty straightforward to use. The two large, exposed pads function as probes for the sensor, together acting as a variable resistor. The more water that is in the soil means the better the conductivity between the pads will be, resulting in a lower resistance and a higher SIG out. / to continue, … – tlfong01 3 mins ago Edit
- / continued; … (2) To get the sensor functioning, all you will need is to connect the VCC and GND pins to your Arduino-based device (or compatible development board). You will receive a SIG out, which will depend on the amount of water in the soil. (3) Note: Check the Hookup Guide below for assembly and weatherproofing instructions, as well as a simple example project that you can put together yourself! – tlfong01 3 mins ago Edit
Categories: Uncategorized