Arduino Extra Digital Pins

Do any of you guys know how to get more digital pins for the arduino? I am making a thermostat and I will probably need 3 or 4 more digital pins. I do not want to pay alot of money so please make sure that it is an affordable solution. And I have already used up all of the Analog Pins as Digital Pins.

Shift registers, latches, buffers, muxes etc. There are plenty of ways.

Inputs or outputs? Does it have to be fast?

For example with three pins you can have any number of outputs using shift registers. With a mux you can get 8 IOs using 5 pins.

I need outputs... How do shift registers work? How does mux work?

Thanks!

I am making a thermostat and

I have already used up all of the Analog Pins as Digital Pins.

A thermostat needs to know the current temperature in the room, and needs to turn a heat source on or off. What else are you doing to use up 20 pins?

What else are you doing to use up 20 pins?

Perhaps it has an LCD and buttons, etc. I know I find myself adding extra stuff to projects :P.

Shift registers are probably the easiest. There's a built in Arduino function called "shiftOut()", here's the playground page on it:

http://www.arduino.cc/en/Tutorial/ShiftOut

A serial LCD is probably easiest, if indeed an LCD is what is using up all the pins.

Actually I have a really cool idea for a Thermostat in which you can program directly from your program with software GUI. It has an SD Card Reader, Real-Time Clock, XBee Adapter, LCD, 3 buttons, and a 3-way switch. With all of this, I have one analog pin left. However, I need outputs that directly connect to the Heat/Cool and Fan Controller. So I need probably 3 or 4 more outputs.

Shift registers are probably the easiest. There's a built in Arduino function called "shiftOut()", here's the playground page on it:

http://www.arduino.cc/en/Tutorial/ShiftOut

What is the SD card reader for? I presume it is not read-only. Do you plan to log data?

What is the XBee for? Wirelessly receiving temperature data?

What kind of LCD? As I mentioned in a previous reply, a serial LCD only uses one wire. If you are not using a serial LCD, you can save however many pins the LCD uses, minus one, by switching to a serial version.

Or, you could use a Teensy++ instead of an Arduino. It has 27 digital pins and 8 analog pins, for only $24 (without pins) or $27 (with pins). Can be programmed using the Arduino IDE and syntax.

Shift registers are an easy way to add output pins, but be aware that they cannot source or sink as much current as Arduino digital pins. Shift registers can source/sink about 6mA which may be sufficient for your application.

I made a simple, inexpensive shield that allows you to easily add 16 ouput pins to your Arduino (at the cost of 3 digital pins). http://nootropicdesign.com/ez-expander/

The software library provides the same programming semantics for the new pins 20-35. That is, you can call expander.digitalWrite(24, HIGH) to access pin 24.

(sorry for the shameless plug of my own product, but relevant to this thread).

Shift registers can source/sink about 6mA which may be sufficient for your application.

Sorry, but that's just not the case.. This bad boy can handle 350mA / pin: High Power Shift Register