OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) GPIO stations not visible in e1bc80f7b22f191b58bc6e1529f85e836aa94aa7

  • This topic has 6 replies, 4 voices, and was last updated 6 years ago by Ray.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #41864

    kristoffer_1
    Participant

    Hi
    I have updated my opensprinklerPI to latest version git hash “e1bc80f7b22f191b58bc6e1529f85e836aa94aa7”.
    I can not find where I change the station to be a GPIO.
    I want to control a DC pump connected to a GPIO via a relay.
    So therefore would this feature be very good to have.

    Done the following
    git pull
    ./build ospi
    and rebooted the raspberry

    git log shows
    ***************
    commit 0bfef45cef12282b7f8e9d0e4de451c96325f78d
    Merge: a628569 e1bc80f
    Author: Ray <[email protected]>
    Date: Tue Feb 2 21:46:57 2016 -0500

    Merge pull request #28 from PeteBa/master

    Add GPIO Station support

    commit e1bc80f7b22f191b58bc6e1529f85e836aa94aa7
    Author: Peter <[email protected]>
    Date: Sat Jan 23 20:39:00 2016 +0000

    Enable GPIO stations for OSPi only
    **********
    The source code is up to date.
    **********
    About page
    App Version: 1.4.9
    Firmware: 2.1.6(1)
    Hardware Version: OSPI -AC

    What have I missed ?
    Regards Kristoffer

    Attachments:
    #41868

    Peter
    Participant

    Kristoffer,

    The GPIO functionality requires both the latest Firmware and the latest UI. You have downloaded the functionality to control the GPIO pins in the Firmware but you really need the latest UI web pages to easily access and configure the functionality. I know Samer and Ray are looking to package this up in a future release so the two options below are a bit of a work-around until then.

    1) You could upgrade to the latest UI from Samer’s GitHub (OpenSprikler-App) but would need to host the webpages on your RPi rather than relying on the version that is provided from the OpenSprinkler server. The instructions for doing this are on the OpenSprinkler support page: (here). This is non-trivial and requires a certain level of Debian/web knowledge.

    2) An alternative, given that you have already updated the Firmware, would be to configure the station directly in the Firmware by sending an api command. The api documentation is on the OS support pages: (here).

    As an example, the command http://ospi_ip:8080/cs?pw=PASSWORD&p0=16&sid=4&st=3&sd=080 can be sent to the Firmware via a web browser and will set Station 5 to be a GPIO Station using GPIO08 and active low logic. In the example, we first enable the “special” flag on Station 5 with the parameters p0=16 noting that the 0 after the p refers to the first board of 8 stations and the 16 is binary for the 5th Station on that board; we then use sid=4 to tell the firmware that the following st and sd parameters refer to Station 5 (i.e. sids go from 0-7 and are therefore one less than the station’s labels); st=3 specifies a GPIO Station type; sd=080 specifies GPIO pin 08 and active low.

    You would also need to substitute ospi_ip with the IP address of your RPi and PASSWORD for the MD5 hash of your OS password (or turn off password checking by selecting Edit Options/Advanced/Ignore Password from your OSPi homepage).

    Happy to help get this working for you if you need any assistance.

    Cheers, Pete

    #42145

    mrgreen
    Participant

    Hello Pete,
    i just saw your work around for using the gpio pins of a raspberry pi. thanks a lot for your post. it saved me a lot of time :). i am now able to use one gpio for switching a relay. is ist possible to use more than one gpio? if i sent a different command to the firmware via my web browser it overwrites the first one.
    thanks for your help
    regards Jan

    #42150

    Peter
    Participant

    Jan

    So it took me a while to understand the /cs api call, particularly, when trying to set multiple “special” stations. The easiest approach I found was to break it down into discreet steps. Firstly, set the required stations to be “special” and then configure each of those stations to the desired gpio pin.

    As an example, lets say we want to set both S01 and S05 (i.e. sid 0 and 4) to be gpio stations using pins 7 and 8 respectively with active low relays. Then firstly, we use the /cs api call to set the p0 variable to the bitwise OR of the multiple stations i.e you would set p0 = 17 (which is 00010001 in binary) to turn the special flag “on” for sid 0 and 4. You can then follow this with two /cs calls to configure the gpio pins.

    So the full sequence of api calls in this example would be:

    http://rp2:8080/cs?p0=17
    http://rp2:8080/cs?sid=0&st=3&sd=070
    http://rp2:8080/cs?sid=4&st=3&sd=080

    To ensure that you have things set correctly then you need to call:

    http://rp2:8080/je

    Note that I have set “Ignore Password” through the UI, you may need to include your MD5 password hash to the above api calls.

    Hope that help,
    Pete

    #42184

    mrgreen
    Participant

    Thanks a lot for your detailed and easy to use description. Now it is perfectly working. :).

    #42627

    Peter
    Participant

    A quick thanks to Ray and Samer, configuration of GPIO Station and Zimmerman baseline conditions can now be accessed via the latest version of the App. You will need to download the latest version of Firmware 2.1.6(2) from Ray’s github and do a ./build.sh to enable. Cheers, Pete

    #42656

    Ray
    Keymaster

    And thanks to Peter for working on this feature in the first place!

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

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) GPIO stations not visible in e1bc80f7b22f191b58bc6e1529f85e836aa94aa7