OpenSprinkler Forums OpenSprinkler Unified Firmware Couple of questions Reply To: Couple of questions

#44664

Ray
Keymaster

The way the current sensor is implemented on OpenSprinkler circuit is basically a current sensing resistor (0.2 ohm), combined with an op-amp based precision rectifier to convert AC voltage to DC voltage. So you are right that there is no amplification. Since LM358 has two op-amps in one package, and the other one is currently left unused, it’s possible to use that one for amplification. Because Arduino’s analog pin is 10-bit precision, so one bit of change corresponds to 3.3V / 1024 volt change, that divided by the resistance of the sensing resistor (0.2 ohm) leads to about 16mA, which means the precision of the circuit cannot be better than 16mA. Generally since sprinkler solenoids draw a couple hundred of milliamps, this is not a big problem.

Alternative options are to use a dedicated current sensing IC, such as ACS712.

OpenSprinkler firmware handles reading current sensor value, specifically here in the code:
https://github.com/OpenSprinkler/OpenSprinkler-Firmware/blob/master/OpenSprinkler.cpp#L771