Built-in project · Seeed XIAO ESP32-S3

XIAO S3 knob

The XIAO knob circuit on the ESP32-S3: D0 is A0 on GPIO 1, and the count is printed as the converter gives it. The whole build, a Seeed XIAO ESP32-S3 and 3 more parts, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.

Teaching? Assign it to your class in one click.

Beginner Runs in your browser. Free, and no account needed.

The parts retail for about $13.15. On Mokxi they're free.

XIAO S3 knob · Seeed XIAO ESP32-S3live0.000 s 0.00x
Click to open it in the editor
The circuit itself, running here on the simulator. Press what can be pressed; click anything else to open it in the editor.

The code

The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.

sketch.ino · Seeed XIAO ESP32-S3
// Knob: a potentiometer on A0 sets the brightness of an LED on D10.
//
// A0 is GPIO 1, ADC1 channel 0. The converter is twelve bits, 0 to
// 4095, and at its default 12 dB attenuation a real S3 saturates at about
// 3.1 V, so a pot across the 3.3 V rail reads 4095 a little before the end.
// The sketch prints the count it reads.

const int KNOB = A0;
const int LED = D10;

void setup() {
  Serial.begin(115200);
  pinMode(LED, OUTPUT);
}

void loop() {
  int raw = analogRead(KNOB);
  analogWrite(LED, raw >> 4);
  Serial.print("A0 ");
  Serial.println(raw);
  delay(200);
}

Parts list

5 parts, plus the jumper wires. They retail for about $13.15; on Mokxi they're free.

How it is wired

5 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.

  • Seeed XIAO ESP32-S3 pin D0; Potentiometer pin 2
  • Ground: Seeed XIAO ESP32-S3 pin GND; Potentiometer pin 3; LED, green pin C
  • Seeed XIAO ESP32-S3 pin 3V3; Potentiometer pin 1
  • Seeed XIAO ESP32-S3 pin D10; Resistor, 220 Ω pin 1
  • Resistor, 220 Ω pin 2; LED, green pin A

Change it and keep it

Open it in the editor, change the circuit or the code, and keep your version in a free account.