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


  • This topic has 1 reply, 2 voices, and was last updated 4 years ago by Ray.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #66297



    I have an OS 2.3 that irrigates from a large tank.
    I already have a sensitive pressure sensor at the bottom of the tank and near OS I have a digital voltmeter that measure 0 to 5 V DC (tank is full at 2V or something like that). I currently monitor the level via an IP cam that frames the display, not fancy.
    I would like to see the water level in the controller page. I don’t need any complex feedback, just a calibrated number to show liters or % somewhere in the web page.

    1) hardware question: which pin should I connect the positive terminal from the sensor?
    2) software question: I can read C++ and make small alterations to the code, especially if it’s a matter of cloning existing code and change it a bit. How difficult would be to read the analog voltage (do you do that already in other parts of the code?), and display it in the controller web page? And the same would apply to what I see from the mobile app?

    Thanks for any insight you may have



    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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

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