Pages: [1] 2   Go Down
Author Topic: Need more outputs on my arduino mega ! (yes ... i know ...)  (Read 3139 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all !

I'm facing some problematic where i can't find the answer (probably because i have some lacks on reading datasheets ...).

Here is what i want to do :
I'm actually working on a project where i will need more outputs on my arduino mega 2560 because i'm running out of them ... (i know ... it already has lots of outputs, but not enough for my project smiley-wink ).
These outputs will drive some TRANSISTORS (TIP120 or 2N2222 but as i already have a LOT of TIP120 ...) that will actuate RELAYS (12V ones like Finder 40.51 // 40.52).
---> Eventually, if these outputs could be analogs, it would be best (because i will probably need some ones)

I saw, doing some reseaarch, that lots of people use this component : CD74HC4067
But, reading the datasheet, i could see, in absolute maximum ratings, that "DC DRAIN CURRENT" could not exceed 25mA (at max !!! so well less than this value).

I'm looking into just 1 component that would do the job and that can, if i understood the datasheets correctly, outputs something like 150mA / output.


Thanks !
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I found this thing which appears to fits my needs, but i never had any with serial shifting registers ...
... Especially with the clock to use ?!
Can anyone points me to the good direction ?

TPIC6C595N : http://www.ti.com/lit/ds/symlink/tpic6c595.pdf


Thanks !
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8501
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
CD74HC4067
This chip is an analogue MUX, it's not suitable for outputs mostly because you can only select one at a time.

If you are using transistors why do you need 150mA outputs?

Most people use a '595 shift reg for more outputs but it's not very powerful, there are versions that are like the TPIC6B595 that would be suitable.

______
Rob

 
Logged

Rob Gray aka the GRAYnomad www.robgray.com

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8501
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You beat me to it smiley

Quote
Can anyone points me to the good direction ?
There are examples on the Arduino playground I think, but you can just use the shiftOut() function.

______
Rob
« Last Edit: October 26, 2011, 11:34:10 am by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You beat me to it smiley

Quote
Can anyone points me to the good direction ?
There are examples on the Arduino playground I think, but you can just use the shiftOut() function.

______
Rob


Ok so you're telling me that i can use this kind of register (a shame that they are not delivered with 16 outputs at a time ! GRRR !!!) and driving them only by using shiftOut() function ?
I can see others pins like : G/, RCK, CLR/, SRCK, SER OUT ...
I just don't know how to use them.



By the way, do you know other registers that are 16 outputs and can drive 2N2222 transistors while being commanded thru 4 pins (4 bits control) ?

Thanks !
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8501
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
can drive 2N2222 transistors
Every chip in the known universe will drive a 2n2222.

As I asked before, why use a high-current chip AND transistors? Surely either one or the other will do.

I can't think of any 16-bits SRs though.

Quote
I can see others pins like : G/, RCK, CLR/, SRCK, SER OUT ...
We'll talk pins when we decide on a chip.

EDIT: The SN54LS673 and family are 16 bits. Hint, try Googling "16-bit shift register" smiley

_______
Rob
« Last Edit: October 26, 2011, 11:56:45 am by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

EDIT: The SN54LS673 and family are 16 bits. Hint, try Googling "16-bit shift register" smiley

In fact, i need something that keeps in memory the state i defined earlier.
Let's say, i need to power 6 relays ON from my 16 relays, but not at the same time, how can i achieve this with this kind of component ?
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8501
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You simply shift 16 bits out by calling shiftOut() twice. EG

Code:
int pin_bits0 = 0x0F;   // example, sets lower 4 bits
int pin_bits1 = 0x80;    // and the upper bit
shiftOut(dataPin, clockPin, MSBFIRST, pin_bits1);  // send upper 8 bits
shiftOut(dataPin, clockPin, MSBFIRST, pin_bits0);  // send lower 8 bits 

The variables pin_bits0 and 1 remember the current state of the outputs.

______
Rob
« Last Edit: October 26, 2011, 12:23:34 pm by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You simply shift 16 bits out by calling shiftOut() twice. EG

Code:
int pin_bits0 = 0x0F;   // example, sets lower 4 bits
int pin_bits1 = 0x80;    // and the upper bit
shiftOut(dataPin, clockPin, MSBFIRST, pin_bits1);  // send upper 8 bits
shiftOut(dataPin, clockPin, MSBFIRST, pin_bits0);  // send lower 8 bits  

The variables pin_bits0 and 1 remember the current state of the outputs.

I can't believe that it is so easy to do  smiley-money smiley-mr-green

In fact as i didn't know about shiftOut() function, i did not thought it was generating the clock signal by its own !
This is great news !



But now, i have some more questions ...  smiley-lol
- Time = 0 >>> I want to turn ON relay 3
- Time = 1 >>> I want to keep relay 3 ON and turn ON relay 7
- Time = 2 >>> Now i want to turn OFF relay 3

While being at Time = 1, does the shifting-register keeps in mind the state of the relay 3 ?
If it keeps it in mind, will there be some kind of short cut OFF/ON while turning on the relay 7 ?


Thanks for your precious help !


PS : i found this thread which the last post describes that he could drive 40 relays with a CD4094 (and with a 74HC595). http://forums.adafruit.com/viewtopic.php?f=25&t=7239&start=0
So i now feel it is the good way smiley
« Last Edit: October 26, 2011, 12:38:12 pm by simkard » Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

In fact, i just came to read this page : http://www.arduino.cc/en/Tutorial/ShiftOut ... by the way ... hum ... let's say SHAME ON ME  smiley-mr-green

Well well well ... Ok, i think i will go with this component : 74HC595 ; Datasheet : http://www.taydaelectronics.com/datasheets/A-251.pdf
On eBay china, it is possible to get 20x pieces for 3$ with free shipping  smiley-mr-green YEAH !

I'm just wondering how is done the ENABLING or DISABLING state for an output pin ... (i hope you will explain it to me  smiley-small )
Another thing i'm wondering too is the fact that i need 16 outputs more (with only 3 pins it is a great deal !) and this component can be daisy chained ... but how to drive the 2nd one ?


Thanks !
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 533
Posts: 26957
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The '595 is set up so the output of  say #2  feeds the input of the next in line, say #1.
So you do two shiftout()s  (or SPI. transfer if you want to operate faster, for a hardware to hardware transfer).
The first byte gets shifted thru #2 and ends up in #1, the 2nd byte ends up in #2. The latch signal moves the data from the '595 shift-in register to its output register so all outputs change at the same time.
There is an output enable pin also if you want the chip to Not drive the output line so something else can drive it.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In fact, i don't think the 74HC595 is a good idea because i will be driving 2N2222 transistors (finally) for long periods, and based on the datasheet, they eats too much current to the poor 74HC595 (it would only be possible to drive 2 of them simultaneously).

So, now, i'm looking for a replacement component instead of the 74HC595 ... there was the TPIC6C595 but could it be wired the same way /AND/ driven the same way thru the code given upper in this thread ?

By the way, if i use the TPIC6C595 daisy chained, i will not need to buy 2N2222 transistors as i will be able to use my TIP120s smiley
« Last Edit: October 26, 2011, 01:26:02 pm by simkard » Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

After some research, it seems that the 595 family are driven the same way !

So this is a good point.
Now i'm wondering if i will need to use a capacitance like the 74HC595 has to use ... ?!
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 533
Posts: 26957
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, put a capacitor across each '595s power & ground pin.
If you are using NPNs, then you will need a pullup resistor from 5V to the NPN gate, that will turn the NPN on; when the TPIC6595 output goes low, that will turn the NPN off.

http://www.fairchildsemi.com/ds/TI/TIP120.pdf
http://www.ti.com/product/tpic6595

Depending on the current draw needed thru the relay coil, you may be able to just the the tpic6595 directly. Still need the pullup resistor to turn the relay off.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Full Member
***
Karma: 0
Posts: 125
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, it is possible that i use th TPIC6C595 directly to power up the relays coils.
The relays coils are 12V DC.
I will add a reverse diode to avoid feedback current to flow where it shouldn't goes.

You're telling me that i have to add a capacitor across "Vcc" and "GND" pins of each TPIC6C595 ?

Reading the datasheet, it shows that a resistor and a capacitor should be used on each output ... ?!?! I just don't understand if i have to do it or not ?

By the way, how do i drive the 2nd TPIC6C595 connected on the SerialOut of the 1st TPIC6C595 ?


Thanks !
Logged

Pages: [1] 2   Go Up
Jump to: