Title: Standalone Arduino 6-Channel Triggered Oscilloscope
Method: (0) Set the adjustable variables, (1) run the sketch (2) activate the serial plotter.
Description: This sketch simulates a 6 beam oscilloscope. It is expected that the input(s) presented at the analog pins will be between 0 and 5 volts with a maximum frequency of 1 KHz. The adjustable variables are declared in a separate section. These variables can be found after the define statements. 1-6 beams may be selected which display voltages at A0-A5, respectively. Open analog pins produce spurious voltages.
The oscilloscope runs in 2 modes: 'continuous' (free running) and 'triggered' (start sweep when a criterion is met. The triggering criterion is met when the input signal read off od A0 crosses over a predefined triggering voltage. The criterion is further conditioned by whether it is 'rising' or 'falling' when it crosses the predefined voltage. In triggered mode the total sweep time may be set in milliseconds. The beginning of a triggered sweep is indicated when the timing mark spikes to 5 vdc.
When sweeping, the analog pin(s) will be sampled every 'SampleInterval' milliseconds. At the bottom of the plot, timing marks (a square wave) will be toggled every 10th 'SampleInterval' milliseconds.
The built-in LED (pin 13) is an indicator of the oscilloscope state: (1) On, continuous mode or sweeping in triggered mode; (2) blinking, Armed in triggered mode, (3) Off, all operations paused (by push button).
When more than 1 signal is being sampled, the signal displays may be 'superimposed' or 'channeled'. When channels are used, the voltages on the vertical axis are not calibrated.
The built-in LED (pin 13) is an indicator of the oscilloscope state: (1) On, continuous mode or sweeping in triggered mode; (2) blinking, Armed in triggered mode; (3) Off, all operations paused (by push button).
Optionally a push button, can be connected to ground and digital pin 12. When pressed, signal sampling and sweep are stopped. Pressing the push button again resumes the sweep (but with a gap in the signal trace(s)).
The order of the plotted line legend is: timing marks (blue), trigger level (red, if in triggered mode), analog signals A0-A6, respectively (multi colored).