OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Technical Documentation on GPIO / Zones?
Tagged: GPIO
- This topic has 7 replies, 4 voices, and was last updated 9 years, 2 months ago by Ray.
-
AuthorPosts
-
June 22, 2015 at 2:15 pm #38611
jakestevensonParticipantI’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?
June 22, 2015 at 2:46 pm #38613
DaveCParticipantThe OS API documentation is in the support section of opensprinkler.com
June 22, 2015 at 3:31 pm #38618
jakestevensonParticipantI 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.
June 22, 2015 at 7:47 pm #38622
SamerKeymasterThe 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.
June 23, 2015 at 5:45 pm #38642
jakestevensonParticipantPlease 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?
June 23, 2015 at 6:59 pm #38647
SamerKeymasterHave 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).
June 24, 2015 at 8:53 am #38662
jakestevensonParticipantThank 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.
June 25, 2015 at 6:39 pm #38718
RayKeymaster@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/ShiftOutThe web API is explained in the Firmware API document. This allows you to open/close a station by sending an HTTP command.
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Technical Documentation on GPIO / Zones?