Using shift register for serial input

Hi, I'm trying to use the 74HC595 shift register to get serial input from 2+ sensors and control mosfet. The board I'm using (similar to esp8266-01) only has rx/tx and 1 another gpio pin. So far I got the shift register to control leds using these pins but I'm wondering how I would wire/code it to get data from multiple serial inputs (I'm using ultrasonic sensor with rx & tx data out pins)?

Thanks.

Hi @Charlieglider .
Do you want to convert parallel inputs to serial using the 74HC595?

Generally speaking the 74HC595 is used to do the reverse, transforming a serial pulse train in parallel.

Could you please post the schematic you are using.

And if you haven't, how about reading the topic:
How to get the best out of this forum

And post a lot of information to help us help you.

As Pharaoh TutanKamon said in 1340 BC (good help starts with good information).

RV mineirin

74HC595 is serial in, parallel out only. For parallel in, serial out use the 74HC165.

To add bi-directional GPIO pins the I2C expanders MCP23008 (8 bit) and MCP23017 (16 bit) or their SPI cousins MCP23S08 and MCP23S17.

Hi I currently don't have a schematic as I'm still deciding which shift register to use and how to connect them. But I suppose I will need to use something like an 74HC165 or I2C expander to take in sensor inputs. What do you think the best way to this is is so I can also control my mosfet?

I see, so I can use the 74HC165 to expand the sensor inputs. How would I be able to expand the 3 pins I have to also do serial in parallel out to control the LEDS as well? Would the I2C expanders you mentioned be able to this, and how would I connect them? Thanks

IIRC, Adafruit has a library to control this chip. Don't forget the decoupling cap!

1 Like

How would I connect this if it uses analog pins?

What is "this"? Is it an analog signal?

Analog pins (except A6 and A7 on Nano) are digital pins with analog input as a special function. You can do anything with an analog pin that you can do with any digital pin.

can this do serial inputs too (view sensor data)?

You can view the changes from 0 to 1 on your serial monitor. You cannot view "data" because you have NO clock timing to tell one 0 from the next or one 1 from the next.
Paul

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.