LCTech 16ch relay board with 8266-12F and 2 x 74HC595
Posted: Wed Feb 02, 2022 3:38 am
Hi all,
I have a 16 channel relay controller (12v version) with an inbuilt wifi and 8266 processor, you've probably seen them around
https://www.aliexpress.com/item/1005003319135693.html
The board has 2 x 74HC595 units to control which relay(s) to turn on and off
I have managed to deduce that the pins defined in code below work and I can turn on a few of the relays.
What I don't understand is how the data needs to be formatted to send to the 74HC595 shift registers. For example I get different outcomes based on which relays I trigger first, which maybe says to me I am sending too much data and getting overflow into the next request.
I don't have a schematic for this board, but I am assuming they are wired something like the dual 74HC595 setup on this page, but I do not know. https://protostack.com.au/2010/05/intro ... g-16-leds/
Only other conversation around this board and 8266's I can find are here on the Home Assistant board
https://community.home-assistant.io/t/1 ... /368544/29
Any help would be grately appreciated.
The board:
I have a 16 channel relay controller (12v version) with an inbuilt wifi and 8266 processor, you've probably seen them around
https://www.aliexpress.com/item/1005003319135693.html
The board has 2 x 74HC595 units to control which relay(s) to turn on and off
I have managed to deduce that the pins defined in code below work and I can turn on a few of the relays.
What I don't understand is how the data needs to be formatted to send to the 74HC595 shift registers. For example I get different outcomes based on which relays I trigger first, which maybe says to me I am sending too much data and getting overflow into the next request.
I don't have a schematic for this board, but I am assuming they are wired something like the dual 74HC595 setup on this page, but I do not know. https://protostack.com.au/2010/05/intro ... g-16-leds/
Code: Select all
// LCTech 16ch Relay board with 2x74HC595 shift registers - replicates close to out of box relay testing function
int latchPin = 12; // Latch pin of 74HC595 is connected to Digital pin 5
int clockPin = 13; // Clock pin of 74HC595 is connected to Digital pin 6
int dataPin = 14; // Data pin of 74HC595 is connected to Digital pin 4
int oePin = 5; // oePin - not using this
void setup()
{
// Set all the pins of 74HC595 as OUTPUT
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(oePin, OUTPUT);
// Setup serial comms
Serial.begin(115200);
}
void loop()
{
Serial.println("Relay #16 = 0b0000");
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, 0b0000);
digitalWrite(latchPin, HIGH);
delay(3000);
Serial.println("Relay #8 = 0b0001");
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, LSBFIRST, 0b0001);
digitalWrite(latchPin, HIGH);
delay(3000);
}
Only other conversation around this board and 8266's I can find are here on the Home Assistant board
https://community.home-assistant.io/t/1 ... /368544/29
Any help would be grately appreciated.
The board: