Search/

Request a free quote

Downloads

ESP32 setup for the bench link

We typically respond within one business day.

This guide covers the classic ESP32 development board with an ESP32-WROOM-32 module, often sold as ESP32 DevKit V1 or ESP32-DevKitC. With the Dreiym sketch it gives the simulator four inputs, one DC output and two relay outputs over a USB cable. The radio is not used.

Safety first

Low voltage only: batteries or a bench supply of 12 V or less. Never connect anything from these guides to mains (wall outlet) wiring, or to equipment that anyone depends on for safety.

  • These pins take 0 to 3.3 V and are not 5 V tolerant. A higher voltage on a pin can destroy the board.
  • For anything above the pin voltage, use a divider, and check its output with a meter before you connect the board.
  • Join the board ground to the circuit ground first, then connect the inputs.
  • Relay modules: low voltage loads only, within the rating printed on the module.
  • Unplug the USB cable before you change the wiring.

Parts

  • An ESP32 development board with an ESP32-WROOM-32 module
  • A USB cable that carries data
  • A solderless breadboard and jumper wires (many ESP32 boards are wide: a breadboard with room on both sides helps)
  • A multimeter
  • For each input above 3.3 V: a 30 kΩ and a 10 kΩ resistor
  • For the output: a 10 kΩ resistor and a 10 µF capacitor

Upload the sketch

  1. Install the Arduino IDE from arduino.cc.
  2. Open the Boards Manager and install esp32 by Espressif Systems.
  3. Download dzhw_serial-1.0.1.zip and unzip it. Keep dzhw_serial.ino and dzhw_core.h together in the folder named dzhw_serial.
  4. Open dzhw_serial.ino. In the Tools menu choose the board ESP32 Dev Module and the port of your board, then press Upload.
  5. If the upload waits at Connecting, hold the BOOT button on the board until it starts.
  6. Close the Serial Monitor if it is open, so the browser can use the port.

If no port appears, the board needs the driver for its USB chip, usually a CP210x (Silicon Labs) or a CH340 (WCH). The chip name is printed on the board, near the USB connector.

  • dzhw_serial-1.0.1.zip 7 KB

    Arduino sketch folder: dzhw_serial.ino and dzhw_core.h, for Uno, Nano, Mega, UNO R4 and ESP32

    SHA-256 140c1ebcc9cd4e607a47a3da28f8f3516b7c6af407bd39d82ab593992dad4513

  • dzhw_serial.ino 3 KB

    The sketch file alone

    SHA-256 da41201db4e90f3f78d300f4343f1e03e4fcb912b24ae2df54c9bb95516de873

  • dzhw_core.h 13 KB

    The protocol core the sketch includes (keep it next to the sketch)

    SHA-256 a3e526c991d8d68a018aef7a21285941e0aeabdfbdd7d2854d311556f91106c7

Wiring

On the classic ESP32, pins 6 to 11 belong to the flash memory, so the sketch uses these pins instead of the Arduino numbers:

  • Input A0: GPIO36 (marked VP or SVP)
  • Input A1: GPIO39 (marked VN or SVN)
  • Input A2: GPIO34. Input A3: GPIO35
  • GND: joined to the circuit ground
  • PWM output: GPIO25
  • Relay K1: GPIO26. Relay K2: GPIO27
  • Self test: a jumper from the output point (top of the 10 µF capacitor) to GPIO36

The output is a PWM pin turned into a steady voltage by a 10 kΩ resistor and a 10 µF capacitor: pin, then the resistor, then the capacitor to ground. The output point is the top of the capacitor. It gives a DC level only and can supply very little current.

The ESP32 input reads poorly near 0 V and above about 3.1 V. Keep signals inside that band, with a divider if needed, and calibrate each input.

ESP32-S3 boards: the sketch uses the pins named A0 to A3, 9, 7 and 8 there. Check the pin map of your board before you wire it.

Measuring more than the pin voltage: a divider

  1. Use two resistors: 30 kΩ from the circuit point to the input pin, and 10 kΩ from the input pin to ground. The pin then sees one quarter of the voltage.
  2. With 30 kΩ and 10 kΩ, up to 12 V at the circuit point gives up to 3 V at the pin.
  3. Before you connect the pin, measure the middle point with a meter at the highest voltage your circuit makes. It must stay below the pin limit.
  4. In the Bench panel, type 4 in the Divider box of that input, so the readings show the voltage at the circuit point.
  5. Keep the circuit itself at 12 V or less, divider or not.

Connect from the circuit simulator

  1. Open the circuit simulator in Chrome, Edge or Firefox on a computer.
  2. Build or open your circuit and run the simulation.
  3. Open Bench, read the safety note and tick the box.
  4. Choose USB cable, then pick the board in the list the browser shows.
  5. For each input, choose the point of the circuit it measures and, if you use a divider, its ratio. If the simulation expects more than the input can read, the panel says so before you wire it.
  6. Calibrate each input once: ground first, then a steady voltage you have measured with a meter.
  7. The Live tab shows measured and simulated values side by side, with the difference.

If it does not connect

  • The board is not in the list: try another USB cable (some carry power only) and another USB port.
  • Only one program can use the port at a time. Close Thonny, the Arduino Serial Monitor or the micro:bit editor tab first.
  • The device did not answer: unplug it, plug it back in and connect again. Check that the Dreiym program is on the board.
  • Safari cannot open USB serial devices. Use Chrome, Edge or Firefox, or the PC bridge with its serial plugin.

More bench guides

Get your project started

We typically respond within one business day.

Request a free quoteor call (866) 621-6920

Newsletter

Engineering notes from Dreiym

New articles on power systems, corrosion and forensic engineering, by email when we publish. Free account included: keep your calculator work, reports and exports in one place.

Latest article: DC Arc Flash in Battery, UPS and PV Systems: How the Hazard Is Assessed

One email per new article. Unsubscribe in one click.

You are subscribed: new articles come to you by email.

Manage in My account