Simulator

A 7 segment display simulator that counts

Mokxi is a free online 7 segment display simulator that runs in your browser, with nothing to install and no account needed. An Arduino Uno drives a common-cathode seven-segment display straight from eight pins, each segment through its own 220 ohm resistor, and counts from 0 to 9 once a second.

  • 455parts on the bench
  • 43boards running now
  • 1.00xreal time, on every board
Arduino Uno: a digit countinglive0.000 s 0.00x
Click to open it in the editor
It counts 0 to 9 and the dot blinks on odd digits. Click the circuit to open it in the editor.

What you can do here

In the circuit above, or in the editor it opens.

  • Watch each digit drawn from a one-byte segment pattern
  • Change the font table and make letters or your own symbols
  • Switch the display to common anode and see what has to change
  • Pick red, green, blue, yellow or white segments
  • Move up to a four-digit display, a TM1637 or a MAX7219
  • Drive one from logic chips alone with a CD4511 decoder

What the running circuit shows

Seven LEDs and a byte per digit.

Each segment is an LED, so a digit is a pattern of lit segments. The sketch keeps the ten digits as one byte each, segment a in the lowest bit (0x3F for 0, 0x06 for 1, up to 0x6F for 9), and walks the seven bits setting each segment’s pin: a on pin 7, b on 6, c on 5, d on 11, e on 10, f on 8 and g on 9, with the dot on pin 4. In the engine the display shows 0 to 9 a second apart, the serial monitor prints each digit, and the dot is lit on the odd ones.

Seven resistors, one per segment, is the right way to wire one: every segment gets the same current whatever the digit. The cheap way, one resistor on the common pin, makes an 8 dimmer than a 1, and the electronic dice project wires it that way so you can see the difference.

The truth table, digit by digit

Which segments each number lights, and the byte for it.

Segments are named a to g clockwise from the top, with g across the middle. With segment a in the lowest bit, as in the running sketch, the ten digits on a common-cathode display are: 0 lights a, b, c, d, e and f (0x3F); 1 lights b and c (0x06); 2 lights a, b, d, e and g (0x5B); 3 lights a, b, c, d and g (0x4F); 4 lights b, c, f and g (0x66); 5 lights a, c, d, f and g (0x6D); 6 lights a, c, d, e, f and g (0x7D); 7 lights a, b and c (0x07); 8 lights all seven (0x7F); and 9 lights a, b, c, d, f and g (0x6F).

Letters come from the same table. The hex digits are A (0x77), b (0x7C), C (0x39), d (0x5E), E (0x79) and F (0x71), with b and d in lower case so they do not look like 8 and 0. Letters such as K, M, W and X have no shape on seven segments that reads clearly. On a common-anode display a segment lights on LOW, so every bit is inverted.

Displays in the parts bin

From one digit to eight, with or without a microcontroller.

The single digit comes common cathode or common anode. The parts bin also has a four-digit display you multiplex yourself, a TM1637 module with its own driver chip, an eight-digit MAX7219 module, an HT16K33 backpack, and a CD4511 BCD decoder that drives a digit from four switches with no code at all.

Questions

Is it free?

Yes. The circuit on this page, every part in it and the editor it opens in are on the free plan, with no card.

Do I need an account?

No. The circuit runs the moment the page does, and the editor opens without one. A free account is only for saving a project to the cloud and sharing it by link.

Common anode or common cathode?

Both. Set the part’s common property. On a common-anode display the common pin goes to 5 V and a segment lights when its pin goes LOW, so the sketch inverts every bit.

What is the 7 segment display truth table for 0 to 9?

With segment a in the lowest bit, 0 to 9 are 0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F and 0x6F on a common-cathode display. The running sketch keeps exactly that table, one byte per digit.

Can I simulate a 4 digit 7 segment display?

Yes, with the four-digit part and a multiplexing sketch, or with a TM1637 or MAX7219 module that does the multiplexing for you.

Can I build one without an Arduino?

Yes. A CD4511 decoder takes a four-bit number from switches or a counter chip and lights the right segments, and the BCD decoder page has that circuit running.

Make a display count

Open the circuit, change the font and press Run. Nothing to install, and no account needed.