Not enough pins for project

Hello to everyone,

I am currently starting a new project which involves an arduino, 3 sensors, Sd card and a display but the pins are not enough. One though approaching the problem is to use multiplexers but then becomes complicate. Any other thoughts?

Thank you very much!

Some more information about the display and the sensors would be helpful. The SD card only takes 4 pins (CS, DIN, DOUT, CLK). You could get a serial display and that would cut the number of pins to 1 or 2, but even a HD44780 compatible only needs 6 or 7. Most analog sensors only need 1 pin. The UNO has 20 I/O pins, so I'm wondering why you don't think that is enough.

Ok we have 20 pins. Display needs 6 digital pins, Sd card 4 digital pins, sensors need 5 of analog pins! So you have right ! But those 5 pins left ( 4 digital- 1 analog) are enough to connect it with a usb port?

Which board are you using ?

If you use the Arduino Uno, pin 0 and 1 are used for the serial connection via the usb. So you have still 2 digital and 1 analog pin for futher use. The Arduino Leonardo uses some kind of internal software serial port via the usb. Thus you have 2 pins extra.

On Ebay are I2C lcd converters. Using a shift register for the lcd is also not hard to do. What kind of sensors do you have ? Perhaps you can use digital sensors with I2C (not that you need the extra pins, but just for fun).

Dear Erdin, I am using arduino Uno but I built it on a breadboard using an ATMEGA328p. The sensors that I use are ADXL335 (they need 4 analog pins). But to connect the arduino with a usb port do I need only 2 digital and 1 analog? I haven't decided which display I am using yet but most of them need 6 pins.

USB Interface: You need two things:

  • a separate USB to TTL Serial converter (a small board) unless you want to build all that on your own board…
  • Connection from the USB Converter to GND, +5V, D0 and D1 pins. So you should only need those 2 Arduino pins.

LCD Displays: See this on the http://ArduinoInfo.Info WIKI:

Those displays only need 2 pins: A4 and A5 (Maybe a problem for your application?)

The ADXL335 is a common accelerometer. But the digital ones are cheaper and are more common. Sparkfun has a buying guide,

The ADXL335 has 3 analog outputs (x,y,z), so it needs 3 analog inputs. Do you have one ADXL335 ? What are the other 2 sensors ?

The RX (pin 0, PD0) and TX (pin 1, PD1) pins can be connected to a USB-to-serial-ttl-level adapter. You can use that to communicate with the PC. You can also use that to upload a sketch, once you have the bootloader programmed.

Do you know this pinmapping page ? very handy.

OK guys ! You have given to me the right information to guide me! Now I have to do a bit more of research and I will get back if I stuck somewhere! Erdin I use ADXL335, a gyroscope and a piezoelectric!

Thanks every one for your effort guys!

Accel + Gyro ? Take a look at the price of these, Jeff Rowberg has the software for it,

Yes this accel with gyro is a lot better! I think I will use one of those!

Guys I have a question! When I am going to use the accel and the gyro to take the measurements for coordinates X,Y and Z then for each measurement I have to find the time taken for each one. To make the timer should I use the oscillator of the ATMEGA328p or the oscillator from the sensors?

Besides, all the good suggestions above, here's another:

If you don't have a I2C to Parallel converter for your LCD display, you can always use a 74HC595 and send data serially to the LCD. In this scenario, the 74HC595 will work as a "serial to parallel" converter, and you'll only use 3 pins to interface with the 595. There are several articles in the web that will teach you how to interface with a HD44780 display.

The 595 is a lot cheaper and just as easy to implement than the i2c adapter. When working with a LCD display, the 595 will allow for slightly display updates, but not nearly as fast as the native parallel implementation.

On a side note: I am a HUGE fan of the 74HC595 when it comes to Arduino projects. Basically it works as a port multiplier and a serial-to-parallel converter (for digital pins), although officially its description is "8-bit Shift Register". There are plenty of libraries available for the 595, be it running dual motor drivers, LCDs, etc, which proves it is useful for all sorts of projects. Besides, it is extremely cheap (in the cents range).

What do you mean by, "I have to find the time taken"? Do you want to know how long it took for read of the device? Or do you want to know something like "wall clock time" that you took the sample?

For example the first measurement will start from 0 and then take the time to read the second measurement from the device!

Well, for this you can use the "millis" function from Arduino.

Will do!