0

I'm trying to add a 4-digit 7-segment display to an existing project (a temperature & relative humidity sensor) to show the temperature on the display.

I bought the display a long time ago and I it doesn't have any ID and I don't have any reference to a schematic, so I followed this article to find out both if it's a common cathode or anode and the pinout.

It turns out it's a common cathode display and the pinout goes like this (numbered from upper left):

1 -> D1
2 -> A
3 -> F
4 -> D2
5 -> D3
6 -> B
7 -> E
8 -> D
9 -> DP
10 -> C
11 -> G
12 -> D4

Where D{1,2,3,4} are the digit control pins and the rest are the segments.

So I added the SevSeg library to my project. And the sketch compiles, but when I upload it to my Arduino Uno all the LEDs in the digits 1 and 4 light up and digits two and three remain off.

I checked the pinout twice, with the same results and the display doesn't seem to be damaged. Do you see any issue on my code?

Thanks in advance!

  • isolate the area of failure ... switch the digit pin wires ... see if the problem is with the display, or with program – jsotola Aug 17 at 20:19
  • Be sure, that you don't connect anything to the pins used by the ethernet shield – chrisl Aug 18 at 15:37
1

What caused the problem of the digit that driven by pin 12 is quite obvious to me. You use pin 11, 12, 13, 14 for driving the 7-segment digits. While SPI library by default uses pin 10, 11, 12, 13 as SS, MOSI, MISO and SCK, and set pin 12 (MISO) as INPUT which is in conflict with your pin 12 (as an OUTPUT) for driving the digit.

Pin 13 is also used by the interval blinking LED (i.e. BUILTIN_LED) when defined as a digital i/o.

Your code uses quite a few libraries, and those libraries could uses some of the I/O pins, I would suggest you reduce your code to only the code related to SevSeg, set the display to all '8888', and add each library one by one back to find out what caused the problem.

| improve this answer | |
0

Your issue could be in code or in your hardware.

To work out which one, try running one of the example sketches like the testWholeDisplay.ino that comes with the library you are using. This way you have known working code and you are testing that your hardware is wired up correctly. If this step doesn't work, then you need to look into your wiring and/or setup.

If using the example sketch works, then you can start looking into your sketch. Divide it into chunks and test each chunk independently. If any chunk doesn't work then work out what is different from the example sketches compared to your code.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.