element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Simple+cheap I/O expansion with MCP23017
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 10 replies
  • Subscribers 679 subscribers
  • Views 2919 views
  • Users 0 members are here
Related

Simple+cheap I/O expansion with MCP23017

morgaine
morgaine over 13 years ago

I stumbled across this simple little Pi project at SK Pang in the UK, one step up from blinking a single LED --- blinking a large row of them with patterns of your choice, aided by Microchip's MCP23017 I/O expander  --- http://www.skpang.co.uk/blog/archives/454

 

Although very simple, I think it might be worth highlighting as another step on the learning path for budding hardware engineers, particularly given that the MCP23017 costs under one pound from Farnell --- http://uk.farnell.com/microchip/mcp23017-e-sp/16bit-expander-i-o-i2c-i-f-dip28/dp/1332088 .  SK Pang are bundling that chip in a "Starter Kit for Pi" together with their Pi cover, breadboard, LEDs etc, which may be convenient if you need a breadboard or cover anyway --- http://www.skpang.co.uk/catalog/starter-kit-for-raspberry-pi-b-p-1107.html

 

See Nathan Chantrell's site --- http://nathan.chantrell.net/ --- for full details of software and hardware aspects of the project, including variations such as building on top of the well known Slice of Pi expansion board.  Direct article links ---  http://nathan.chantrell.net/20120519/raspberry-pi-and-the-mcp23017-i2c-io-expander/ , http://nathan.chantrell.net/20120524/python-tools-for-the-mcp23017-io-expander/ , http://nathan.chantrell.net/20120602/raspberry-pi-io-expander-board/ .  And finally, Nathan's article about interfacing the Pi's 3.3V I/Os with the 5V MCP23017 device is important educational reading --- http://nathan.chantrell.net/20120610/raspberry-pi-and-i2c-devices-of-different-voltage/ .

 

At the MCP23017's very low price, this project can be expanded a lot further easily, as 3 address pins allow you to directly address up to 8 of these devices on the I2C bus.  There is also a version of the chip for the SPI bus, MCP23S17 --- http://uk.farnell.com/microchip/mcp23s17-e-sp/ic-16bit-i-o-expander-spi-23s17/dp/1292238 , and you could in principle use 8 devices on each I/O bus if you have a truly demonic project.

 

The datasheet for MCP23017/MCP23S17 is available at http://www.farnell.com/datasheets/12170.pdf .

 

The Pi certainly has rather limited hardware I/O capability, but that's no deterrant for those who want more simple I/Os. image

 

Morgaine.

  • Sign in to reply
  • Cancel
Parents
  • Former Member
    Former Member over 13 years ago

    Did you bother to read the datasheet ?  The MCP23071 is not a 5v device, it's a 1.8v - 5.5v device. It's right there in the datasheet on page one, you don't even need to go lookup the electrical characteristics. Just run it at 3.3v and be done with it.

    What does become quickly obvious though is that you're unlikely to have much current available from either the 3.3v or 5v pins on the gpio header. The polyfuse thing has been done to death everywhere, but I think it's going to be worth it for anyone trying to use the gpio connector to think about alternatives to the micro-usb power supply and to skip the polyfuses completely.

     

    While that starter kit will likely be interesting to people it's way over priced, even on their own site you can get essentially the same stuff (and more of it) for less. The clue is that the cover + breadboard is 11.40, so 17.40 for some LEDs and a few bits of wire. Hmm, cashing in on the R-Pi hype, surely not...

    So try buying the equivalent parts from farnell, you quickly run into the min qty's for resistors etc. being 50+ but as that works out at something like 50p who cares.. I think I got to something like 150 LEDs, two mcp23017's and double the size of breadboard before I managed to equal the cost.

     

    For the 23s17 you get to use 8 per SPI chip select line. By default there's two chip selects on the Pi, but it should quickly be obvious how to increase that to ridiculous levels by just using some gpios as additional chip selects.

     

    There's even a linux driver for these chips that will let you bring them into the standard linux gpio infrastructure, unfortunately it needs some extra stuff added to the kernel and a re-compile to do it - code is available if anyone wants it.

     

    Do follow through and read all of the comments on Nathan's blog on why you'd want the level shifters, and don't try those level shifter circuits with a MCP23S17 running at 5V.

     

    So yes, the MCP23x17, and 23x08, are interesting devices for experimenting with - I have several image  I'd also suggest having a look through the other Microchip stuff, they seem to have been producing various interesting things recently at quite competitive prices - mcp2200 was the first one I stumbled across.

     

    Oh, and for anyone looking at skpang, there are several similar places in the UK - coolcomponents and proto-pic spring to mind, but essentially they're mostly reselling stuff from sparkfun and the likes.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Former Member
    Former Member over 13 years ago

    Did you bother to read the datasheet ?  The MCP23071 is not a 5v device, it's a 1.8v - 5.5v device. It's right there in the datasheet on page one, you don't even need to go lookup the electrical characteristics. Just run it at 3.3v and be done with it.

    What does become quickly obvious though is that you're unlikely to have much current available from either the 3.3v or 5v pins on the gpio header. The polyfuse thing has been done to death everywhere, but I think it's going to be worth it for anyone trying to use the gpio connector to think about alternatives to the micro-usb power supply and to skip the polyfuses completely.

     

    While that starter kit will likely be interesting to people it's way over priced, even on their own site you can get essentially the same stuff (and more of it) for less. The clue is that the cover + breadboard is 11.40, so 17.40 for some LEDs and a few bits of wire. Hmm, cashing in on the R-Pi hype, surely not...

    So try buying the equivalent parts from farnell, you quickly run into the min qty's for resistors etc. being 50+ but as that works out at something like 50p who cares.. I think I got to something like 150 LEDs, two mcp23017's and double the size of breadboard before I managed to equal the cost.

     

    For the 23s17 you get to use 8 per SPI chip select line. By default there's two chip selects on the Pi, but it should quickly be obvious how to increase that to ridiculous levels by just using some gpios as additional chip selects.

     

    There's even a linux driver for these chips that will let you bring them into the standard linux gpio infrastructure, unfortunately it needs some extra stuff added to the kernel and a re-compile to do it - code is available if anyone wants it.

     

    Do follow through and read all of the comments on Nathan's blog on why you'd want the level shifters, and don't try those level shifter circuits with a MCP23S17 running at 5V.

     

    So yes, the MCP23x17, and 23x08, are interesting devices for experimenting with - I have several image  I'd also suggest having a look through the other Microchip stuff, they seem to have been producing various interesting things recently at quite competitive prices - mcp2200 was the first one I stumbled across.

     

    Oh, and for anyone looking at skpang, there are several similar places in the UK - coolcomponents and proto-pic spring to mind, but essentially they're mostly reselling stuff from sparkfun and the likes.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube