SevSeg library + MCP23017 ?


I am building a device with multiple 7 Segment displays. Looking at the library documentation / examples, I was able to make one display work the way I want, using the standard pins on the Uno.

My question is regarding the use of MCP23017 (one per display). Is it possible to communicate with displays on I2C instead of the standard pins on the Arduino itself, when using the SevSeg library?

Example using the standard pins:

byte numDigits = 2; byte digitPins[] = {12, 13}; byte segmentPins[] = {3, 2, 6, 8, 7, 4, 5, 9}; MySeg.begin(COMMON_CATHODE, numDigits, digitPins, segmentPins);

Usage: MySeg.setNumber(99,1); // display 99 MySeg.refreshDisplay();

I am already using several MCP23017 using the Adafruit_MCP23017.h library to read a large number of encoders, so using them for the displays as well would be ideal.

Thanks for your input!


It doesn’t look like the SevSeg library will support i2c extender chips, or any others for that matter. It deals only with native Arduino pins as far as I can see.

I suggest max7219 chips for your displays. 3 pins are needed for any number of chips and each chip drives up to 8 digits. Very easy to use because only one resistor and a couple of caps are needed, no segment series resistors etc. There is a library called LedControl if you want to use it, personally I would not bother, its so easy.

if you must use i2c bus, there is saa1064. These will only drive 4 digits each, and a couple of transistors are needed, but again no segment series resistors. Up to 4 of these chips can be attached to the bus.

It would be possible with your mcp chips, but quite a few transistors would be needed, plus series resistors, and you would need to implement the multiplexing in your sketch.


Hey PaulRB,

Thank you so much for your reply! Very useful information. I found the link below. Apparently a single 10K resistor is needed. This looks promising :) I'll order a bunch. Thanks again.