OpenSprinkler Forums OpenSprinkler Unified Firmware Change Firmware to control stations directly via GPIO pins (relays)

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #69430

    Tobasco
    Participant

    Hi,
    after my beloved OS Bee died and I couldn’t fix it, I decide to set up a new one based on an “ESP8266 WIFI 4 Channels Relay Module AC/DC ESP-12F Development Board”.

    The flashing, WiFi connection and OLED Display works already, now I want to change the firmware to control the 4 relays via the GPIO pins

    1. GPIO16 (D0)
    2. GPIO14 (D5)
    3. GPIO12 (D6)
    4. GPIO13 (D7)

    May you give me a hint, which part of the code I have to change so that Station 1 to 4 is linked to this GPIO pins?

    salute
    Thomas

    #69440

    Tobasco
    Participant

    Hi,
    I solved my problem by replacing apply_all_station_bits() with custom code to control the GPIO pins for the relays:

    void OpenSprinkler::apply_all_station_bits() {
      const uint8_t stationGPIO[] = {16, 14, 12, 13};
      for (uint8_t i = 0; i < 4; i++) {
        pinMode(stationGPIO[i], OUTPUT);
        digitalWrite(stationGPIO[i], station_bits[0] & 1 << i ? HIGH : LOW);
      }
    }

    salute
    Thomas

    #73967

    Gompka
    Participant

    Hello Thomas,

    can you elaborate on which file in the firmware this line of code should be changed? Is it in opensprinkler.h?

    #73968

    Tobasco
    Participant

    Ho Gompka,
    it’s in the file OpenSprinkler.cpp, just search for void OpenSprinkler::apply_all_station_bits() {

    You can find a fully working variant for the ESP8266 WIFI 4 Channels Relay Module on my Github account (with more information about the hardware setup):
    https://github.com/ThFischer/OpenSprinkler-for-ESP12F_Relay_X4#readme

    salute & happy engineering
    Thomas

    #73969

    Gompka
    Participant

    Thanks for the quick reply, I will definitely take a look at the github. I was running a raspberry pi which failed and figured I would move to esp8266 since I have plenty of them.

    #73970

    Tobasco
    Participant

    Good choice!
    A Raspberry PI is kind of oversized just to run Opensprinkler.

    There is also another branch where I used a normal NodeMCU Lua Lolin V3 and a 8Ch Relay board:
    https://github.com/ThFischer/OpenSprinkler-for-ESP12F_Relay_X4/tree/NODEMCU_74HC595/NodeMCU-74HC595#readme

    #74383

    vamp
    Participant

    Hello there

    I dont know how is the maintainer this github branch, (maybe Gombka?) but refer this forum theme.

    https://github.com/solideus/OpenSprinkler-ESP8266-WIFI-4-Channels-Relay-Module-AC-DC-ESP-12F-Development-Board

    My question is:

    Are you plan to update to (11) your code? The Weather check error, that fix the 11 version is also affect to me. It would be good that update it.

    Thanks a lot!!

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

OpenSprinkler Forums OpenSprinkler Unified Firmware Change Firmware to control stations directly via GPIO pins (relays)