Arduino Logic Analyzer: UART & PWM: Wiring, Code and Simulator

To build this Arduino Logic Analyzer: UART & PWM project you need an Arduino Uno and a logic analyzer and a clock generator. Probe a SoftwareSerial line, a PWM pin and a 1 kHz clock generator with the 8-channel logic analyzer. Make the 5 connections in the wiring table, upload the Arduino C++ code, and run, open the Logic analyzer tab, and decode D0 as UART at 9600 baud: it reads "Hi".

Open this circuit in the free Arduino Uno simulator

Parts list

QtyPartWhat it does
1Arduino Unothe microcontroller board
1Logic AnalyzerEight probes, D0–D7. Wire them to any signals, run, and open the Logic analyzer tab below the canvas to see the waveforms, decode UART or I²C, and export VCD.
1Clock GeneratorA square wave on CLK. Feed a counter or a flip-flop, or measure it with the logic analyzer.

Wiring

#FromTo
1Arduino Uno pin 11Logic Analyzer D0
2Logic Analyzer D1Clock Generator CLK
3Arduino Uno pin 9Logic Analyzer D2
4Arduino Uno GNDLogic Analyzer GND
5Arduino Uno GNDClock Generator GND

Step by step

  1. Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the Arduino Uno. No install or account is needed.
  2. Add the parts. Add a logic analyzer and a clock generator from the parts palette.
  3. Wire 1. Connect Arduino Uno pin 11 to Logic Analyzer D0.
  4. Wire 2. Connect Logic Analyzer D1 to Clock Generator CLK.
  5. Wire 3. Connect Arduino Uno pin 9 to Logic Analyzer D2.
  6. Wire 4. Connect Arduino Uno GND to Logic Analyzer GND.
  7. Wire 5. Connect Arduino Uno GND to Clock Generator GND.
  8. Paste the Arduino C++ code. Paste the Arduino C++ code below into the code editor.
  9. Run it. Press Run. Run, open the Logic analyzer tab, and decode D0 as UART at 9600 baud: it reads "Hi".

Arduino C++ code

// Logic analyzer: D0 watches a SoftwareSerial transmitter on pin 11, D1 a
// 1 kHz clock generator, D2 the PWM on pin 9. Run, then open the Logic
// analyzer tab: zoom in on D0 and decode it as UART at 9600 baud.
#include <SoftwareSerial.h>

SoftwareSerial link(10, 11);  // RX 10, TX 11

void setup() {
  link.begin(9600);
  analogWrite(9, 64);  // 25% duty cycle
}

void loop() {
  link.print("Hi");
  delay(50);
}

What to try

Run, open the Logic analyzer tab, and decode D0 as UART at 9600 baud: it reads "Hi".

Frequently asked questions

How do I wire the Logic Analyzer: UART & PWM project on an Arduino Uno?

Make 5 connections: Arduino Uno pin 11 to Logic Analyzer D0; Logic Analyzer D1 to Clock Generator CLK; Arduino Uno pin 9 to Logic Analyzer D2; Arduino Uno GND to Logic Analyzer GND; Arduino Uno GND to Clock Generator GND.

What parts do I need for this Arduino project?

An Arduino Uno and a logic analyzer and a clock generator.

Can I simulate this Arduino project online for free?

Yes. The BitForBytes Embedded Lab runs this exact circuit and Arduino C++ code in your browser for free, with no install and no hardware. The sketch is compiled with the real Arduino toolchain and runs on an emulated ATmega328P.

What does the code do?

Probe a SoftwareSerial line, a PWM pin and a 1 kHz clock generator with the 8-channel logic analyzer.

More Arduino Uno projects