• 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
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)

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • Difference Between Arduino Uno and Arduino Mega

    What is the Difference Between Arduino Uno and Arduino Mega? Do We Need Arduino Mega Despite Having Arduino UNO?

  • Difference Between Analog and Digital Pins in Arduino UNO

    We Have Discussed the Difference Between Analog and Digital Pins in Arduino UNO in Plain English Suitable For Any Audience.

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 (24.3K 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

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

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

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