OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) How to use analog sensor data in unified firmware program

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

    karolis
    Participant

    Hey,

    I have attached a VH400 soil humidity sensor to ospi analog inputs, and I am able to read sensor data as per this blog post:

    https://rayshobby.net/announcing-opensprinkler-pi-v1-2/

    I was hoping to use this data in the unified firmware program. Basically I need to read the value of the sensor and decide wether watering should be canceled or not. I could write a simple script to give a true/false value depending on sensor data. But how do I use this data in the unified firmware? I don’t see an option to call an external program? Am I missing something?

    thanks
    Karolis

    #43389

    Ray
    Keymaster

    If you plan to modify the unified firmware to add support for analog sensor, I believe there are two ways. One is to use the system() function to make command line calls and parse the returned result. The system commands are explained at the bottom of this page:
    https://rayshobby.net/announcing-opensprinkler-pi-v1-2/

    The second way is to leverage wiringPi’s support for PCF8591 ADC:
    http://wiringpi.com/extensions/i2c-pcf8591/

    The first way is likely the easiest, although I have not tried it in the unified firmware myself. Of course you can also write an external script and use system() function to call the script that returns simple true/false values.

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

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) How to use analog sensor data in unified firmware program