Juritronics Build smarter. Present faster.

Project Videos

Juritronics player view
Build video
The whole build in about five minutes: cardboard segments, servos, wiring, simulation and the display counting down.

Documentation, Diagrams and Code

Sign in to view

What is the Servo 7-Segment Display?

Photo or diagram Sign in to see the images for this step. Sign in

It is a big 7-segment display, the same shape as the digits on a microwave clock, but every segment is a cardboard (or 3D printed) flap mounted on its own servo. One side of each flap is coloured, the other side is blank. To draw a 7, the ESP32 turns segments a, b and c to their coloured side and keeps the rest hidden.

The whole display is run by one ESP32 DevKit. It creates its own open Wi-Fi network called Servo-7Seg, and the dashboard opens on your phone as soon as you connect. No app and no internet are needed.

What you will learn

  • Driving seven 360° continuous rotation servos from the ESP32 LEDC PWM channels.
  • Turning a servo that only knows speed into a two-position flap with timed moves, and remembering where each flap is in flash.
  • Mapping characters to segment patterns (bit 0 is segment a, bit 6 is g).
  • Avoiding collisions: the upper flaps (b and f) swing over the middle segment g, so they close first while g turns.
  • Serving a web dashboard and captive portal from the ESP32 and keeping a slow phone from ever delaying a servo stop.
  • Testing the circuit and code in a simulator first, so you only wire it once.

Watch the Build Video

Video for this step Sign in to watch this video. Sign in

The video shows the whole build in about five minutes: cutting the cardboard segments, fixing them to the servos, placing the servos on the board, hiding the cables, wiring the ESP32, simulating the circuit and finally the display counting down from 9. Every step from the video is written out below with the sizes and tips, so you can follow along at your own pace.

How the Mechanical 7-Segment Display Works

  1. Pick a pattern. Every character has a 7-bit pattern. charToSeg('7') returns 0x07: segments a, b and c on.
  2. Compare with the flaps. For each segment the code knows whether its flap is open or closed. Only flaps that need to change are moved.
  3. Timed spin. A 360° servo cannot go to an angle. It turns at a speed set by the pulse width: 1500 µs stops it, 1700 µs turns one way, 1300 µs the other. The code spins a flap for its calibrated time (500 ms by default for half a turn) and then switches the pulses off.
  4. Stagger. Servos start 60 ms apart. Seven servos starting together pull a big current spike that can reset the ESP32 (a brownout).
  5. Protect segment g. When g has to move, b and f close first, g turns, and then b and f go to their own state. The flaps never hit each other.
  6. Remember. The open or closed state of every flap is saved in flash, so after a power cut the display knows where it is and nothing moves at power on.

Display modes

  • Manual: tap a digit or letter on the dashboard.
  • Count up / count down: 0 to 9 and around again.
  • Random: a new random digit (never the same twice in a row) using esp_random().
  • Text: type up to 40 characters and the display spells them one by one, with a blank in between so double letters (LL) are visible.

Each character stays up for the interval (1.5 s by default), counted from the moment every servo has stopped.

Components and Parts List

PartQtyNotes
ESP32 DevKit V1 (38-pin)1Any ESP32 dev board works if you keep the same GPIOs (or change them on the dashboard).
360° continuous rotation servo (SG90 or MG90 size, FS90R type)7Must be the continuous type, not a 180° servo. The build in the video uses SG90 size servos; metal gear MG90 ones work too. Keep the horns and their small screws.
5 V USB adapter, 2 A or more, and a USB cable1Powers the ESP32, and the servos through its 5 V pin. A laptop USB port is often too weak for seven servos.
Breadboard or screw terminal strip1To share 5 V and GND between the seven servos.
Jumper wires20Dupont male/female.
Cardboard segments, 8 × 3 cm7One per segment. 8 × 2 cm is even better: thinner segments look sharper and have more room to turn. Foam board or 3D printed flaps also work.
Small cardboard squares14Seven join each segment to its servo horn, and seven more are spacers so each servo sits flat on the board.
Backing board, about 15 × 22 cm1Thick cardboard or MDF. Colour it with a white marker or spray paint it.
Hot glue gun and glue sticks1Holds the whole display together.
Craft knife and a small screwdriver1To cut the cable holes and tighten the horn screws.

The status LED on GPIO 2 (lit while any servo is turning) is the one already on the ESP32 board.

Circuit Diagram and Wiring

Below is the full ESP32 7-servo circuit. Press Run to simulate it, connect to the Servo-7Seg Wi-Fi page in the simulator and watch the segments flip. Use Edit circuit to change it or open it in a full window.

SegmentServo signal
a (top)GPIO 13
b (top right)GPIO 14
c (bottom right)GPIO 27
d (bottom)GPIO 26
e (bottom left)GPIO 25
f (top left)GPIO 33
g (middle)GPIO 32
  • Each servo’s signal (orange) wire goes to its own GPIO from the table.
  • Join all seven servo + (red) wires together and connect them to the ESP32 5V (VIN) pin.
  • Join all seven servo − (brown) wires together and connect them to an ESP32 GND pin.
  • Power the ESP32 from a good 5 V USB adapter. The 5V pin passes the USB power straight to the servos.

You do not need a servo driver board. Small servos like the SG90 take their signal straight from an ESP32 pin; only the power has to be shared well.

Wire it in this order

  1. Power first. Join all the red wires to 5V and all the brown wires to GND. Check them twice: a servo plugged in backwards gets hot fast.
  2. Then the signals. Connect the orange wires one at a time, following the table. Labelling each cable a to g while you build makes this part easy.
  3. Plug in the USB last, once every wire is in place.

Simulate it before you wire it

Before you connect anything for real, press Run sketch on the circuit above. The simulated servos move exactly like the real ones: choose 0 and you will see six segments turn to draw a zero while g stays hidden. If the servos move in the simulator, the code and the circuit are right, so any problem on your bench is a wiring or power problem. You can also use Edit circuit to draw your own version (for example with different pins) and test it first.

Interactive circuit Sign in to open and simulate the circuit. Sign in

Building the Display

These are the steps from the build video. You do not need to be perfect anywhere: a few millimetres out still reads as a clear digit.

1. Cut the segments

  1. Cut seven segments from cardboard, 8 × 3 cm each (8 × 2 cm is perfect). Colour the side that will face you so it stands out from the board.
  2. Cut seven small squares of cardboard. These join each segment to its servo horn.

2. Prepare the servos

  1. Fit a horn on each of the seven servos and tighten the small horn screw, so the horn can never work loose while the servo turns back and forth.
  2. Hot glue a small square onto each horn, then glue a segment onto the square, centred on the shaft.
  3. Glue a second small piece of cardboard under each servo as a spacer, so the servo sits flat and level on the board.
  4. Put a dot of hot glue where the cable leaves each servo and lay the cable along the body. A loose, hanging cable pulls the servo out of line later.

3. Place the servos on the board

  1. Take a board of about 15 × 22 cm and colour it with a white marker or spray paint it.
  2. Glue the servos in the shape of an 8: a at the top, b and c down the right, d at the bottom, e and f down the left and g in the middle. Position each one by eye around the centre of its segment.
  3. Leave a small gap between neighbouring segments so each one can turn freely without touching the next. Look at the board from straight above (the top view in the video) to check the spacing.

4. Tidy the cables

  1. Cut a small hole in the board next to each servo with a craft knife. Cut away from your hands and take your time.
  2. Push each servo cable through its hole to the back of the board, so the front stays clean and the cables cannot catch a turning segment.
  3. Label each cable a to g at the back. You will thank yourself when wiring.

Now wire it up using the circuit and pin table above, upload the code and calibrate.

ESP32 Code: Main Sketch (main.cpp)

The main sketch holds the display modes, the web API and the captive portal. The servos are moved by their own FreeRTOS task on core 1, so a slow phone connection can never make a movement stutter. Put each of the following files in its own tab in the Arduino IDE (or in src/ for PlatformIO).

Code for this step Sign in to view and copy the code. Sign in

config.h and secrets.h: Pins and Wi-Fi

config.h holds the default servo pin for each segment. secrets.h holds the Wi-Fi names. Leave STA_SSID empty to only use the display's own Servo-7Seg network, or fill it in to also join your home Wi-Fi.

Code for this step Sign in to view and copy the code. Sign in

settings.h: Calibration Saved in Flash

Every setting (pins, turn direction, spin times, speed, stop pulse, stagger and interval) is kept in the ESP32 flash with Preferences, so your calibration survives a power cut.

Code for this step Sign in to view and copy the code. Sign in

segments.h: Flipping Segments with 360 Degree Servos

This is the heart of the project. Each flap is a timed spin, starts are staggered, and the g sequence closes b and f before the middle segment turns. The character table at the end maps digits and most letters to segment patterns.

Code for this step Sign in to view and copy the code. Sign in

web_page.h: Phone Dashboard

The dashboard shows what is on the display, has a button for every digit and letter, starts the modes, and has a calibration panel for each segment.

Code for this step Sign in to view and copy the code. Sign in

Uploading the Code and Calibrating

  1. Install the ESP32 board package version 3.x in the Arduino IDE (the code uses ledcAttach() from core 3).
  2. Select ESP32 Dev Module, create the tabs above, and upload.
  3. Connect your phone to the open Wi-Fi Servo-7Seg. The dashboard opens by itself (or visit http://192.168.4.1 or http://seg7.local).
  4. In Calibrate a segment, pick segment a. Use Nudge + and Nudge - to line the flap up with its blank side out, then press It's actually closed.
  5. Press Open. If the flap stops short or goes too far, change its Open spin (ms) and press Save. Do the same with Close and Close spin (ms). If it turns the wrong way, change its Close direction.
  6. Repeat for b to g, then press Count up to check every digit.

Troubleshooting

  • The ESP32 restarts when several segments move: the USB supply is too weak for the servos. Use a 5 V adapter of 2 A or more, a short thick USB cable, and raise Gap between servo starts (ms).
  • A flap slowly drifts out of line: fine tune its open and close times, or use Nudge and It's actually open/closed to reset its state.
  • A servo creeps when it should stand still: change Stop pulse (us) a few microseconds up or down.
  • Segments b or f hit g: tick them under Segments in g's way in the Motion settings.
  • The dashboard does not open: turn off mobile data, or open http://192.168.4.1 by hand.
  • A segment slips on its servo: the horn screw is loose or the glue has let go. Tighten the screw and re-glue the small square on the horn.
  • A segment rubs on its neighbour: the servos are too close. Move one slightly, or trim the segment (8 × 2 cm segments give more room).
  • One servo does nothing: check its orange wire is on the right GPIO from the table and that its red and brown wires reach 5V and GND. Run the circuit in the simulator to rule out the code.

Frequently Asked Questions

Can I use normal 180 degree servos?

Yes, and it is simpler: write 0° for hidden and 180° for shown instead of timed spins. This build uses 360° servos because the flap can keep turning the same way and the servos are cheap.

How many characters can it show?

All digits and most letters. Letters such as M, W and X do not fit a 7-segment shape, so they are approximated.

Do I need a servo driver board?

No. The ESP32 drives all seven servos straight from its pins. A PCA9685 driver only becomes useful when you add more digits.

Can I use an Arduino Uno instead of an ESP32?

Yes, the servos and the wiring are the same, just on the Uno’s pins and 5V. The Uno has no Wi-Fi, so it runs the display modes without the phone dashboard. An Arduino Uno version of the code is on the way for this page.

Can I use 3D printed segments instead of cardboard?

Yes. Keep them light: heavy segments make the small servos overshoot and need longer calibration times.

Can I chain several digits?

Each digit needs seven servo pins. One ESP32 can drive two digits (14 servos) on its free PWM pins; for more, use a PCA9685 16-channel servo driver over I2C.

Mini Store

Open full store