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
| Qty | Part | What it does |
|---|---|---|
| 1 | Arduino Uno | the microcontroller board |
| 1 | Logic Analyzer | Eight 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. |
| 1 | Clock Generator | A square wave on CLK. Feed a counter or a flip-flop, or measure it with the logic analyzer. |
Wiring
| # | From | To |
|---|---|---|
| 1 | Arduino Uno pin 11 | Logic Analyzer D0 |
| 2 | Logic Analyzer D1 | Clock Generator CLK |
| 3 | Arduino Uno pin 9 | Logic Analyzer D2 |
| 4 | Arduino Uno GND | Logic Analyzer GND |
| 5 | Arduino Uno GND | Clock Generator GND |
Step by step
- Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the Arduino Uno. No install or account is needed.
- Add the parts. Add a logic analyzer and a clock generator from the parts palette.
- Wire 1. Connect Arduino Uno pin 11 to Logic Analyzer D0.
- Wire 2. Connect Logic Analyzer D1 to Clock Generator CLK.
- Wire 3. Connect Arduino Uno pin 9 to Logic Analyzer D2.
- Wire 4. Connect Arduino Uno GND to Logic Analyzer GND.
- Wire 5. Connect Arduino Uno GND to Clock Generator GND.
- Paste the Arduino C++ code. Paste the Arduino C++ code below into the code editor.
- 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
- Arduino LED Blink: Wiring, Code and Simulator
- Arduino LDR Light Sensor: Wiring, Code and Simulator
- Arduino NTC Thermistor Thermometer: Wiring, Code and Simulator
- Arduino PWM to Analog RC Filter: Wiring, Code and Simulator
- Arduino Capacitance Meter: Wiring, Code and Simulator
- Arduino DC Motor PWM Speed Control with MOSFET: Wiring, Code and Simulator