OpenSprinkler › Forums › Hardware Questions › DIY Kit Assembly Questions › Homebrew firmware hacking for latch mode without an expander › Reply To: Homebrew firmware hacking for latch mode without an expander
Ray
Given that the firmware already supports Latch type of OpenSprinkler 3.0, you can simply modify apply_all_station_bits and also latch_apply_all_station_bits:
https://github.com/OpenSprinkler/OpenSprinkler-Firmware/blob/master/OpenSprinkler.cpp#L994
https://github.com/OpenSprinkler/OpenSprinkler-Firmware/blob/master/OpenSprinkler.cpp#L971
You can certainly create a new hardware type as you said, and instead of auto-detect the type, you force the hardware type to be the new one you created. I don’t think you need to use GPIO station — changing those functions are more complicated than just modifying apply_all_station_bits and latch_apply_all_station_bits.
If it’s not a requirement to use unified OpenSprinkler firmware, you may also consider basing the work on the OpenSprinkler Bee firmware — it also uses ESP8266 and was designed to operate 3 zones. It’s easy to extend it to operate 4 zones as in your design.
Both OpenSprinkler and OSBee firmwares make use of I2C OLED. Your design does not seem to have an OLED display, and you use SDA/SCL lines as GPIO pins. So you will need to remove/comment out sections of code that handles I2C otherwise those parts of the code will end up interfering with your GPIO operations.
Also, be careful with using relays — I’ve previously had a version of OSBee using relays, it turns out the relays must support a relatively large amount of impulse current. I initially used a small relay rated at 2A contact current, that didn’t work. I had to change to a larger relay rated at 10A contact current, and that worked. Given that relays are very bulky, most latching circuits instead of transistor or MOSFET-based H-bridges, which are much more compact.