OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Flow Meter wiring Reply To: Flow Meter wiring

#41345

Ray
Keymaster

@Ryan: the pressure sensor you referred to is an analog sensor, which is different from the flow sensors. Therefore you can only use the analog pins to interface with the pressure sensor, and not the rain sensor pin.

There are two possible solutions for level shifting. First, if you only care about readings between 0 to roughly 75psi, you can directly connect the sensor output to A0 without level shifting. This is because electrically I think PCF8591 can tolerate 5V (if unsure, you can connect a 1K resistor inline between the sensor and A0), it’s just that (according to the graph) beyond 75psi the output will rise above 3.3V hence will saturate the analog reading. If you don’t care about readings above 75psi, this should be fine.

The second solution is to use a resistor voltage divider that can create a 5 to 3.3 ratio, hence linearly scaling 5V down to 3.3V. For example, use a 1.7K and a 3.3K resistor to form the divider. You’d better use 1% resistors for accuracy.

Regarding the accuracy of 5V, it does affect the accuracy of the sensor reading. In practice, the error may be small enough to ignore. But if you really want to calibrate the accuracy, you can probably use A1 with a resistor voltage divider between 5V and GND. This way, you can use A1 reading to calculate the actual VIN voltage.