PCF8574_8Relay icon indicating copy to clipboard operation
PCF8574_8Relay copied to clipboard

Use ESP8266 with 4 Channel Relay without PCF8574

Open abhishekakt1 opened this issue 5 years ago • 2 comments

Hi Deb

This is exactly what I was looking for. Thanks . I want to use the code with 4 channel relay without the PCF7574. I was using ESP8266 with 4 channel relay using Blynk app but now want to hook it up using mqtt on my new home assistant server. I understand your reason using PCF8574 as few ESP pins trigger high or low. With default behavior, as soon as I power on ESP, it used to turn on all relays. I did few search and found some code and found below code with helped me achieve what I was expecting:

4 Channel relay is connected on D0, D1, D2 and D3

`void setup() { // Debug console Serial.begin(115200); pinMode(16, OUTPUT); //D0 is GPIO 16 pinMode(5, OUTPUT); //D1 is GPIO 5 pinMode(4, OUTPUT); //D2 is GPIO 4 pinMode(0, OUTPUT); //D3 is GPIO 0 digitalWrite(16, HIGH); //Set GPIO 16 LOW digitalWrite(5, HIGH); // Set GPIO 5 LOW digitalWrite(4, HIGH); // Set GPIO 4 LOW digitalWrite(0, HIGH); // Set GPIO 0 LOW

I have put MAX DEVICES to 4 in your code with works fine but need help removing PCF7574. ` I am not good with coding so I can request you to make help me modify the code to use it with 4 channel relay without using PCF8574?

Thank you.

abhishekakt1 avatar Apr 29 '19 20:04 abhishekakt1

Not so straightforward, I will have to invest more time to do this. I would use struct to achieve this refer: https://github.com/debsahu/CeilingPotLights No promises on timeline on doing this as I'm very busy with my day job for past few weeks.

debsahu avatar May 01 '19 14:05 debsahu

Ok check out https://github.com/debsahu/PCF8574_8Relay/tree/direct_4Relay

debsahu avatar Oct 14 '19 16:10 debsahu