OpenSprinkler Forums Hardware Questions OpenSprinkler PCA9555 logic output setup (esp8266)

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #71106


    Hello Ray.

    First all thank you very much for this amazing project.
    I have followed the schematic of your OS 3.2 Master design to use it with a normal relay module like this picture. I’ll leave also the schematic, it is the same as OS 3.2 i didn’t change anything, and i just leave the pin out to control the relay board.

    Something that i noted is by default PCA9555 output is on high state, so when you trigger it goes to low state.

    Im wondering if i could change the logic of the output, low as default and high when you trigger. (this is what i expect)

    On the code, actual date 08/09/2021, i have edited opensprinkler.cpp file. (line 1120)

    reg = (reg&0xFF00) | station_bits[0];


    reg = (reg&0xFF00) | ~station_bits[0];

    The logic output is now changed, low as default but then some bugs they appear. When i trigger a station, actually nothing happen.
    I have been testing and there are several bugs on the spected output.

    With the oficial firmware from
    Using: os_219_rev9.bin
    Works as expected, but high as default, low when trigger. All stations works as expected.

    With the code from github
    Works the same as the oficial firmware, but station 8 acts rare, when trigger nothing happen (expected, it chanages to low like the others)

    With the code from github modified line 1120 to invert logic output.
    Default output is now low, as expected (yay!). But when i trigger nothing happen (expected, it changes to high). But here also there is something rare, station 8 is the only that goes to high, but when the time finish, it continues on high state. Then after wait 10-12 minutes, it goes to low again (i set 5 seconds for testing purpose).



    Let’s first start with PCA9555’s behavior: if you take a look at PCA9555’s datasheet, its initial state is that every pin is in input mode with an internal pull-up resistor (about 100K). So this means right after power on all the pins will be in HIGH state. This persists until you send a command to set the pins to output mode and set them to LOW state. Normally the 100K pull-up resistor isn’t strong enough to drive a real load, but it is certainly sufficient for MOSFETs or even NPN transistors to turn them on, thus activating your relays.

    To solve this problem, if you look at OpenSprinkler’s driver design:
    it has 10K pull-down resistors on each zone, this will overcome the 100K internal pull-up resistor to make sure the pins are at LOW state at power-up.

    Also, the initialization code:
    calls apply_all_station_bits() function, which internally calls PCA9555’s functions to set the pins to output mode and set them to low.

    Now, what I don’t know is whether your relay board is ‘active high’ or ‘active low’ type. Many common relay boards use ‘active low’, that means, a signal that’s LOW will activate relay. In that case, you actually want station_bits to be HIGH in order to deactivate the relay, and LOW to activate it. This is something you need to find out about your relay board because they are not all built the same.



    My relay board is active high
    Thats why i would like to change the logic output, but on the code.

    Good explanation, its a good detail that PCA9555 starts with high state when you power it on, but it last a fraction of a second when ESP8266 send a command. (this occour very fast and it doesnt have much impact).

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

OpenSprinkler Forums Hardware Questions OpenSprinkler PCA9555 logic output setup (esp8266)