-->
Page 2 of 2

Re: Analog and Digital Pins

PostPosted: Mon Nov 13, 2017 1:28 pm
by sprinkfitter
Sounds like a great idea. It is looking like I need 10 digital pins that I am looking at 74hc595 shift register and a total of 5 analog pins with a mcp3008 on a SPI setup. I was looking to do this with a Wemos mini. What do you guys think of this setup. I will be switching 2 relay on and off at the same time. I wonder how much delay would there be turning 2 relay on at the same time with the shift register? Thanks for all the help

Re: Analog and Digital Pins

PostPosted: Tue Nov 14, 2017 10:44 pm
by sprinkfitter
I was wondering since I need to turn on 2 relays at one time would it be better doing it by SPI and do the analog pins by i2c. I did a breadboard with i2c and a 74hc595 and read there is a delay between the shifts. Would that have any affect on trying to turn 2 relays on at the same time. Or can you write a code to help with the delay. Thanks for the help
Ray

Re: Analog and Digital Pins

PostPosted: Wed Nov 15, 2017 2:34 am
by lethe
The output of the shift register only change, when you pulse the latch line (RCLK on 74HC595), so it does not matter how fast or slow you shift out your data, all outputs will change at the same time.

You can use SPI to drive the shift register, the only difference is that instead of pulling a chip select line low during the transfer, you pulse the latch after all bits are shifted out. This won't interefere with other SPI devices on the bus, as long as you don't assert their chip select line.
Talking to other devices on the bus will change the internal state of the shift register, but that's not an issue, since the outputs won't change.

Re: Analog and Digital Pins

PostPosted: Sat Nov 18, 2017 1:48 pm
by sprinkfitter
lethe wrote:The output of the shift register only change, when you pulse the latch line (RCLK on 74HC595), so it does not matter how fast or slow you shift out your data, all outputs will change at the same time.

You can use SPI to drive the shift register, the only difference is that instead of pulling a chip select line low during the transfer, you pulse the latch after all bits are shifted out. This won't interefere with other SPI devices on the bus, as long as you don't assert their chip select line.
Talking to other devices on the bus will change the internal state of the shift register, but that's not an issue, since the outputs won't change.

Wow interesting. So what you are saying I can use the spi bus add both digital and analog pins. So use the 74hc595 for digital and a mcp3008 for analog pins.