Sparkfun has made life much easier when working with 7-segment displays. To do so, they made their own PCB which has an Atmel 328P on the back and a 4-digit 7-segment display on the front.

Communicating with the display

The easiest way to communicate with this display is using Serial or SoftwareSerial. There are advantages and disadvantages to both. For certain cases, I2C is also an option.

Serial

Serial is a native communication for Arduino. However, the Serial UART pins are shared for both the 7-Seg module as well as the FTDI USB translator on the Arduino board. As such, any code you send to the Arduino will also be sent to the 7-seg. If using Serial, you [b][u]MUST NOT[/u][/b] connect the Tx pin of the 7seg to the Rx pin of the Arduino. Otherwise, the 328P will get flashed with the same code as the Arduino.

SoftwareSerial

SoftwareSerial is the preferred communication for this module. It circumvents the conflict of communication above, and/or also frees up the native UART pins to be used for other sensors or modules. Note that using SWS will affect the use of interrupt timers. Please refer to the documentation at https://docs.arduino.cc/learn/built-in-libraries/software-serial/ .

I2C / “Wire”

For the cases where you need the native UART pins free and do not have any SoftwareSerial pins available, I2C is an option (called “Wire” in the Arduino IDE). The default address is 0x71 .

Photos

Product Links

https://www.sparkfun.com/products/11441 – Red digits

https://www.sparkfun.com/products/11629 – White digits

https://www.sparkfun.com/products/11442 – Blue digits

References

Sparkfun has published all their information to Github: https://github.com/sparkfun/Serial7SegmentDisplay

Of particular interest is their Special Commands page: https://github.com/sparkfun/Serial7SegmentDisplay/wiki/Special-Commands

This details how to use all 4 period, the colon, and the apostrophe.

Example code

Here is example code for using the display using Software Serial or I2C.

Something interesting to note as I experimented with both the older version of the displays that I have and the newer style being used in a current project, the command for setting the comma/colon/apostrophe must be sent with each digit-writing packet. It seems that sending the clear command (‘v’ or 0x76) clears the punctuation. The older boards sustained punctuation on a ‘clear’ command.

  Serial7seg.write('v');  // Clears the display, ASCII 'v' is same as 0x76 (refer to ASCII table)
  Serial7seg.write(0x77);  // Special Command for controlling commas, colon, apostrophe. Could also use write('w'), see line above
  Serial7seg.write(0b00010000); // Turns on only the colon