Search/

Request a free quote

Downloads

Arduino UNO R4, Uno and Nano setup for the bench link

We typically respond within one business day.

An Arduino board with the Dreiym sketch gives the simulator four inputs, one DC output and two relay outputs over a USB cable. The same sketch runs on the UNO R4 Minima and WiFi, the Uno, the Nano, the Nano Every and the Mega.

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.

  • Uno, Nano, Mega and UNO R4 pins take 0 to 5 V. 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 Arduino UNO R4 Minima or WiFi, Uno, Nano or Mega (original or compatible)
  • A USB cable that carries data
  • A solderless breadboard and jumper wires
  • A multimeter
  • For inputs above 5 V: a 30 kΩ and a 10 kΩ resistor per input
  • For the output: a 10 kΩ resistor and a 10 µF capacitor
  • Optional: a two channel low voltage relay module

Upload the sketch

  1. Install the Arduino IDE from arduino.cc.
  2. UNO R4: open the Boards Manager and install Arduino UNO R4 Boards. The Uno, Nano and Mega use Arduino AVR Boards, which comes with the IDE. The Nano Every uses Arduino megaAVR Boards.
  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 IDE. Choose your board and its port in the Tools menu, then press Upload.
  5. Close the Serial Monitor if it is open, so the browser can use the port.
  • Many Nano compatible boards use a CH340 USB chip. If no port appears, install the CH340 driver from the chip maker, WCH.
  • If the upload to an older Nano compatible board stops with a sync error, choose Tools, Processor, ATmega328P (Old Bootloader) and upload again.
  • 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

  • A0 to A3: inputs, 0 to 5 V
  • GND: joined to the circuit ground
  • Pin 9: PWM output
  • Pins 7 and 8: relay K1 and relay K2
  • Self test: a jumper from the output point (top of the 10 µF capacitor) to A0

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.

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Ω, 12 V at the circuit point gives 3 V at the pin, well inside the 5 V input range.
  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.

Good to know

  • The Uno, Nano and Mega restart when the page opens the port. The panel waits for them, which takes about two seconds.
  • The Uno and Nano have little memory: one capture holds 400 samples for all inputs together. The UNO R4 holds 4,000.
  • The inputs read relative to the board supply. Calibrate each input once on the computer you use, with the board on that USB port.

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