You are on page 1of 4

4-digit display (Troyka module)

A 4-digit display is represented by four seven-segment displays and control logic that are
mounted on a single board.

You may need a 4-digit display, for example, if you want to display the current time or the
readings from one of the sensors. It is easy to use: you need to connect it to a control circuit
board, such as Arduino, using only one three-wire ribbon cable.

Example of use with Arduino


To connect the module to Arduino, it would be a good idea to use a Troyka Shield. For
example, let’s connect the ribbon cable from the module to the contact group related to pin
9. In your project, you can use any pins.
To control the display, we have created the QuadDisplay library. It contains all the details of
the protocol through which data is transmitted to the display and provides simple and clear
functions for outputting the values in a variety of formats.

Let’s output several values to the display as an example.


quaddisplay.ino
// Connecting the library
#include <QuadDisplay.h>

// Indicating the number of the digital pin (pin 9)


#define DISPLAY_PIN 9

void​ setup()
{
}

void​ loop()
{
​// outputting an integer
displayInt(DISPLAY_PIN, ​123​);
delay(​1000​);

​// and then its negative value


displayInt(DISPLAY_PIN, -​123​);
delay(​1000​);

​// we can output leading zeroes (0012)


displayInt(DISPLAY_PIN, ​12​, ​true​);
delay(​1000​);

​// we can also output real numbers


​// with prescribed accuracy, for instance, 2 digits after decimal point
displayFloat(DISPLAY_PIN, -1.23, ​2​);
delay(​1000​);

​// or we could output temperature in °C


displayTemperatureC(DISPLAY_PIN, -​5​);
delay(​1000​);

​// we could write some simple text (on/off, for example) or


​// some random graphs
displayDigits(DISPLAY_PIN, QD_O, QD_f, QD_f, QD_NONE); ​// off
delay(​1000​);
displayDigits(DISPLAY_PIN, QD_O, QD_n, QD_NONE, QD_NONE); ​// on
delay(​1000​);

/​ / In the end, you will need to clear out the display


displayClear(DISPLAY_PIN);
delay(​1000​);
}
Board components

There are four seven-segment LEDs mounted on the top side of the board, and on its bottom
side, we can find the control logic that controls these displays.

Contacts pins for the 3-wire ribbon cable


The module is connected to the control electronics by three wires. Pin functions of the 3-wire
ribbon cable:
● Power (V) - red wire. There must be voltage applied to it from 3.3 V to 5 V;
● Ground (G) - black wire. It must be connected to the ground of the microcontroller;
● Signal (S) - yellow wire. It is connected to the digital output of the microcontroller.
Through it, binary data is transmitted to the control logic of the display. This is the
data used to encode output characters.

Seven-segment Displays
A seven-segment display is represented by eight LEDs in one body: 7 segments + the dot.
Each of the four indicators has 10 pins. Eight pins are used to transfer the displayed
numbers and the dot, coded as a binary number; one output is responsible for power, and
another output is the ground.

Control logic
Individually, the control of all segments would require 8 × 4 = 32 microcontroller outputs.
This is much more than most of them are able to provide.

The idea is to use fewer outputs, that’s why the seven-segment displays are connected
through a chain of shift registers. There is one 74HC595 register for each of the four
displays.
Shift registers are controlled via the SPI-interface, and thus to communicate with the
microcontroller the following lines are required: MOSI, MISO, SCK, SS, Vcc and GND. In
total, there are 6 lines.

There is additional circuitry implemented on the QuadDisplay module, which reduces 6 lines
to three: signal, power and ground. This trick is called the 1-wire SPI.

Schematic and mounting diagrams

Characteristics
Voltage supply From 3 to 5 V

Maximum current consumption 150 mA (at 5 V power supply)

You might also like