how to add more digital pins to Arduino Uno ?! [SOLVED]

hello guys,
well i am in the middle of some project and i reached a point where i found out that i need more digital pins !!
so how can i do to add pins to arduino uno ?

i still have some analog pins so can i use them as digital ?

i still have some analog pins so can i use them as digital ?

Yes call them Pin 14 to Pin 19 and they will work like digital ones.

aha ok thanks a lot

and what if i needed even more ?

i read the shift register thing but i really didn't understand how does it expand it, i didn't understood the description if u can give me a small explanation that would be very helpful :slight_smile:

and by the way can i work with dc motors with the shift register method ?

can i work with dc motors with the shift register method

Yes just treat them as normal pins.

Shift registers are only one option you can use chips called port expanders connected either through the I2C or SPI buses on the arduino.
Typical of these would be the MCP23S17 and the MCP23017 - each give you 16 more input / output pins and you can connect eight easily and more with a it of trickery.

i didn't understood the description

You didn't understand the description you mean.

A shift register Shift register - Wikipedia simply gathers bits one at a time from an input and parallelisises them. That is gives you access to data that has been sent in the past. It is like a memory for past events and the events is your data. You need a different type of shift register for inputs and outputs. I never use them, I only use port expanders.

Controlling a shift reg costs 3 pins but gives you 8 output so you are 5 up. But you can daisy chain shift reg's so each additional one gives you 8 more outputs. Look at the play ground example.

Mark

Controlling a shift reg costs 3 pins but gives you 8 output so you are 5 up.

Using a MCP23017 port expander costs 2 pins and gives you 16 leaving you with 14 up BUT you can connect 8 of them with the same two pins giving you 128 pins leaving you with 126 up.

And unlike a shift register the pins are individually addressable and there is no penalty for cascading them.
And you have a pin change output for each 8 I/O so monitoring inputs is quick and easy.

Also you can use MAX7219/MAX7221. Only you have to group your components in groups of 8. Every group go to the same port, and every component of the group to a pin of the MAX chip. More information here: Arduino Playground - Max7219 or send me a menssage or reply this response. Good luck! :slight_smile:

Edit #1: With this chip you increase 64 digital pins ( - 3, because you have to conect the chip to Arduino).

firashelou:
i reached a point where i found out that i need more digital pins !!

How many more? All of the analog input pins also function as digital pins.

ok great info guys thanks a lot

well @ Peter well i need more :slight_smile:

@Mike so you are saying that i just can use the pins as output ? and not input ?

so you are saying that i just can use the pins as output ? and not input ?

Yes you can use the analogue inputs as digital inputs or digital outputs just like any normal pin.

Hi Firashelu,

What you need is a CPLD shield for the Uno. CPLD's typically have dozens of Digital I/O's. You can configure these any way you like. You will have to learn a little about HDL coding. But, Verilog is very similar to the C language. For adding extra digital I/O, just implement a simple shift register in Verilog then set up any number of bits to correspond to the I/O pins of the CPLD. Take a look at this CPLD shield from www.earthpeopletechnology.com/?wpsc-product=ept-570-ap-u2-usbpld-development-system-for-the-arduino-uno

What you need is a CPLD shield for the Uno.

I would suggest that this is the last thing he needs. It is more of a throwback and it puts him outside the scope of the majority helping answer questions on this forum.

Grumpy_Mike:

so you are saying that i just can use the pins as output ? and not input ?

Yes you can use the analogue inputs as digital inputs or digital outputs just like any normal pin.

yes but i was talking about the external chip method

Grumpy_Mike:

What you need is a CPLD shield for the Uno.

I would suggest that this is the last thing he needs. It is more of a throwback and it puts him outside the scope of the majority helping answer questions on this forum.

why what's the reason that it not a good idea ?

If you read my post you quoted then you would see why I think that.
Are you involved in selling them?
The OP just wants more I/O pins and you suggest programmable logic is the answer, at twice the cost of an Arduino. This is very bad advice. Yes there are some projects that might benifit from this shield but ther is no evidence that this is one of them.
It is one of the worst pieces of advice I have seen here.

firashelou:
well @ Peter well i need more :slight_smile:

If you're going to be daft about it then how can you expect to get any constructive help?

How many are you looking for? One? Ten? A thousand? Given that you have only found this need half way through the project it seems reasonable to suppose you aren't looking for very many. So: how many additional pins do you actually need? What sort of current do you need them to source and sink, and how fast do you need to be able to switch them?

PeterH:

firashelou:
well @ Peter well i need more :slight_smile:

If you're going to be daft about it then how can you expect to get any constructive help?

How many are you looking for? One? Ten? A thousand? Given that you have only found this need half way through the project it seems reasonable to suppose you aren't looking for very many. So: how many additional pins do you actually need? What sort of current do you need them to source and sink, and how fast do you need to be able to switch them?

actully i need about 12 and maybe more
i need them to take the LED buttons out from direct link to arduino to be able to connect more buttons to arduino

actully i need about 12 and maybe more

Well as I said use a MCP23S17 or the MCP23017

i need them to take the LED buttons out from direct link to arduino to be able to connect more buttons to arduino

No need to take out anything you can link your buttons or your LEDs to these chips, that is the flexibility you get with port expanders.

Grumpy_Mike:

actully i need about 12 and maybe more

Well as I said use a MCP23S17 or the MCP23017

i need them to take the LED buttons out from direct link to arduino to be able to connect more buttons to arduino

No need to take out anything you can link your buttons or your LEDs to these chips, that is the flexibility you get with port expanders.

yes this is another one than 74HC595
can you please suggest another name other than MCP23S17 and the one i have ?

and thank you very much i appreciate your patience :slight_smile:

can you please suggest another name other than MCP23S17

Why?

Anyway other port expanders are, Max7300, PCF8575, MCP23008, PCA9535E and PCA9535EC