• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » How to Increase the Number of Digital Pins in Arduino (Port Extender)

By Abhishek Ghosh October 16, 2017 8:52 am Updated on October 16, 2017

How to Increase the Number of Digital Pins in Arduino (Port Extender)

Advertisement

13+6 pins often a limitation of Arduino in projects where we need many pins. Here is how to increase the number of digital pins in Arduino. You know that 13 pins are digital. 6 analog pins also can be used as digital in this way :

Vim
1
2
3
4
5
6
Pin 14 = Analog in 0
Pin 15 = Analog in 1
Pin 16 = Analog in 2
Pin 17 = Analog in 3
Pin 18 = Analog in 4
Pin 19 = Analog in 5

So actually we can refer Analog Pin 5 in this way :

Vim
1
digitalWrite(19,HIGH);

Technically we can use the TX/RX. But TX/RX on board already use Pin 0 and Pin 1. If you load a blank sketch, you will measure 5 V on the Pins 0 and 1. Also it is practical to avoid Pin 0 and Pin 1 in some cases where Serial.begin() like function is used in the sketch. So the total number of Pins going round 17. But with 17 Pins how we can really can control many LEDs as simplest example? How to increase the number of digital pins in Arduino? We can use an IC like device which will “magnify” one Pin. A common way to expand the set of available output Pins on the Arduino is to use shift registers like the 74HC595 IC. 74HC595 IC needs 3 pins to control these chips – Clock, Latch, Data and increase the number the Pins. Display drivers like MAX7219 IC actually expand the pins in TM 1637 like 7 Segment LED display modules. But MAX7219 IC is costly. MCP23017 is a commonly used I/O port expander chip for Arduino like microcontroller boards. Here is data sheet of MCP23017 :

Advertisement

---

Vim
1
http://ww1.microchip.com/downloads/en/DeviceDoc/20001952C.pdf

 

How to Increase the Number of Digital Pins in Arduino With MCP23017 Port Extender

 

MCP23017 chip will use 2 Pins on Arduino and give 16 I/O ports or Digital Pins! So technically you can use 8 MCP23017 to extend one Arduino’s 16 Pins to 16 x 8 = 128 Pins. MCP23017 is an I/O Port Expander, uses the I²C bus and protocol. Arduino has library for  I²C bus and protocol named Wire.h. Things are actually near ready, you simply need this kind of circuit :

How to Increase the Number of Digital Pins in Arduino Port Extender

You can use other additional libraries like Adafruit has to make the “coding” easy :

Vim
1
https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library

For this schematic :

You can test with this code :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "Wire.h"
void setup()
{
Wire.begin(); // wake up I2C bus
// set I/O pins to outputs
Wire.beginTransmission(0x20);
Wire.write(0x00); // IODIRA register
Wire.write(0x00); // set all of port A to outputs
Wire.endTransmission();
}
void loop()
{
  Wire.beginTransmission(0x20);
  Wire.write(0x12);      // address bank A
  Wire.write((byte)0xAA);  // value to send - all HIGH
  Wire.endTransmission();
  delay(500);
  Wire.beginTransmission(0x20);
  Wire.write(0x12);      // address bank A
  Wire.write((byte)0x55);  // value to send - all HIGH
  Wire.endTransmission();
  delay(500);
}

Tagged With arduino analog pins as digital , extend arduino pins , port expander for arduino , arduino pin extender , how to expand number of ports on arduino , arduino extend number of pins , arduino how t o increase the analog pins , arduino display limit ports , use analog number replace for digital port number in arduino , arduino nano expand pin

This Article Has Been Shared 626 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How to Increase the Number of Digital Pins in Arduino (Port Extender)

  • DIY Basic Stand For TM1637 7 Segment LED Display Module

    Is Not It Risky To Use LED Display Unprotected? Here Is How To Build DIY Basic Stand For TM1637 7 Segment LED Display Module With Cardboard.

  • ATtiny Arduino Boards For Cost Saving Projects

    Ready to Use Cheap ATtiny Arduino Boards Available. Here is What to Know About ATtiny Arduino Boards For Cost Saving Projects Before Buying.

  • List of Electronics Prototyping & Project Materials

    Our Illustrated List of Electronics Prototyping & Project Materials is a Helpful Guide to Those Who Lacks Conventional Course on Electronics.

  • Arduino and LED Bar Display : Circuit Diagram, Code

    Here is a Guide Explaining the Basics, Circuit Diagram, Code on Arduino and LED Bar Display. LED Bar Display is Actually Like Multiple LED.

  • How To Play MP3 On Arduino With No Shield, No SD Card

    Here is How to Play MP3 On Arduino With No Shield, No SD Card at Lower Bit Rate for Few Seconds. It is Suggested to Try for Learning Basic.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (22.1K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • How to Make the Most of Your S Pen (S22 Ultra) June 29, 2022
  • Safe Chargers for Samsung Galaxy S22 Ultra June 27, 2022
  • How Telecoms Can Use The Cloud To Power Their 5G Network June 24, 2022
  • A Beginner Guide to Cloud Computing for Development June 22, 2022
  • 5 Benefits of Using a Virtual Data Room Today June 19, 2022

About This Article

Cite this article as: Abhishek Ghosh, "How to Increase the Number of Digital Pins in Arduino (Port Extender)," in The Customize Windows, October 16, 2017, June 30, 2022, https://thecustomizewindows.com/2017/10/increase-number-digital-pins-arduino/.

Source:The Customize Windows, JiMA.in

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Privacy Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2022 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy