I have this 16 channel relay board from ebay, it looks like the one from SainSmart but it’s a 5v one.
The board includes an ESP-12 module with the PCF8575 i/o expander soldered together on a small PCB, it connects right on the 20 pin header of the relay board.
I was planning on desoldering the ESP-12 module off the PCB board then flashing it either with the nodeMCU or a FTDI converter to ESPHome and then try to code it in home assistant. I am having a hard time reading the wiring diagram of the board but if I understand correctly the i/o expander connects to SCL/SDA (GPIO5 and GPIO4?) and VCC + ground?
Will something like this work if I flash it with ESPHome or is there something I’m missing?
Use continuity tester and check if GPIO4 and GPIO5 beeps at contacts SDA and SCL. It shouldn’t be that hard… you don’t really need schematic for this since you only need to find those two pins, correct?
When you find those two connections it shouldn’t be any problem running with esphome. I didn’t explore much but it could be that you’ll have to define addresses, since you have two chips on board, if i see correct.
Good point to check for continuity. But is it really necessary if I am only flashing the ESP-12 and then soldering it back in its original position? The connections from ESP to i/o expander remain the same, SDA and SCL from i/o should go to GPIO 5 and GPIO 4 of ESP, then I just define the connection in ESPHome, right? I see no other way of connecting it.
The other chip on the back of the board is a voltage regulator.
I just wanted to make sure I’m not missing anything before I start to take apart and potentially ruining a working product.
The ESP8266 doens’t have hardware I2C pins, but it can be implemented in software. So you can use any GPIOs as I2C. Usually, the following GPIOs are used as I2C pins:
The only reference I can find on a board that looks the same uses ULN2803 relay drivers though none of the images I have seen are clear enough to read the chip ID.
OK, found an image of the real (?) Sainsmart board and it has relay drivers.
I was wondering if that was possible, didn’t want to risk anything and thought it would be the safer option to take out the board before anything. But thanks so much! That makes it a lot easier.
I can’t find my FTDI converter and I tried flashing it with a nodemcu, but I can’t get it to work. I followed "Brian Lough"s video on youtube with both 100uF and 10uF capacitors but the led on the ESP12 doesn’t blink. So I will be waiting for the new FTDI converter.
Did you remove esp board and checked that chip at the bottom side is indeed pcf8575? Just to be sure…
I see that on esp module there are pins 3V3, G, T, R, 0 and 2. It’s all you need for flashing. Solder wires to pins G, T, R and 0. Connect: pin G to FTDI ground, pin T to pin Rx and pin R to pin Tx of FTDI. Hold pin 0 to GND while powering the board (use power supply 12V or 5V on blue connector). That way you’ll enter programming mode.
If you didn’t find sda/scl pins with beeper then some trial/error will be needed… you can’t burn anything by trying… but i’d still rather find them. Scl pins on PCF8575 is pin 22 and sda is pin 23 (on ssop casing). You can find esp01 pinout on google to see where gpio4 and 5 are. Then just “beep” them to check out.
It was not necessary to remove the ESP12, the pcb module had two sides it was on the opposite side of the ESP. I got the FTDI converter now, but I must have ruined the ESP12 module while trying to flash it with the nodemcu because the it won’t flash and the led on it is dead.
Luckily I ordered a PCF8575TS module at the same time. I hooked the relay board up to 5V 2a power supply, and powered the nodemcu and pcf module off the relay board.
1 issue I’m having is that the i2c address of the pcf module keeps changing, I thought it was supposed to be 0x20 but I’m getting 0x21-0x25. There are solder pads under the pcf module (a0-a1-a2) but I’m not sure what the address should be set to? I can change state of individual relays for a minute before the address of the pcf changes.
2 issue is that after connecting more than 10 relays it seems to stop connecting all together, I can’t switch state on any relay suddenly, this seems like a power supply issue to me but shouldn’t 2a be enough for this application?
Thanks for the help guys! I didn’t want to start a new thread as it’s kind of the same subject but someone let me know if I’m wrong
It doesn’t really matter which address you have set if you have only one module. The main point is that A0-A1-A2 must be polarized: either tied to GND or to +Vcc, so make sure you have that - either directly or via resistor.
2A should be more than enough for more than 10 relays, i agree. Try to measure voltage when energizing relays to see if it drops…that should indicate….bad supply…?
I tried soldering A1-A2 pads first and now A0-A1-A3 but the voltage regulator on the PCF8575 module is burning up now. Which pads am I supposed to solder exactly?
Edit: Also I forgot to mention about 2 seconds after power up all leds on relay dim and the relay board starts making a constant low volume buzzing noise.
From pics i see that neither of address pins are connected to anything, that’s why address floats. For each address pin: solder either left and center, or right and center pad. Left pads are +Vcc, right pads are GND, center pads are chip inputs. Just don’t connect all three together!
Thanks so much for the great help Pavel! My bad I rushed it a bit, now I connected the center and right pads and got 0x20 address and its not floating anymore.
No, because I think the original esp module that came with the board was defective.
Instead I connected to the board with an Esp8266 and i/o expander. It’s the same concept if you get to flash the original module.
Check out documentation for PCF8574 on esphome.io