Go Down

Topic: Shift register wiring HELP NEEDED (Read 4092 times) previous topic - next topic

JamesRobbie

Hi all,

I am new to the world of Arduino and purchased it all to work on a specific project and so I have loose plans to work to. I have purchased what I can from my local shop but i had to get different shift registers to the ones stated in the plans... So, knowing that the pins would be different ordered, I have tried to work out the equivalant pin outs but its got the better of me.

Can somebody with more help/knowledge/skill please help with matching pin outs? Attached are the two pin outs specified.

Thanks in advance for any help.
Cheers

Paul__B

OK, the first one is a PCF8574 I2C expander chip which has to be interfaced via the I2C bus.

The second appears to be a 74HC595 which you access via a SPI-style protocol.

Look up the corresponding items in past questions here.

bperrybap

Those chips are very different.
The PCF8574 i/o expander is not a shift register.
Any of the 8 pins can be can an output or an input.
The Wire library will be used to talk to this chip.


The 74HC595 is a shift register and can only be used to control output pins.
You can talk to this using the shiftout() core library function or using the h/w SPI.


Depending on your need for the pins, you may or may not be able to substitute the 595 for the PCF8574.

JamesRobbie

Thanks for the help and that explains why I couldn't quite match up the outputs myself.  :smiley-roll-blue:

The chips are only to be used for controlling LED's and a single 7 segment display. I would have thought that I would only need output pins and so if I can match the pin outputs, it would still work? Or due to the different type of chips, the programming will be a whole different battle if the existing sketch is based on this other expander chip?

I just cant get my head around and work out the equivalant for the A0, A1, A2, SCL, SDA pins and how/if they could match the SER, OE, RCLK, SRCLK and SRCLR pins.

Other option is to find a "like" chip for the expander as I cant find them in NZ  :(

bperrybap

While either chip can drive 8 output pins, the chips are very different. There is no equivalent for those pins.

How you communicate with each chip is very different.
The PCF8574 uses a bi-directional 2 wire bus for communication, and each device on the bus (there can be multiple chips that all share the same 2 wire bus) each have different addresses. The A0,A1,A2 pins set the device address.
The 595 is a simple serial shift register and uses data, clock, and latch signals to clock in the data.
If using multiple 595s the chips are daisy chained and the date flows through one to the next, etc...

While they are very different, either one could be used to control LEDs or a seven segment display.

You probably should go read a bit about each of the chips to pick some additional knowledge about them.

Easy to find lots of information and Arduino examples for both if you just google around.

One thing to look at and consider very carefully is the pin drive capability as it affects both the h/w and s/w.
Look carefully at the DC characteristics in the datasheets. Pay close attention to the maximum i/o pin current. 
The PCF8574 really can't drive any current from the pins. It can sink current though.
What this means is that you can't use the PCF8574 to turn on an LED that has one side connected to ground and then setting the output pin high but you can turn on an LED by connecting one end of the LED to positive voltage and then setting the output pin low. This means that if you want to drive something like a 7 segment LED it must be common anode to allow turning on the LED segments switching the ground signal vs the positive voltage.

The HC595 can drive or sink current from its output pins.

--- bill





JamesRobbie

#5
May 12, 2015, 12:13 am Last Edit: May 12, 2015, 12:14 am by JamesRobbie
While either chip can drive...
Thank you very much for all of that helpful info and clarification. Really appreciate it all.

I have been reading up on the circuit I am trying to build but it turns out I obviously have to do a lot more reading about each and every component. I thought I might be smart enough to try to substitute parts in the plans with parts I can actually get my hands on but turns out I'm nowhere near where I need to be, to be able to do that. Time to find a "like" chip for the PCF8574 and forget about the HC595 for now.

Just for interests sake, attached is the schematic I'm working too. I had intended to use shift registers because I had done a couple of basic introductory tutorials with them but the sketch is based on the PCF8574 so really, I had no hope to start with  :'(

bperrybap

You definitely can use 595's to drive the LEDs and the 7 segment LED but since a 595 is output only it can't be used to read the buttons. But depending on what else you using the Arduino for, you could simply read the buttons directly using Arduino pins

There is lots of information out there for how to use a 595 to drive leds and seven segment LEDs.

It probably isn't that bad to modify the sketch to use the shift registers.
You will have find and modify the code that sends the data to the PCF8574 and send it to the 595 instead.
For the L1-L8 leds and the segment LED it probably isn't to difficult since the 8 bits of each 595 would map the same as the 8 bits of the PCF8574. But for the other 2 LEDS (it is really a dual color LED?) and the buttons it would be a bigger change as it would use the arduino pins directly.


If you want some links on the 595, here are a couple of links to get you started:
http://www.instructables.com/id/Arduino-powered-7-seg-LED-display-using-Shift-Regi/
https://www.youtube.com/watch?v=shcumKPTcTk

Here is a place that I have bought parts from many times. Their prices are very reasonable and shipping costs are quite low even for very small orders and the shipping time is usually about a week:
http://www.taydaelectronics.com/

They have all kinds of neat little "goodies" for Arduino projects.

--- bill


JamesRobbie

Agreed, I have seen numerous shift registered powered LED's and displays but openly admit I have realised how naive I am with this stuff.

This time, I have attached the sketch created for this project by the owner. Sorry for the drips and drabs of attachments, wasn't sure how much productive help I would get but this has been awesome so far. Unfortunately, I am a doing learner rather than a reading learner so talking to people here has been more beneficial than reading pages and pages of information.

With regard to that actual schematic, I am only intending on utilizing the first LED strip and the segmented display. I have no intentions to use the third shift register or the buttons, rotary encoder or extra couple of LED's. Due to being at work, I havent watched the video YET but from what I have seen in that instructable and other shift register sketches, I am thinking that anything relating to the "IOexp" in the attached sketch will have to become a shift command of sorts?
As I said, this is the original sketch and I am yet to remove code I dont require which will be via trial and error regarding the buttons etc.

Thanks for that parts website, that has been bookmarked!

Go Up