ESP32 S3 UNO - Multi-Function Shield

This ESP32 S3 Uno multi-function shield tutorial shows you how to stack the shield on the ESP32 S3 Uno form board and control every part on it with Arduino code. One board gives you a 4-digit 7-segment display, three buttons, four LEDs, a buzzer, a knob and an LM35 temperature sensor. You will also learn the small pin-map change and the 3.3V safety steps this board needs.

In this tutorial, you will:

  1. Stack the multi-function shield and set its ESP32 S3 Uno GPIO pin map in code
  2. Show numbers, decimals and text on the 74HC595 7-segment display
  3. Read button presses and switch the four LEDs on, off or blinking
  4. Make short beeps with the buzzer
  5. Read the potentiometer and measure temperature with the LM35 sensor
ESP32 S3 Uno multi-function shield

Watch the video below to see every example of the shield in action.

Overview of Multi-Function Shield

The multi-function shield is a learning board that puts six common parts on top of an Uno-shaped board. Knowing what each part is, and which pin it uses, makes the code and the 3.3V safety notes easy to follow.

4-digit 7-segment display

The display is driven by a 74HC595 shift register, so it needs only three pins. It can show whole numbers, decimal numbers, the letters A to Z and a few symbols such as the degree sign (°).

Three push buttons

Buttons S1, S2 and S3 are active LOW. Each one has a pull-up resistor on the shield, so the pin reads HIGH when the button is up and LOW when you press it. The library also removes the button bounce for you.

Four LEDs

LEDs D1 to D4 are active LOW as well. You can turn each one on or off, toggle it, blink it, or blink all four at the same time.

Buzzer

The buzzer is active LOW. The library can make a single beep or a beep after a delay, without blocking your code.

Potentiometer

A multi-turn trimmer sits on A0. The library gives you the raw ADC value or a 0 to 100% value. On the ESP32 S3 Uno, the raw value goes from 0 to 4095, because the ADC is 12-bit.

LM35 temperature sensor

The LM35 sits on A4 and gives 10 mV per °C. You must remove jumper J1 before you use it.

The shield uses the classic Uno header positions. The table shows where each part lands and its GPIO number on the ESP32 S3 Uno.

Shield Part Uno Header ESP32 S3 Uno GPIO
LED D1 D13 GPIO12
LED D2 D12 GPIO13
LED D3 D11 GPIO11
LED D4 D10 GPIO10
Button S1 A1 GPIO1
Button S2 A2 GPIO7
Button S3 A3 GPIO6
Buzzer D3 GPIO17
Display LATCH D4 GPIO19
Display CLOCK D7 GPIO14
Display DATA D8 GPIO21
Potentiometer A0 GPIO2
LM35 Temp Sensor A4 GPIO5
Multi-Function Shield Pinout

※ NOTE THAT:

On the ESP32 S3 Uno, A4 and A5 are plain analog pins. They are not the default I2C pins. The default I2C pins are the separate SDA (GPIO8) and SCL (GPIO9) header pins. So the LM35 on A4 does not clash with an I2C module on those pins.

ESP32 S3 Uno Pinout

The image below shows the pinout diagram of the ESP32 S3 Uno form board. Use it to see the Uno header pins (D3, D4, D7, D8, D10 to D13, A0 to A4) and their GPIO numbers.

ESP32 S3 Uno pinout diagram

Wiring Diagram

The ESP32 S3 Uno has the Uno shape, so the shield plugs straight onto its headers. You do not need any jumper wires or a breadboard.

The wiring diagram between ESP32 S3 Uno Multi-Function Shield

This image is created using Fritzing. Click to enlarge image

Good to know: the picture shows only how the shield plugs in. The three 18 kΩ resistors from the warning below go under the shield, so you cannot see them in the picture.

Shield Part ESP32 S3 Uno Pin
5V 5V
GND GND
LED D1 D13 (GPIO12)
LED D2 D12 (GPIO13)
LED D3 D11 (GPIO11)
LED D4 D10 (GPIO10)
Button S1 A1 (GPIO1)
Button S2 A2 (GPIO7)
Button S3 A3 (GPIO6)
Buzzer D3 (GPIO17)
Display LATCH D4 (GPIO19)
Display CLOCK D7 (GPIO14)
Display DATA D8 (GPIO21)
Potentiometer A0 (GPIO2)
LM35 sensor A4 (GPIO5)

WARNING

The shield runs from the 5V pin, but the ESP32 S3 Uno pins are 3.3V only and NOT 5V tolerant. Two parts send a voltage INTO the board. First, the potentiometer sits between 5V and GND, so its A0 output can reach 5V. Before you stack the shield, turn the trimmer screw about 20 turns counter-clockwise, so it starts at the 0V end. Later, stop turning as soon as the Serial Monitor shows 100%. Second, the buttons on A1, A2 and A3 have pull-up resistors to 5V (10 kΩ on most versions). For long-term safety, solder an 18 kΩ resistor from each of A1, A2 and A3 to GND on the bottom of the shield. This keeps the button pins at about 3.2V when no button is pressed.

WARNING

Before you use the LM35, remove jumper J1. On most versions of this shield, J1 adds a pull-up resistor to the A4 line (for a DS18B20 sensor). With J1 in place, the reading is wrong and A4 (GPIO5) is pulled toward 5V.

※ NOTE THAT:

The shield does not use D6 (GPIO3) or D9 (GPIO46). These are boot strapping pins on the ESP32 S3 Uno. The shield only brings them out to a small header. Keep that header empty while the board starts and while you upload code.

How to Install the Library

The DIYables_MultiFuncShield library does all the hard work: display refresh, button debounce, LED blink timing and buzzer timing. You install it once from the Library Manager.

  1. Connect the board. Plug the ESP32 S3 Uno into your computer with a USB Type-C cable.
  2. Pick the board. In the Arduino IDE, choose the ESP32S3 Dev Module board and the correct COM port.
  3. Open the Library Manager. Click the Libraries icon on the left bar.
  4. Search for it. Type "DIYables_MultiFuncShield" into the search box and find the library by DIYables.
  5. Install it. Click the Install button.
  • Search for DIYables_MultiFuncShield created by DIYables.io and click the Install button.
∞
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Library Manager
Type:
All
Topic:
All
DIYables_MultiFuncShield by DIYables.io
Self-contained library for Multi-Function Shield components including 4-digit 7-segment display, buttons, LEDs, buzzer, potentiometer, and temperature sensor. No external dependencies. Uses Arduino standard APIs for compatibility across all platforms. More info
1.0.0
INSTALL
Newbiely.ino
···
1 void setup() {
Output
Serial Monitor
Ln 1, Col 1
ESP32S3 Dev Module on COM15
1

The library has no other dependencies. It works on all Arduino platforms, including the ESP32 S3 Uno.

Minimal Sketch Structure

Every sketch in this tutorial starts with the same frame. On the ESP32 S3 Uno, this frame has one extra part: a pin map. The library uses Uno pin numbers by default (13, 12, A1...). These numbers point to other GPIOs on the ESP32 S3 Uno, so you must pass the real GPIO numbers with an MFS_Pins object.

#include <DIYables_MultiFuncShield.h> // ESP32 S3 Uno pin map (Uno header -> GPIO) MFS_Pins espPins() { MFS_Pins p; p.led1 = 12; // D13 p.led2 = 13; // D12 p.led3 = 11; // D11 p.led4 = 10; // D10 p.button1 = 1; // A1 p.button2 = 7; // A2 p.button3 = 6; // A3 p.buzzer = 17; // D3 p.dispLatch = 19; // D4 p.dispClock = 14; // D7 p.dispData = 21; // D8 p.pot = 2; // A0 p.lm35 = 5; // A4 return p; } DIYables_MultiFuncShield shield(espPins()); void setup() { shield.begin(); // Set up display, buttons, LEDs, buzzer } void loop() { shield.loop(); // Refresh display, poll buttons, update LEDs & buzzer }

shield.begin() sets up every part of the shield. shield.loop() must run on every pass of loop(), because it keeps the display multiplexing, button debounce, LED blinking and buzzer timing going.

WARNING

The library already makes a global object called MFS with the Uno pin numbers. Do not create your own object with the name MFS. The code will not compile ("multiple definition of MFS"). Use another name, like shield, and never call MFS.begin() on the ESP32 S3 Uno. It would set up the wrong GPIOs.

7-Segment Display Example

The display is the part you will use most, so it is a good place to start. This sketch shows a new display format every 3 seconds.

/* * This ESP32 S3 Uno code was developed by newbiely.com * * This ESP32 S3 Uno code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3-uno/esp32-s3-uno-multi-function-shield */ /* * Multi-Function Shield - Display Example for ESP32 S3 Uno * * Cycles through display features every 3 seconds: * 1. Integer number * 2. Integer with leading zeros * 3. Float number * 4. Text string with letters * 5. Text string with dot * 6. Degree symbol + C (special chars) * 7. Dashes * * Hardware: DIYables Multi-Function Shield on the ESP32 S3 Uno form board * * COMPATIBLE Multi-Function Shield: * - https://diyables.io/products/multi-function-shield-for-arduino-uno-mega * * COMPATIBLE BOARD: * - DIYables ESP32 S3, Uno-form factor: https://diyables.io/esp32-s3-uno * * NOTE: ESP32 S3 Uno pins are 3.3V only (NOT 5V tolerant). */ #include <DIYables_MultiFuncShield.h> // The library uses Uno pin numbers by default. The ESP32 S3 Uno has the same // header positions, but different GPIO numbers, so we pass them here. MFS_Pins espPins() { MFS_Pins p; p.led1 = 12; // LED D1 -> D13 (GPIO12) p.led2 = 13; // LED D2 -> D12 (GPIO13) p.led3 = 11; // LED D3 -> D11 (GPIO11) p.led4 = 10; // LED D4 -> D10 (GPIO10) p.button1 = 1; // Button S1 -> A1 (GPIO1) p.button2 = 7; // Button S2 -> A2 (GPIO7) p.button3 = 6; // Button S3 -> A3 (GPIO6) p.buzzer = 17; // Buzzer -> D3 (GPIO17) p.dispLatch = 19; // Display LATCH -> D4 (GPIO19) p.dispClock = 14; // Display CLOCK -> D7 (GPIO14) p.dispData = 21; // Display DATA -> D8 (GPIO21) p.pot = 2; // Potentiometer -> A0 (GPIO2) p.lm35 = 5; // LM35 sensor -> A4 (GPIO5) return p; } // The library already has a global object called MFS (with Uno pins). // Use our own object with the ESP32 S3 Uno pins, and never call MFS.begin(). DIYables_MultiFuncShield shield(espPins()); uint8_t step = 0; unsigned long lastUpdate = 0; void setup() { shield.begin(); } void loop() { shield.loop(); if (millis() - lastUpdate >= 3000) { lastUpdate = millis(); switch (step) { case 0: // Integer: " 42" shield.display.print(42); break; case 1: // Integer with leading zeros: "0042" shield.display.print(42, true); break; case 2: // Float with 2 decimals: "3.14" shield.display.print(3.14, 2); break; case 3: // Text string: "HELP" shield.display.print("HELP"); break; case 4: // Text with dot: "Ab.Cd" shield.display.print("Ab.Cd"); break; case 5: // Degree + C using special chars: "25°C" shield.display.clear(); shield.display.setNumber(1, 2); shield.display.setNumber(2, 5); shield.display.setChar(3, SegChars::DEGREE); shield.display.setChar(4, SegChars::C); shield.display.show(); break; case 6: // Dashes: "----" shield.display.print("----"); break; } step = (step + 1) % 7; } }

How to Run

  1. New to the ESP32 S3 Uno? Follow ESP32 S3 Uno - Getting Started first.
  2. Stack the shield on the ESP32 S3 Uno. Follow the safety steps in the Wiring Diagram part first.
  3. Connect the board to your computer with a USB Type-C cable.
  4. Open Arduino IDE, choose the ESP32S3 Dev Module board and the correct COM port.
  5. Copy the code above and paste it into the Arduino IDE.
  6. Upload the code by clicking the Upload button.
  7. Tip: if the display shows nothing, check that your sketch uses the espPins() pin map and the shield object, not MFS.

The display goes through seven views: a whole number, a number with leading zeros, a decimal number, text, text with a dot, a degree sign, and dashes. It changes every 3 seconds.

Display Methods at a Glance

Method What It Does Usage Example
print(int) Shows a whole number shield.display.print(42)
print(int, true) Shows a whole number with leading zeros shield.display.print(42, true) → 0042
print(float, dp) Shows a decimal number shield.display.print(3.14, 2)
print(text) Shows a string (A-Z, 0-9, -, _) shield.display.print("HELP")
setNumber(pos, val) Puts one digit at a position (1–4) shield.display.setNumber(1, 5)
setChar(pos, ch) Puts one character at a position shield.display.setChar(2, 'A')
setChar(pos, SegChars) Puts a special symbol at a position shield.display.setChar(3, SegCharsDEGREE)
setDot(pos) Turns on the dot at a position shield.display.setDot(2)
clear() Blanks the whole display shield.display.clear()
show() Sends your manual changes to the display shield.display.show()

All print() versions call show() for you. When you build the display by hand with setNumber(), setChar() or setDot(), call clear() first and show() at the end.

The special symbols in SegChars are DASH, UNDERSCORE, C, E, F and DEGREE.

Button Example

Buttons let you talk to your project. This sketch prints a message each time you press or release S1, S2 or S3.

/* * This ESP32 S3 Uno code was developed by newbiely.com * * This ESP32 S3 Uno code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3-uno/esp32-s3-uno-multi-function-shield */ /* * Multi-Function Shield - Buttons Example for ESP32 S3 Uno * * Detects button presses and releases, prints to Serial Monitor. * * Hardware: DIYables Multi-Function Shield on the ESP32 S3 Uno form board * * COMPATIBLE Multi-Function Shield: * - https://diyables.io/products/multi-function-shield-for-arduino-uno-mega * * COMPATIBLE BOARD: * - DIYables ESP32 S3, Uno-form factor: https://diyables.io/esp32-s3-uno * * NOTE: ESP32 S3 Uno pins are 3.3V only (NOT 5V tolerant). */ #include <DIYables_MultiFuncShield.h> // The library uses Uno pin numbers by default. The ESP32 S3 Uno has the same // header positions, but different GPIO numbers, so we pass them here. MFS_Pins espPins() { MFS_Pins p; p.led1 = 12; // LED D1 -> D13 (GPIO12) p.led2 = 13; // LED D2 -> D12 (GPIO13) p.led3 = 11; // LED D3 -> D11 (GPIO11) p.led4 = 10; // LED D4 -> D10 (GPIO10) p.button1 = 1; // Button S1 -> A1 (GPIO1) p.button2 = 7; // Button S2 -> A2 (GPIO7) p.button3 = 6; // Button S3 -> A3 (GPIO6) p.buzzer = 17; // Buzzer -> D3 (GPIO17) p.dispLatch = 19; // Display LATCH -> D4 (GPIO19) p.dispClock = 14; // Display CLOCK -> D7 (GPIO14) p.dispData = 21; // Display DATA -> D8 (GPIO21) p.pot = 2; // Potentiometer -> A0 (GPIO2) p.lm35 = 5; // LM35 sensor -> A4 (GPIO5) return p; } // The library already has a global object called MFS (with Uno pins). // Use our own object with the ESP32 S3 Uno pins, and never call MFS.begin(). DIYables_MultiFuncShield shield(espPins()); void setup() { Serial.begin(9600); shield.begin(); } void loop() { shield.loop(); if (shield.button1.isPressed()) Serial.println("Button 1 pressed"); if (shield.button1.isReleased()) Serial.println("Button 1 released"); if (shield.button2.isPressed()) Serial.println("Button 2 pressed"); if (shield.button2.isReleased()) Serial.println("Button 2 released"); if (shield.button3.isPressed()) Serial.println("Button 3 pressed"); if (shield.button3.isReleased()) Serial.println("Button 3 released"); }

How to Run

  1. Copy the code into the Arduino IDE and click Upload.
  2. Open the Serial Monitor and set it to 9600 baud.
  3. Press and release S1, S2 and S3. Each action shows up as a new line.
  4. Tip: a quick tap gives one "pressed" line and one "released" line. The library filters out the bounce.
∞
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32S3 Dev Module' on 'COM15')
New Line
9600 baud
Button 1 pressed Button 1 released Button 2 pressed Button 2 released Button 3 pressed Button 3 released
Ln 11, Col 1
ESP32S3 Dev Module on COM15
2

Button Methods at a Glance

Method What It Does
isPressed() Returns true at the moment the button goes down
isReleased() Returns true at the moment the button comes back up
setDebounceTime(ms) Changes the debounce time (50 ms by default)

Each button is debounced for you. It is active LOW, and the library turns on the internal pull-up too. You can use shield.button1, shield.button2 and shield.button3, or the index form shield.button(1) to shield.button(3).

LED Example

LEDs are the simplest way to show a state. This sketch turns the four LEDs on one by one, then off, blinks LED 1 alone, and finally blinks all four together.

/* * This ESP32 S3 Uno code was developed by newbiely.com * * This ESP32 S3 Uno code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3-uno/esp32-s3-uno-multi-function-shield */ /* * Multi-Function Shield - LEDs Example for ESP32 S3 Uno * * Demonstrates turn on, turn off, and blink for each LED. * * Hardware: DIYables Multi-Function Shield on the ESP32 S3 Uno form board * * COMPATIBLE Multi-Function Shield: * - https://diyables.io/products/multi-function-shield-for-arduino-uno-mega * * COMPATIBLE BOARD: * - DIYables ESP32 S3, Uno-form factor: https://diyables.io/esp32-s3-uno * * NOTE: ESP32 S3 Uno pins are 3.3V only (NOT 5V tolerant). */ #include <DIYables_MultiFuncShield.h> // The library uses Uno pin numbers by default. The ESP32 S3 Uno has the same // header positions, but different GPIO numbers, so we pass them here. MFS_Pins espPins() { MFS_Pins p; p.led1 = 12; // LED D1 -> D13 (GPIO12) p.led2 = 13; // LED D2 -> D12 (GPIO13) p.led3 = 11; // LED D3 -> D11 (GPIO11) p.led4 = 10; // LED D4 -> D10 (GPIO10) p.button1 = 1; // Button S1 -> A1 (GPIO1) p.button2 = 7; // Button S2 -> A2 (GPIO7) p.button3 = 6; // Button S3 -> A3 (GPIO6) p.buzzer = 17; // Buzzer -> D3 (GPIO17) p.dispLatch = 19; // Display LATCH -> D4 (GPIO19) p.dispClock = 14; // Display CLOCK -> D7 (GPIO14) p.dispData = 21; // Display DATA -> D8 (GPIO21) p.pot = 2; // Potentiometer -> A0 (GPIO2) p.lm35 = 5; // LM35 sensor -> A4 (GPIO5) return p; } // The library already has a global object called MFS (with Uno pins). // Use our own object with the ESP32 S3 Uno pins, and never call MFS.begin(). DIYables_MultiFuncShield shield(espPins()); void setup() { Serial.begin(9600); shield.begin(); // Turn on all LEDs one by one Serial.println("Turn ON LEDs one by one"); for (uint8_t i = 1; i <= 4; i++) { shield.led(i).turnON(); delay(500); } delay(1000); // Turn off all LEDs one by one Serial.println("Turn OFF LEDs one by one"); for (uint8_t i = 1; i <= 4; i++) { shield.led(i).turnOFF(); delay(500); } delay(1000); // Blink individual LED (LED 1 only) Serial.println("Blink LED 1 individually"); shield.led(1).blink(300); unsigned long start = millis(); while (millis() - start < 3000) shield.loop(); shield.led(1).turnOFF(); delay(1000); // Blink all LEDs together Serial.println("Blink all LEDs together"); shield.allLedsBlink(500); } void loop() { shield.loop(); }

How to Run

  1. Copy the code into the Arduino IDE and click Upload.
  2. Watch the LEDs. They light up one at a time with a half-second gap, then turn off the same way.
  3. Keep watching. LED 1 blinks alone for 3 seconds, and then all four blink together.
  4. Tip: open the Serial Monitor at 9600 baud to see which step is running.
∞
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32S3 Dev Module' on 'COM15')
New Line
9600 baud
Turn ON LEDs one by one Turn OFF LEDs one by one Blink LED 1 individually Blink all LEDs together
Ln 11, Col 1
ESP32S3 Dev Module on COM15
2

LED Methods at a Glance

Method What It Does
turnON() Turns the LED on
turnOFF() Turns the LED off
toggle() Flips the current state
blink(interval) Blinks with the same on and off time
blink(onTime, offTime) Blinks with your own on and off times
isOn() Returns true when the LED is on

You can also control all four LEDs at once:

Method What It Does
allLedsOn() Turns all four LEDs on
allLedsOff() Turns all four LEDs off
allLedsBlink(interval) Blinks all four LEDs together
allLedsBlink(onTime, offTime) Blinks all four with your own timing

The LEDs are active LOW. Use shield.led1 to shield.led4, or the index form shield.led(1) to shield.led(4).

Buzzer Example

A beep is a quick way to confirm an action. This sketch makes a short beep every 2 seconds.

/* * This ESP32 S3 Uno code was developed by newbiely.com * * This ESP32 S3 Uno code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3-uno/esp32-s3-uno-multi-function-shield */ /* * Multi-Function Shield - Buzzer Example for ESP32 S3 Uno * * Beeps the buzzer every 2 seconds. * * Hardware: DIYables Multi-Function Shield on the ESP32 S3 Uno form board * * COMPATIBLE Multi-Function Shield: * - https://diyables.io/products/multi-function-shield-for-arduino-uno-mega * * COMPATIBLE BOARD: * - DIYables ESP32 S3, Uno-form factor: https://diyables.io/esp32-s3-uno * * NOTE: ESP32 S3 Uno pins are 3.3V only (NOT 5V tolerant). */ #include <DIYables_MultiFuncShield.h> // The library uses Uno pin numbers by default. The ESP32 S3 Uno has the same // header positions, but different GPIO numbers, so we pass them here. MFS_Pins espPins() { MFS_Pins p; p.led1 = 12; // LED D1 -> D13 (GPIO12) p.led2 = 13; // LED D2 -> D12 (GPIO13) p.led3 = 11; // LED D3 -> D11 (GPIO11) p.led4 = 10; // LED D4 -> D10 (GPIO10) p.button1 = 1; // Button S1 -> A1 (GPIO1) p.button2 = 7; // Button S2 -> A2 (GPIO7) p.button3 = 6; // Button S3 -> A3 (GPIO6) p.buzzer = 17; // Buzzer -> D3 (GPIO17) p.dispLatch = 19; // Display LATCH -> D4 (GPIO19) p.dispClock = 14; // Display CLOCK -> D7 (GPIO14) p.dispData = 21; // Display DATA -> D8 (GPIO21) p.pot = 2; // Potentiometer -> A0 (GPIO2) p.lm35 = 5; // LM35 sensor -> A4 (GPIO5) return p; } // The library already has a global object called MFS (with Uno pins). // Use our own object with the ESP32 S3 Uno pins, and never call MFS.begin(). DIYables_MultiFuncShield shield(espPins()); unsigned long lastBeep = 0; void setup() { shield.begin(); } void loop() { shield.loop(); if (millis() - lastBeep >= 2000) { lastBeep = millis(); shield.buzzer.beep(100); } }

How to Run

  1. Copy the code into the Arduino IDE and click Upload.
  2. Listen. You hear a short beep every 2 seconds.
  3. Tip: if the buzzer never stops, see the Troubleshooting table at the end.

Buzzer Methods at a Glance

Method What It Does
beep(ms) Beeps for the given number of milliseconds
beep(ms, delayMs) Waits delayMs, then beeps for ms
stop() Stops the buzzer at once
isBeeping() Returns true while the buzzer is on

Potentiometer Example

The knob gives your project an analog input. This sketch reads it every half second and prints the raw value and the percentage.

/* * This ESP32 S3 Uno code was developed by newbiely.com * * This ESP32 S3 Uno code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3-uno/esp32-s3-uno-multi-function-shield */ /* * Multi-Function Shield - Potentiometer Example for ESP32 S3 Uno * * Reads the potentiometer and prints the raw value (0-4095) and the * percentage to the Serial Monitor. * * NOTE: The potentiometer on the shield is a multi-turn trimmer. * You need to rotate it MANY turns to go from 0% to 100%. * If the value stays at 0% or 100%, rotate in the opposite direction. * * WARNING: The shield powers the potentiometer from 5V. On the ESP32 S3 Uno * the A0 pin (GPIO2) must stay at 3.3V or less. Do not turn the knob all * the way to the 5V end. The value reaches 100% before that point. * * Hardware: DIYables Multi-Function Shield on the ESP32 S3 Uno form board * * COMPATIBLE Multi-Function Shield: * - https://diyables.io/products/multi-function-shield-for-arduino-uno-mega * * COMPATIBLE BOARD: * - DIYables ESP32 S3, Uno-form factor: https://diyables.io/esp32-s3-uno * * NOTE: ESP32 S3 Uno pins are 3.3V only (NOT 5V tolerant). */ #include <DIYables_MultiFuncShield.h> // The library uses Uno pin numbers by default. The ESP32 S3 Uno has the same // header positions, but different GPIO numbers, so we pass them here. MFS_Pins espPins() { MFS_Pins p; p.led1 = 12; // LED D1 -> D13 (GPIO12) p.led2 = 13; // LED D2 -> D12 (GPIO13) p.led3 = 11; // LED D3 -> D11 (GPIO11) p.led4 = 10; // LED D4 -> D10 (GPIO10) p.button1 = 1; // Button S1 -> A1 (GPIO1) p.button2 = 7; // Button S2 -> A2 (GPIO7) p.button3 = 6; // Button S3 -> A3 (GPIO6) p.buzzer = 17; // Buzzer -> D3 (GPIO17) p.dispLatch = 19; // Display LATCH -> D4 (GPIO19) p.dispClock = 14; // Display CLOCK -> D7 (GPIO14) p.dispData = 21; // Display DATA -> D8 (GPIO21) p.pot = 2; // Potentiometer -> A0 (GPIO2) p.lm35 = 5; // LM35 sensor -> A4 (GPIO5) return p; } // The library already has a global object called MFS (with Uno pins). // Use our own object with the ESP32 S3 Uno pins, and never call MFS.begin(). DIYables_MultiFuncShield shield(espPins()); unsigned long lastUpdate = 0; float lastPct = -1; void setup() { Serial.begin(9600); // set the ADC attenuation to 11 dB (up to ~3.3V input) analogSetAttenuation(ADC_11db); shield.begin(); Serial.println("Rotate potentiometer knob (multi-turn trimmer)."); Serial.println("It requires many turns to go from 0% to 100%."); } void loop() { shield.loop(); if (millis() - lastUpdate >= 500) { lastUpdate = millis(); int raw = shield.readPot(); // 0 - 4095 on the ESP32 S3 Uno float pct = shield.readPotPercent(); Serial.print("Raw: "); Serial.print(raw); Serial.print(" Percent: "); Serial.print(pct, 1); Serial.print("%"); if (pct <= 0.1) Serial.print(" ← MIN (rotate clockwise to increase)"); else if (pct >= 99.9) Serial.print(" ← MAX (rotate counter-clockwise to decrease)"); Serial.println(); lastPct = pct; } }

The code calls analogSetAttenuation(ADC_11db) in setup(). By default, the ESP32 S3 Uno ADC can only measure a small voltage. The 11 dB setting lets the analog pin read the full range, from 0V up to about 3.3V. Without it, the reading hits 4095 too early and the values look wrong.

How to Run

  1. Turn the trimmer to the 0V end first. Turn the screw about 20 turns counter-clockwise. It will not break at the end.
  2. Copy the code into the Arduino IDE and click Upload.
  3. Open the Serial Monitor at 9600 baud.
  4. Turn the knob slowly clockwise. The trimmer is multi-turn, so you need many turns to see a big change.
  5. Stop at 100%. On the ESP32 S3 Uno, the value reaches 100% at about 3.3V, before the knob reaches the 5V end. Do not turn further.
∞
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32S3 Dev Module' on 'COM15')
New Line
9600 baud
Rotate potentiometer knob (multi-turn trimmer). It requires many turns to go from 0% to 100%. Raw: 0 Percent: 0.0% ← MIN (rotate clockwise to increase) Raw: 1024 Percent: 25.0% Raw: 2731 Percent: 66.7% Raw: 4095 Percent: 100.0% ← MAX (rotate counter-clockwise to decrease)
Ln 11, Col 1
ESP32S3 Dev Module on COM15
2

Potentiometer Methods at a Glance

Method Return Type What It Does
readPot() int Raw ADC value (0–4095 on the ESP32 S3 Uno 12-bit ADC)
readPotPercent() float Value scaled from 0.0 to 100.0

WARNING

The potentiometer is powered from 5V, but the A0 pin (GPIO2) takes 3.3V at most. When the Serial Monitor shows 100%, the knob is at about two thirds of its travel. Turning past this point puts more than 3.3V on the pin and can damage it.

Temperature Sensor (LM35) Example

The LM35 lets your project sense the room temperature. This sketch shows the temperature in °C on the display and prints it to the Serial Monitor.

Remember: remove jumper J1 from the shield before you use the LM35 sensor. It connects extra parts to the A4 line.

/* * This ESP32 S3 Uno code was developed by newbiely.com * * This ESP32 S3 Uno code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3-uno/esp32-s3-uno-multi-function-shield */ /* * Multi-Function Shield - Temperature Example for ESP32 S3 Uno * * Reads the LM35 temperature sensor and shows Celsius on the display. * Note: Requires jumper J1 removed (pin A4 = GPIO5 on the ESP32 S3 Uno). * * Hardware: DIYables Multi-Function Shield on the ESP32 S3 Uno form board * * COMPATIBLE Multi-Function Shield: * - https://diyables.io/products/multi-function-shield-for-arduino-uno-mega * * COMPATIBLE BOARD: * - DIYables ESP32 S3, Uno-form factor: https://diyables.io/esp32-s3-uno * * NOTE: ESP32 S3 Uno pins are 3.3V only (NOT 5V tolerant). */ #include <DIYables_MultiFuncShield.h> // The library uses Uno pin numbers by default. The ESP32 S3 Uno has the same // header positions, but different GPIO numbers, so we pass them here. MFS_Pins espPins() { MFS_Pins p; p.led1 = 12; // LED D1 -> D13 (GPIO12) p.led2 = 13; // LED D2 -> D12 (GPIO13) p.led3 = 11; // LED D3 -> D11 (GPIO11) p.led4 = 10; // LED D4 -> D10 (GPIO10) p.button1 = 1; // Button S1 -> A1 (GPIO1) p.button2 = 7; // Button S2 -> A2 (GPIO7) p.button3 = 6; // Button S3 -> A3 (GPIO6) p.buzzer = 17; // Buzzer -> D3 (GPIO17) p.dispLatch = 19; // Display LATCH -> D4 (GPIO19) p.dispClock = 14; // Display CLOCK -> D7 (GPIO14) p.dispData = 21; // Display DATA -> D8 (GPIO21) p.pot = 2; // Potentiometer -> A0 (GPIO2) p.lm35 = 5; // LM35 sensor -> A4 (GPIO5) return p; } // The library already has a global object called MFS (with Uno pins). // Use our own object with the ESP32 S3 Uno pins, and never call MFS.begin(). DIYables_MultiFuncShield shield(espPins()); unsigned long lastUpdate = 0; void setup() { Serial.begin(9600); // set the ADC attenuation to 11 dB (up to ~3.3V input) analogSetAttenuation(ADC_11db); shield.begin(); shield.display.print(0); } void loop() { shield.loop(); if (millis() - lastUpdate >= 500) { lastUpdate = millis(); float temp = shield.readTemperature(); shield.display.print(temp, 1); Serial.print("Temp: "); Serial.print(temp, 1); Serial.println(" C"); } }

This sketch also sets analogSetAttenuation(ADC_11db), so the A4 pin can read the full 0 to 3.3V range. The library knows the ESP32 S3 Uno ADC is 12-bit with a 3.3V reference, and it does the math for you.

How to Run

  1. Pull out jumper J1 on the shield.
  2. Copy the code into the Arduino IDE and click Upload.
  3. Open the Serial Monitor at 9600 baud.
  4. Read the temperature on the display and in the Serial Monitor.
  5. Tip: touch the LM35 with your finger. The value should rise slowly.
∞
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32S3 Dev Module' on 'COM15')
New Line
9600 baud
Temp: 25.3 C Temp: 25.4 C Temp: 25.4 C Temp: 26.1 C Temp: 27.0 C
Ln 11, Col 1
ESP32S3 Dev Module on COM15
2

The library smooths the readings with a moving average of 4 samples. On the first reading, it fills the buffer with that value, so you get a steady number right away.

ESP32 S3 Uno Multi-Function Shield - Full Demo

Watch the video below to see this ESP32 S3 Uno project step by step.

Platform Support

The DIYables_MultiFuncShield library supports all Arduino platforms (architectures=*). On the ESP32 S3 Uno, it detects the 12-bit ADC and 3.3V reference by itself. The only thing you must add is the espPins() pin map, as shown in every sketch above.

FAQ

Can I use the multi-function shield on the ESP32 S3 Uno?

Yes. The ESP32 S3 Uno has the Uno header layout, so the shield plugs in at the same positions. You must pass the GPIO numbers to the library with MFS_Pins, because the default Uno pin numbers point to other GPIOs. Also follow the 3.3V safety steps for the potentiometer and buttons.

Why does my code not compile with "multiple definition of MFS"?

The library already makes a global object called MFS. If you write DIYables_MultiFuncShield MFS(espPins());, there are two objects with the same name. Give your object another name, like shield, and use shield. everywhere in the code.

Is the shield safe for the 3.3V pins of the ESP32 S3 Uno?

Mostly, with care. The display, LEDs and buzzer only receive signals from the board. The potentiometer and the button pull-ups connect to 5V, so they can push more than 3.3V into the board. Start with the trimmer at the 0V end and stop at 100%. Add 18 kΩ resistors from A1, A2 and A3 to GND for long-term use.

Why does the potentiometer show 0 to 4095, not 0 to 16383?

The ESP32 S3 Uno ADC is 12-bit, so it gives 0 to 4095. The UNO R4 uses a 14-bit ADC, which gives 0 to 16383. readPotPercent() handles this for you and always returns 0 to 100%.

Why does the code call analogSetAttenuation(ADC_11db)?

It sets the ESP32 S3 Uno ADC input range to about 0 to 3.3V, so the full knob and LM35 signal maps to 0 to 4095. Without it, the range is smaller and readings saturate early. The UNO R4 does not need this line. It is for ESP32 boards only. Keep the input voltage at 3.3V or less.

What if my project needs more pins than the shield leaves free?

The shield covers most of the Uno headers, but the ESP32 S3 Uno has two extra rows of holes with more GPIOs. They are GPIO15 and GPIO16 (I/O, PWM, analog), GPIO45 and GPIO35 to GPIO42 (I/O, PWM), and GPIO47/GPIO48 (output only, PWM). Solder pin headers to them and write the GPIO number in code. For an extra analog sensor, use GPIO15 or GPIO16. For extra buttons, use GPIO35 to GPIO42, not GPIO47/GPIO48. Be careful with two things. First, GPIO47/GPIO48 may run at 1.8V instead of 3.3V on some modules (especially ones with "V" in the name, like R8V or R16V), so 3.3V devices can be damaged or act strangely. Second, GPIO0, GPIO3 (D6), GPIO45 and GPIO46 (D9) are boot strapping pins, and a wrong connection can stop the board from booting or uploading code. Use the other extra pins first.

Troubleshooting

Problem Possible Cause Solution
No COM port in Arduino IDE USB driver missing or bad cable Install the CP210x or CH340 driver, try a data USB cable, or hold BOOT while pressing RESET
Code does not compile (multiple definition of MFS) Your object is named MFS, like the library's global object Rename your object to shield and use shield. in all calls
Nothing works or the wrong parts react Sketch uses the default Uno pins (MFS.begin()) Use the espPins() pin map and the shield object from this tutorial
Display is blank, flickers or shows random segments Shield not fully seated, or 3.3V signals are weak for the 5V 74HC595 Press the shield fully onto the headers, check the 5V and GND pins, and keep the board on a good USB power source
Potentiometer stays at 100% for many turns The knob is past the 3.3V point (the ADC is full) Turn it counter-clockwise until the value drops, and do not turn past 100%
Temperature is far too high or stuck Jumper J1 is still on the shield Remove J1 and reset the board
Temperature is 1 to 3 °C off ESP32 S3 Uno ADC is less accurate at low voltages Compare with a known thermometer and add a small offset in your code
Buzzer never stops or LEDs glow faintly Some shield versions power these parts from 5V, so a 3.3V HIGH cannot fully turn them off Check with the Buzzer and LED sketches, and if it happens, unplug the shield when you do not need it

How to Connect Other Components

The Multi-Function Shield covers all the pins of the ESP32 S3 Uno, and it has no female headers on top. So how can you connect other components, such as sensors, relays or motors, to the ESP32 S3 Uno?

The answer is simple: put a Proto Screw Terminal Block Shield or a Screw Shield V2 between the ESP32 S3 Uno and the Multi-Function Shield.

ESP32 S3 Uno Multi-Function Shield with Screw Shield

The screw shield has a screw terminal for each pin. It lets you connect the ESP32 S3 Uno to other components. Do not use the pins that the Multi-Function Shield already uses: D3, D4, D7, D8, D10 to D13 and A0 to A3, and also A4 when you use the LM35 sensor. The free pins are D2, D5, D6, D9 and A5. D2 is free when the U4 socket (for an IR receiver) is empty. On the ESP32 S3 Uno, these free pins are D2 (GPIO18), D5 (GPIO20), D6 (GPIO3), D9 (GPIO46) and A5 (GPIO4). D6 and D9 are boot strapping pins, so use D2, D5 and A5 first. Every screw terminal goes straight to a 3.3V pin, so keep each signal at 3.3V or less.

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!