0

I am undergoing a BSc (Hons) Degree in Computer Science and working on an Arduino project.

I am using the Arduino Mega and even though this microprocessor has plenty of input and output pins I am running out.

In the event that there are no more I/O pins available for me to make use of, and I am also referring to both analog and digital pins, is it possible to increase them?

I did some research, however the solutions are too vague... One of the suggestions was to use one or more of the following: 74HC595 8-Bit Shift Register DIP-16.

Arduino with shift registers

I am good at coding however when it comes to hardware sometimes I'll need some push.

Thanks a lot.

  • Could you give us some specific numbers? Like how many output-pins? How many input-pins? How many analog pins? Also what is connected to the different pins. E.g. leds can be placed in a matrix, and multiplexed to massively reduce the number of pins needed. – Gerben May 10 '16 at 15:00
  • 3
    Posting an image of an IC package is not a meaningful way to propose an idea, use the part number and a functional description – Chris Stratton May 10 '16 at 15:11
  • There are lots of multiplexer ideas, the port expanders people have mentioned will help or you can do a search for "arduino multiplexer" or similar. (the 74HC595 you have linked is a very common device used for this sort of thing.) – Andy May 10 '16 at 15:40
  • Also do a search on this site, by doing something like: arduino.stackexchange.com/questions/tagged/multiplexer – Andy May 10 '16 at 15:46
  • Hi Chris Stratton the part number of the attached image is: 74HC595 8-Bit Shift Register DIP-16 IC CF. – Matthew May 11 '16 at 5:34
2

You could use an MCP23017 port expander to get 16 more pins. It communicates via I2C. The pins can be set as inputs, outputs, or inputs with pullups.

Adafruit has a library for the expander: https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library

This is the datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/21952b.pdf

As an alternate solution, you could just add another Arduino Mega to your project, and have them both communicate via serial. You could set up state machines on each one (like in Mr. Gammon's tutorials: http://www.gammon.com.au/statemachine) for fast communication. That way you could easily add an extra 52 pins to your project.

  • Hi Jerry, thank you so much for the informative answer. In addition what would you recommend as an effective programming language to interface with the arduino. At this moment in time I am considering to use ASP.NET and creating a web application. The reasoning behind this is to create a website and display and store some of the data read from the arduino's sensors in a database. Thanks again. – Matthew May 11 '16 at 5:41
  • You might want to look into ready-made IoT services. Thingspeak.com is a popular free one. You could download the Thingspeak library for Arduino, attach an ethernet shield, and have the Arduino upload the data by itself. When I don't do it like that, I like to use a Python daemon that grabs the Arduino data via the serial port (pyserial module) and uploads it to the IoT site. Thingspeak has easy to use Python examples too. – Jerry May 11 '16 at 9:14
1

You can either use external hardware or communicate to a 2nd Arduino and control the 2nd Arduino's digital and analog ports. Being good at coding would suggest you would prefer communicating to a 2nd Arduino. Also, most hardware solutions only add digital pins, not analog pins.

  • The beauty of a 2nd Arduino is that you can add logic (beside pins), offloading some work from the main Arduino. You can not only read an analog value, but also convert it to a domain problem value (temp, light) before sending it to the master Arduino. – user31481 Nov 20 '17 at 11:07
-1

You can use a CD74HC4067 Mux multiplexer to increase the number of inputs/outputs. This IC will convert 4 analog or 4 digital pins to 16 inputs and outputs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.