7 segment display connected to Arduino Nano's analog pins


I have all the digital pins occupied. But I need to connect a 3 digit 7 segment display. I've read that I can use analog pins the same way as digital ones and make them HIGH or LOW. The question is wether I can find a library for a 3 digit 7 segment display working with analog pins?

The analogue input pins can be used exactly as any other digital pin, but use the A0...A5 convention for naming them.
If a library works with any specified digital pin, there should be no reason it won't work with the analogue pins.

Shouldn't make any difference whether you use an analog or digital pin, unless the library needs something like PWM or I2C to drive the display. An interface directly to the display, or using shift registers, should work with analog pins. Try whichever library you have and see if it works.

Note that if you are using a board with an atmega328 that has A6 and A7 (nano or mini pro), those two pins will only work as analog inputs.

"3 digit 7 segment display"
Are they 3 separate displays? A 3 in one unit that requires multiplexing? If multiplexing, you need 10 IO pins. Shift registers can do that, or a MAX7219.

A MAX7219/A0-A2 driven 3-digit cc-type multiplexed display unit can be handled with the help of this library (LedControl.h).


I’ve ordered BA56-11SRWA.

I’ve ordered BA56-11SRWA


How are you going to drive it -- using 595 shift register or MAX7219 shift register?


Well I was thinking to connect it directly to Nano, but after your post, I think I need a driver.

On a Nano, the "Analog" pins A0 to A5 are digital pins. They happen to have one or two additional functions including inputs to a multiplexer for the ADC. A6 and A7 are also inputs to that multiplexer but have no other function. A4 and A5 are the I2C interface which makes them very valuable.

Now the 3-digit 7-segment (plus decimal) display you illustrate requires eleven pins and generally speaking, more current to drive than is reasonably practical from the Arduino (pins) itself. So you really want to use a display module which includes the necessary driver and will be controlled by only two or three pins.

or if it must be 0.56"

In addition, your suggestion that

I have all the digital pins occupied.

suggests that your design is not really fully thought out at all. You should explain the whole project and what you have considered so far, so that it can be reviewed to see whether it is really appropriate.

I’ve ordered BA56-11SRWA.

For future reference, that is a 28-pin common anode module which gives you access to each segment of each digit. Since you don't have enough I/O pins available for that, you'll have to multiplex anyway, so your board wiring will be complicated. But they also make a BA56-12SRWA, which is a 12-pin module that connects the segments in common internally so you don't have to.

Another choice would be the BC56-12SRWA, which is the common cathode version of that module. That would allow you to use multiplexing by segment as described here and in the related video:

In turn, that method would let you use the 74HC4017 as the segment driver. That setup would require 4 I/O pins - one for the 4017, and one for each digit cathode. And you would need one resistor for each cathode. The 4017 would drive at most three segments at one time, which it should be able to do. It probably could handle four since these displays are low-current.

But I don't have a library for you because I don't know how to write them. The Github repo describes the method and provides sample Arduino sketches, but you would have to work those into your sketch.

I would hope that he has taken the hint and is in the process of waiting for one of the ready-assembled displays I cited, which are quite easy to drive.

Of course he hasn't taken the option of telling us what he is actually up to but - well, that would be too sensible, wouldn't it? :grinning:

Paul__B, do we know what the 20-pin chip is in the Alice 3-digit module?

Paul__B, do we know what the 20-pin chip is in the Alice 3-digit module?

Eh? What "Alice 3-digit module" is this?

If you "view image" on the "4-Digit LED Display" if that is what to what you are referring, it tells you on the PCB! :grinning:

Sorry, I meant your first pic, which was the .36" four-digit module. And I see now that the chip is the TM1637.

Yes, that is the one in question. The TM1637 works OK but it does not facilitate sharing or chaining of control pins.

The only three-digit display mentioned here is the BA56-11SRWA which is the bare LED display with no driver. You could wire it up to a MAX7219 but since the pre-assembled modules are so cheap, it really isn't worth the effort.

And the eight digit module I cited has the two displays socketed, so you can remove one if you only want four digits, or mount it a short distance away with some relatively simple wiring. Clearly if you only want three digits you can mask the fourth out - it only displays if you tell it to - but almost always a use will be found for the fourth digit. :grinning: