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
  • GreenYamo
    GreenYamo over 13 years ago

    That is very interesting, thank you.

     

    Could something similar be done with a shift register, or am I completely woofing up the incorrect deciduous ?

     

    Steve

     

    Edit: what an extremely interesting web site :-)

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

    Steve, 74hc595 on spi seems to be quite popular as a shift register. But if you want something more than very simple stuff yu really want to use something like these - there's a bit more intelligence in the device so you can offload some of the work.

     

    As an aside, there's some evidence to suggest that at least the mcp2200 is just a pic with some firmware pre-programmed. I'd expect the 23x17's are the same.

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

    Although that would be interesting, I don't think that's the case. If you do everything in software, the response of the chip will be much slower than what you can achieve in hardware.

     

    The reason I can think of that a bunch of pins are in the place you'd expect them to be if the chip were a reprogrammed PIC is that they worked on applications and testing BEFORE they had working silicon. Exactly: By programming a PIC to do what this chip does now.

     

    These chips are cheap because they are almost "empty". I mean: A few 8bit shift registers a state machine and a way to write into the different registers inside the device.

     

    This chip may be tricky in practise: "D002" states that if you don't drop VDD down to VSS (ground) alltogether the chip typically won't reset. The 5V powerline of the raspberry pi will not drop below 1.7V if you have an HDMI monitor connected... This might lead to surprises.

     

    On the other hand I haven't measured the 3.3V, but I doubt that the 3.3V regulator will have more than 1V dropout at less than 1mA usage and 1.7V input. Can't be sure though.

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

    Although that would be interesting, I don't think that's the case. If you do everything in software, the response of the chip will be much slower than what you can achieve in hardware.

     

    The reason I can think of that a bunch of pins are in the place you'd expect them to be if the chip were a reprogrammed PIC is that they worked on applications and testing BEFORE they had working silicon. Exactly: By programming a PIC to do what this chip does now.

     

    These chips are cheap because they are almost "empty". I mean: A few 8bit shift registers a state machine and a way to write into the different registers inside the device.

     

    This chip may be tricky in practise: "D002" states that if you don't drop VDD down to VSS (ground) alltogether the chip typically won't reset. The 5V powerline of the raspberry pi will not drop below 1.7V if you have an HDMI monitor connected... This might lead to surprises.

     

    On the other hand I haven't measured the 3.3V, but I doubt that the 3.3V regulator will have more than 1V dropout at less than 1mA usage and 1.7V input. Can't be sure though.

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

    http://hackaday.com/2011/01/18/mcp2200-usb-to-serial-chip-hacked-to-do-your-bidding/

    Ok, so that was some time ago now and it's always possible they have moved to custom silicon now.  So would be interesting to hook up a programmer to one today and see.

    Even so, economics of scale are a strong motivator, if they're already making millions of the die for the pic and it's cheap enough then why go to the expense of producing a new mask for a new chip ?

     

    I think there may be a bit more that a fer 8 bit shift registers involved in the usb side too.

     

    Life is full of surprises, I'd try to follow the spec and do what's requested for D002, but as has been observed here and elsewhere a lot of these things operate happily outside of the official spec.  Not that we should be using that as an excuse or encouraging that sort of design image

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

    Roger,

      The HDMI power backfeed is reportedly coming on pins 15 and 16,

    according to ianwill on Sun Jun 17, 2012 11:45 am

    http://www.raspberrypi.org/phpBB3/viewtopic.php?f=24&t=5830&p=102159

     

    But Gert van Loo said on Wed Jun 06, 2012 9:32 pm

    "The Raspberry-Pi can not source current from the TV.

    If you check the schematics you will find a diode in the HDMI 5V line which prevent this."

    http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=7650&p=95518

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

    Some simple tests with a multimeter reveals the following, both with the screen turned off and the cable disconnected from the Pi.

     

    Dell 2001FP - DVI via passive DVI to HDMI adapter, hdmi pins, referenced to connector shield

    19, 0v

    18, 0v

    17, 3.3v - suspect, this should be Gnd, but use it as the ref and get -3.3v on pin 18 which shoule be 5v

    16, 3v

    15, 3v

    14, 0v

    13, 0v

     

    Samsung LH40MRPMBF

    19, 0.1v

    18, 0v

    17, 0.1v

    16, 5v

    15, 5v

    14, 0v

    13, 0.1v

     

    It seems clear then. Displays are providing pullups on the DDC I2C bus. From what little info I could find, a 12K pullup in the display is recommended for DDC/CI designs. So we can expect there to be a path from the display's 5v over the DDC SCL/SDA through R13 & R14 on the Pi to 5v.

     

    Since R13 & R14 are directly onto 5v and not 5V0_HDMI then the diode Gert talks about (D1) is irrelevant.  Design flaw ?  Especially when D15 & D16 go to 5V0_HDMI and so don't contribute.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
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