OpenSprinkler Forums Hardware Questions Pin to monitor analog 0-5V DC Reply To: Pin to monitor analog 0-5V DC

#66302

Ray
Keymaster

1) on OS 2.3, there are a number of analog pins you can use. If you open the enclosure and look at the upper-left corner of the PCB, all the mapped out pins are there. Some are named Axx — those are all analog pins. You can choose any of them.

One important thing: all OS devices use 3.3V logic, so voltages between 0 and 3.3V will be translated linearly to a value between 0 and 1023, but anything above 3.3V will be capped at 1023. If you are trying to read a voltage that can be above 3.3V, you need a resistor voltage divider to drop it down to the 3.3V range.

2) If you have some experience with Arduino — you can simply use analogRead(pin_number) to read the analog voltage, where pin_number is whatever pin you chose in step 1. For example, if you chose A25, then use analogRead(A25).

Displaying it on the mobile app requires modifying both the firmware and the UI. Basically you can go to server.cpp->server_json_controller_main function, add a json variable and attach the analog reading result. Then in the UI read the json variable and decide where you want to display it.