Ok so I purchased an 8 relay board.
Make sure jumper is set to the right on relay board to be safe (burnt up some electronics the other way.
You will need:
Nodemcu
8 relay board
Project board
5v power supply
SN74HC595N 8bit shift register
dupont wire female to female
dupont pin headers
soldering iron
Solder Shift register on project board.
Break out all pins to pin headers
connect OE pin to GND with jumper wire and solder
connect SERCLEAR to VCC of shift register with jumper wire and solder
D4 goes to Serial Clock AKA CLOCK
D6 goes to Serial AKA DATA
D5 goes to Register Clock AKA LATCH
cut off end of 5v power supply
carefully meter for + and -
using dupont wire hook the following:
hook positive 5v to vcc on 8 relay board and VIN of nodemcu
hook gnd to all 3 devices and tie them together to ensure they are common
hook QA from shift register to in1
hook QB to in2
hook QC to in3
hook QD to in4
hook QE to in5
hook QF to in6
hook QG to in7
hook QH to in8
hook 3v from nodemcu to vcc on shift register
hook gnd from nodemcu to gnd on shift register as I said bond all common gnd somewhere along the line.
now here is the code to add 8 on/off gpio's to your nodemcu only using 3 GPIO's ;)
button relay1, [reA]
button relay2, [reB]
button relay3, [reC]
button relay4, [reD]
button relay5, [reE]
button relay6, [reF]
button relay7, [reG]
button relay8, [reH]
wait
[reA]
ss = ss xor 1
dat = ss
gosub [bitbang]
[reB]
ss = ss xor 2
dat = ss
gosub [bitbang]
[reC]
ss = ss xor 4
dat = ss
gosub [bitbang]
[reD]
ss = ss xor 8
dat = ss
gosub [bitbang]
[reE]
ss = ss xor 16
dat = ss
gosub [bitbang]
[reF]
ss = ss xor 32
dat = ss
gosub [bitbang]
[reG]
ss = ss xor 64
dat = ss
gosub [bitbang]
[reH]
ss = ss xor 128
dat = ss
gosub [bitbang]
[bitbang]
ww = dat
io(po,D4,0) 'clock
for w = 0 to 7
b = ww and 128
if b = 0 then
io(po,D6,1)
else
io(po,D6,0)
end if
ww = ww << 1
io(po,D4,1) 'clock
if w < 7 then
io(po,D4,0) 'clock
end if
next w
if w = 0 then io(po,D5,0)
end if
io(po,D5,1)
wait
The buttons function as a toggle so you push it turns on you push the same one again it turns off.
This is the basic principal of getting a shift register running on basic I hope you all can appreciate this.
-forlotto
Where I buy my ESP8266 boards from... (Banggood)