Shift Register output (e.g. 74HC595, TPIC6B595)

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
RalfE
New user
Posts: 5
Joined: 12 Sep 2021, 01:31

Shift Register output (e.g. 74HC595, TPIC6B595)

#1 Post by RalfE » 12 Sep 2021, 01:43

Is it possible to implement support for shift registers e.g. 74HC595 or the Power Logic version TPIC6B595 or similar?
Or are there already other possibilities / tricks to connect them to ESP Easy (via rules)?

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Shift Register output (e.g. 74HC595, TPIC6B595)

#2 Post by Ath » 12 Sep 2021, 13:57

Currently, those shift registers aren't supported in any plugin (AFAICS).
Using a lot of code, it will be possible to manipulate GPIOs in a way that the outputs go as you need, but as the rules do not have 'while' or 'for' support (yet), that is 'somewhat tricky', to say the least :shock:
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Shift Register output (e.g. 74HC595, TPIC6B595)

#3 Post by TD-er » 12 Sep 2021, 21:46

We do have the msec loop timer and you can keep track of the state in a variable.

Still "somewhat tricky" is a bit of an understatement.

RalfE
New user
Posts: 5
Joined: 12 Sep 2021, 01:31

Re: Shift Register output (e.g. 74HC595, TPIC6B595)

#4 Post by RalfE » 12 Sep 2021, 22:46

Still "somewhat tricky" is a bit of an understatement.
That's exactly why my question.

There are solutions for everything, but the effort has to match.

ESP32 and output driver are of course also possible ...

Only for the small 8266 would the possibility of being able to use more outputs simply by means of a shift register without much effort, even with the corresponding switching capacity (6B595), enable further applications.

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Shift Register output (e.g. 74HC595, TPIC6B595)

#5 Post by Ath » 12 Sep 2021, 23:18

Well if the max. nr. of gpio's is an issue, then an I2C port expander, like the MCP23017 (16 gpio's) or PCF8574 (8 gpio's), would be even better, as they only require 2 ESP gpio pins (SDA/SCL), where such shift register would best be controlled using 4 gpio's. And the PCF and MCP are already fully supported by ESPEasy, and multiple of these can be used, as they have easy changable addresses.
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Shift Register output (e.g. 74HC595, TPIC6B595)

#6 Post by Ath » 12 Sep 2021, 23:20

TD-er wrote: 12 Sep 2021, 21:46 Still "somewhat tricky" is a bit of an understatement.
That's why I quoted it :P
/Ton (PayPal.me)

RalfE
New user
Posts: 5
Joined: 12 Sep 2021, 01:31

Re: Shift Register output (e.g. 74HC595, TPIC6B595)

#7 Post by RalfE » 12 Sep 2021, 23:58

For cheap and simple, the PCF8574 also has disadvantages (initial state, max 20ma, ....).

I would like to switch a slightly larger number of relays and solenoid valves (100mA) with the least possible effort ...

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Shift Register output (e.g. 74HC595, TPIC6B595)

#8 Post by Ath » 13 Sep 2021, 08:21

RalfE wrote: 12 Sep 2021, 23:58 For cheap and simple, the PCF8574 also has disadvantages (initial state, max 20ma, ....).

I would like to switch a slightly larger number of relays and solenoid valves (100mA) with the least possible effort ...
That are indeed valid arguments, I'll see if I can mock something up, but I only have evenings and weekends available for this hobby, so it may take some time.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Shift Register output (e.g. 74HC595, TPIC6B595)

#9 Post by TD-er » 13 Sep 2021, 09:30

RalfE wrote: 12 Sep 2021, 23:58 For cheap and simple, the PCF8574 also has disadvantages (initial state, max 20ma, ....).

I would like to switch a slightly larger number of relays and solenoid valves (100mA) with the least possible effort ...
You may need to check the datasheet, but most of those ICs can "sink" a lot more than they can "source".
What this means is that when it "sinks" a current, it only connects it to GND.
When it needs to "source" it, this means the IC must supply the current for the connected device, so the current for all attached to the outputs must be delivered by the Vcc pin of the IC.

Not sure what you need to switch.
If it is an AC current, you may also want to look at "SSR" or "Solid State Relay".
Then you essentially just turn on an LED on the low voltage side.
N.B. Most SSR's can only switch AC current, not DC, as they switch at the zero crossing.

RalfE
New user
Posts: 5
Joined: 12 Sep 2021, 01:31

Re: Shift Register output (e.g. 74HC595, TPIC6B595)

#10 Post by RalfE » 13 Sep 2021, 10:20

That is already clear to me, only PCF8574 is not enough for the reasons mentioned above.

I also have different test setups here, ESP32 + ULN driver, ESP8266 + PCF + inverter (because of initial state) + driver (discret and ULN), everything works.
Only ESP8266 + TPIC6B595 (+ I2C_sensor depending on the application) would be the simplest solution, but unfortunately it is not yet supported by ESP Easy.

For my intended application, I like ESP Easy best because of the flexible rules (after testing Tasmota and ESPHome), the only disadvantage is the lack of SPI function ....

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Shift Register output (e.g. 74HC595, TPIC6B595)

#11 Post by TD-er » 13 Sep 2021, 10:26

RalfE wrote: 13 Sep 2021, 10:20 [...] the only disadvantage is the lack of SPI function ....
What is missing for SPI?

RalfE
New user
Posts: 5
Joined: 12 Sep 2021, 01:31

Re: Shift Register output (e.g. 74HC595, TPIC6B595)

#12 Post by RalfE » 13 Sep 2021, 11:19

What is missing for SPI?
as written above ... control x595 shift register via SPI ...

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Shift Register output (e.g. 74HC595, TPIC6B595)

#13 Post by Ath » 16 Jan 2022, 23:04

I have created PR #3917 adding support for 74HC595 (and compatible) chips to ESPEasy. Not using SPI, but the more commonly used serial-shift, as provided via the Simsso/ShiftRegister74HC595 library, that I modified to not use C++ template features, as that adds code for each count of daisy-chained chips.
Currently 'limited to 16 daisy-chained chips, but I will, probably soon, raise that to a higher count (64 or 256, not sure what would be useful).
Also want to add support for sending text to a set of 7-segment displays, similar to P073, but will need to find a diagram how these are usually connected.
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Shift Register output (e.g. 74HC595, TPIC6B595)

#14 Post by Ath » 22 Jan 2022, 15:29

An couple of updates have been made to the code, so a newer build is available from the Github actions run (should be completed in a couple of minutes after this post).
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 29 guests