OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Technical Documentation on GPIO / Zones?

Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #38611

    jakestevenson
    Participant

    I’m moving my old hacked-together sprinkler system to opensprinkler pi. I’d written a system that used node.js to call to an arduino over wifi, turning on and off my sprinkler zones. I’d like to be able to port that system over to opensprinkler with a minimal amount of effort.

    Is there some technical documentation about how to turn off zones programatically? Is it as simple as writing HIGH/LOW to specific GPIO ports? Or is it more convoluted? I’ve seen https://www.npmjs.com/package/ospi, and it seems to work great for writing values, but there’s no good way to query what the current status of the zones are.

    Is there any documentation about how all this works?

    #38613

    DaveC
    Participant

    The OS API documentation is in the support section of opensprinkler.com

    #38618

    jakestevenson
    Participant

    I was kind of hoping for something lower level than the API. It looks to me like the API requires running the python software somehow, and I’d prefer to manage that myself.

    #38622

    Samer
    Keymaster

    The API is available and documented for everyone to use. If you wish to control the GPIO directly, you are more than welcome to do so. Also, you may use the existing Python or C++ code to see how stations are toggled. For example, the relevant code is contained here in the Unified firmware: https://github.com/OpenSprinkler/OpenSprinklerGen2/blob/master/OpenSprinkler.cpp#L545-604.

    #38642

    jakestevenson
    Participant

    Please pardon my ignorance on this. I’m still struggling to figure this all out without just giving up and running the python interval program.

    I’ve cloned https://github.com/OpenSprinkler/OpenSprinklerGen2 onto my raspberry pi and followed the build instructions (./build.sh ospi). This generated an OpenSprinkler executable in that folder.

    When I run that executable nothing seems to be happening. That may be ok, I’m not certain. Then I went to the firmware documentation at https://opensprinkler.freshdesk.com/support/solutions/articles/5000632570-api-documentation-firmware-2-1-5-current-. It looks like it uses http for the transport layer, so on my raspberry pi I ran “curl http://localhost/jc?pw=dev” I get the message that it cannot connect to host. Is

    Does running this application actually enable the API? If so, does it do it on port 80?

    #38647

    Samer
    Keymaster

    Have you read the OSPi user manual? If not, it might help with all of the confusion. It is available here:

    https://opensprinkler.freshdesk.com/support/solutions/folders/5000149652

    That link also has two other articles:

    • Creation of SD image preinstalled with the Unified firmware you already installed
    • Updating or removing the Unified firmware

    To answer your immediate question, the default port is 8080 and the default password is opendoor. Please note if you use the app instead of just the API, the password will instead be hashed (not clear text).

    #38662

    jakestevenson
    Participant

    Thank you, I think this clears everything up now. I just had a hard time, where my brain didn’t understand the concept of “Firmware” on the raspberry pi as just another application being run, but in the context of OpenSprinkler it makes sense.

    I understand the system and have all the tools I need now thanks to your help.

    #38718

    Ray
    Keymaster

    @jakestevenson, I think you may be confusing the low-level code that sends data to the shift register vs. the web API that tells the controller to open a station through the HTTP command. For the former, OpenSprinkler uses shift register to control stations / sprinkler solenoids, the reason is this makes it much easier to expand to multiple stations without having to occupy more microcontroller GPIO pins. The code that implements the shift register operation is all in apply_all_station_bits() function in OpenSprinkler.cpp. In addition, you can check the following link to see examples of how to get Arduino to work with shift register:
    https://www.arduino.cc/en/Tutorial/ShiftOut

    The web API is explained in the Firmware API document. This allows you to open/close a station by sending an HTTP command.

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

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Technical Documentation on GPIO / Zones?