wirecraft

Companions · ESP32 DevKit

Pixel Desk Buddy

A ESP32 DevKit build with 5 components. Reads: Button, Potentiometer. Drives: NeoPixel, OLED, Buzzer.

5 parts · 14 connections · 10 steps

Wiring

Mini Map
power
ground
data
signal
analog

Parts

PartRefsQtyEst.
WS2812B NeoPixel ring (8 px)NeoPixel1$3.80
Tactile push buttonButton1$0.10
10 kΩ potentiometerPotentiometer1$0.50
SSD1306 OLED display (128×64, I²C)OLED1$3.20
Passive piezo buzzerBuzzer1$0.60
Plus: breadboard, jumper wires, USB cable≈ $8.20

Prices are rough hobby-market estimates. Click a part for wiring notes and specs.

Firmware

src/main.cpp
1// Mood Lamp
2// Generated by Wirecraft for the ESP32 DevKit (ESP32-WROOM-32)
3// Prompt: A cute desk companion robot with an OLED face, a button to interact, a buzzer for chirps and neopixels for emotion color
4//
5// Wiring, parts and step-by-step assembly live alongside this file.
6
7#include <Arduino.h>
8#include <Adafruit_NeoPixel.h>
9#include <Wire.h>
10#include <Adafruit_GFX.h>
11#include <Adafruit_SSD1306.h>
12
13#define NEOPIXEL_PIN 4
14#define NEOPIXEL_COUNT 8
15#define BUTTON_PIN 5
16#define POTENTIOMETER_PIN 32
17#define BUZZER_PIN 13
18
19Adafruit_NeoPixel neoPixel(NEOPIXEL_COUNT, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
20bool buttonPressed = false;
21int potentiometerValue = 0;
22Adafruit_SSD1306 oLED(128, 64, &Wire, -1);
23
24void setup() {
25 Serial.begin(115200);
26 neoPixel.begin();
27 neoPixel.setBrightness(60);
28 neoPixel.show();
29 pinMode(BUTTON_PIN, INPUT_PULLUP);
30 if (!oLED.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { Serial.println(F("OLED not found")); }
31 oLED.clearDisplay();
32 oLED.setTextColor(SSD1306_WHITE);
33 oLED.setTextSize(1);
34 pinMode(BUZZER_PIN, OUTPUT);
35 Serial.println(F("Mood Lamp ready."));
36}
37
38void loop() {
39 // --- Read sensors ---
40 buttonPressed = (digitalRead(BUTTON_PIN) == LOW);
41 potentiometerValue = analogRead(POTENTIOMETER_PIN);
42
43 // Refresh the display with live readings
44 oLED.clearDisplay();
45 oLED.setCursor(0, 0);
46 oLED.setCursor(0, 0);
47 oLED.print("Button: "); oLED.println(buttonPressed);
48 oLED.setCursor(0, 12);
49 oLED.print("Potentiometer: "); oLED.println(potentiometerValue);
50 oLED.display();
51
52 delay(50);
53}
54
platformio.ini
1; PlatformIO project for Mood Lamp
2[env:esp32dev]
3platform = espressif32
4board = esp32dev
5framework = arduino
6monitor_speed = 115200
7lib_deps =
8 adafruit/Adafruit NeoPixel@^1.12.0
9 adafruit/Adafruit SSD1306@^2.5.10
10 adafruit/Adafruit GFX Library@^1.11.9
11

Assembly

  1. 1

    Lay out your workbench

    Gather the ESP32 DevKit, a half-size breadboard, and a bundle of male-to-male jumper wires. Keep the parts list open — every component below gets its own spot on the breadboard. Don't plug in USB power until the last wire is placed.

  2. 2

    Seat the board and power rails

    Run a red jumper from the ESP32 DevKit's 3V3 (or VIN for 5 V parts) pin to the breadboard's + rail, and a black jumper from GND to the − rail. Every component's power and ground will tap these rails.

  3. 3

    Wire the NeoPixel

    Place the WS2812B NeoPixel ring (8 px) on the breadboard. Power first: VCC → + rail, GND → − rail. Then signals: DIN → GPIO4. Tip: Add a 330 Ω resistor on DIN and a 470 µF cap across power for happy pixels.

  4. 4

    Wire the Button

    Place the Tactile push button on the breadboard. Power first: GND → − rail. Then signals: SIG → GPIO5. Tip: Legs on the same side are connected in pairs — wire diagonally opposite corners to be safe.

  5. 5

    Wire the Potentiometer

    Place the 10 kΩ potentiometer on the breadboard. Power first: VCC → + rail, GND → − rail. Then signals: WIPER → GPIO32. Tip: Outer legs to VCC and GND, middle leg (wiper) to the analog pin.

  6. 6

    Wire the OLED

    Place the SSD1306 OLED display (128×64, I²C) on the breadboard. Power first: VCC → + rail, GND → − rail. Then signals: SDA → GPIO21, SCL → GPIO22. Tip: If nothing shows up, try I²C address 0x3D — some modules ship with it.

  7. 7

    Wire the Buzzer

    Place the Passive piezo buzzer on the breadboard. Power first: GND → − rail. Then signals: SIG → GPIO13. Tip: Passive buzzers need tone(); active ones just want HIGH. This design assumes passive.

  8. 8

    Double-check before power

    Trace every wire against the diagram once more — 14 connections in total. The classic mistakes: swapped power and ground, and off-by-one rows on the breadboard. Thirty seconds of checking saves a component.

  9. 9

    Flash the firmware

    Open the exported folder in VS Code with the PlatformIO extension (free), plug in the ESP32 DevKit over USB, and hit Upload. PlatformIO fetches the libraries listed in platformio.ini automatically. Prefer the Arduino IDE? Copy src/main.cpp into a new sketch and install the same libraries from the Library Manager.

  10. 10

    Bring it to life

    Open the Serial Monitor at 115200 baud — you should see "Mood Lamp ready." Then start customizing the loop; the sketch is organized so every component's code is easy to find.