Arduino Ide Serial Plotter

In previously published articles we discussed about oscilloscope and also kit to build oscilloscope. Logic analyzer is another tool which somewhat used for production grade checking of circuits. Ordinary users do not need dedicated oscilloscope, a multimeter should serve most purposes. Here is a Basic Arduino Oscilloscope, Which Will Show Plotting on Serial Plotter of Arduino IDE and Analog Inputs Work as 6 Channels. This project we found on Arduino Project Hub :

2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
52
54
56
58
60
62
64
66
68
70
72
74
76
78
80
82
84
86
88
90
92
94
96
98
100
102
104
106
108
110
112
114
116
118
120
122
124
126
128
130
132
134
136
138
140
142
144
146
148
150
152
154
156
158
160
162
164
166
168
170
172
174
176
178
180
182
184
186
188
190
192
194
File:Oscilloscope.ino
Title:Standalone Arduino6channel Triggered Oscilloscope
Verson:2018.4.23
Method:(0)Setthe adjustable variables,(1)run the sketch(2)activate the serial plotter.
Description:This sketch simulatesa6beam oscilloscope.It is expected that the input(s)presented at the analog pins will be between
0and5volts withamaximum frequency of1KHz.The adjustable variables are declared inaseparate section.These variables can be
found after the define statements.1-6beams may be selected which display voltages at A0-A5,respectively.Open analog pins produce
The oscilloscope runs in2modes:'continuous'(free running)and'triggered'(start sweep whenacriterion is met.The triggering
criterion is met when the input signal read off od A0 crosses overapredefined triggering voltage.The criterion is further
conditioned by whether it is'rising'or'falling'when it crosses the predefined voltage.Intriggered mode the total sweep time
may be setinmilliseconds.The beginning ofatriggered sweep is indicated when the timing mark spikes to5vdc.
When sweeping,the analog pin(s)will be sampled every'SampleInterval'milliseconds.At the bottom of the plot,timing marks
(asquare wave)will be toggled every10th'SampleInterval'milliseconds.
When more than1signal is being sampled,the signal displays may be'superimposed'or'channeled'.When channels are used,the
The builtin LED(pin13)is an indicator of the oscilloscope state:(1)On,continuous mode or sweeping intriggered mode;
(2)blinking,Armed intriggered mode,(3)Off,all operations paused(by push button).
Optionallyapush button,can be connected to ground and digital pin12.When pressed,signal sampling and sweep are stopped.
Pressing the push button again resumes the sweep(but withagap inthe signal trace(s)).
The order of the plotted line legend is:timing marks(blue),trigger level(red,ifintriggered mode),analog signals A0-A6,
*/
#define ul unsigned long
#define continuous true//sweep mode(free running)
#define rising true//trigger slope negative
#define triggered false//sweep mode(sweep starts when triggered)
#define sweeping false//sweeping forTriggeredSweepInterval msecs
#define superimposed true//signals superimposed on display
#define channeled false//signals channeled on display
//adjustable variables
bool DisplayMode=channeled;//'superimposed'or'channeled'
ul SampleInterval=200;//units:msecs*10;0.1<=SampleInterval
bool SweepMode=triggered;//'continuous'or'triggered'
ul TriggeredSweepInterval=40000;//total sweep time,units:seconds*10,000
float TriggerDirection=rising;//'rising'or'falling'
float TriggerVolts=3.5;//trigger vdc;0<=TriggerVolts<=5
//interrupt controlled variables
bool LED=HIGH;
ul SweepCount=0;//counts up to Sweep Interval
bool Tick=false;//setto true when TickCount=SampleRate
bool TimingMark;//toggles every10th'Sample Intewrval'
ul TimingMarkCount=0;//counts up to SampleInterval*10
bool TriggerOnset=false;//marks first tick after trigger occurs
//loop procedure variables
float ChannelHeight;
int PBPin=12;//grounded push button on pin12(optional)
int PBLastState=HIGH;//LOW(pressed)or HIGH(released)
int PBVal;//inverse logic,push button tied to ground
float ChannelScale;//proportion og signal to display
float TriggerDisplay;//vertical position of trigger
float Value;
void interruptSetup(){
noInterrupts();//generate an interrupt every0.1msec
TCCR2B=2;//16,000,000Hz/8=2,000,000Hz;T2 clock ticks every0.0005msecs
TIMSK2=2;//setthe ISR COMPA vect
}
ISR(TIMER2_COMPA_vect){//interrupt every0.1msecs
TickCount++;
if(BlinkCount>=500){
LED=!LED;//toggle LED every50msecs
}
Tick=true;
TimingMarkCount++;//update Timing mark
if(TimingMarkCount>=10){//10th'SDampleInterval'has occurred
TimingMarkCount=0;
if(SweepModetriggered){
if(TriggerStatesweeping){//sweeping,update sweep time
if(SweepCount>=TriggeredSweepInterval){//sweep complete
LastSample=-1;
}
Value=analogRead(A0);
((TriggerDirectionrising and Value>=TriggerLevel and LastSample<TriggerLevel)or
(TriggerDirectionfalling and Value<=TriggerLevel and LastSample>TriggerLevel))){
SweepCount=0;
TimingMarkCount=0;
}
}
}
pinMode(LED_BUILTIN,OUTPUT);
pinMode(PBPin,INPUT);//connected toagrounded push button
Serial.begin(115200);
TriggerState=sweeping;
else{
}
ChannelHeight=5.0/Beams;
TriggerDisplay=TriggerVolts*ChannelScale+5.0-ChannelHeight;
}
void loop(){
digitalWrite(LED_BUILTIN,LOW);
elseif(TriggerStatearmed){
}
digitalWrite(LED_BUILTIN,HIGH);
PBVal=digitalRead(PBPin);
if(PBValLOW and PBLastStateHIGH){//falling edge
delay(2);//ignore contact bounce
PBLastState=PBVal;
if(Tick){//sample ifSample Interval msecs have elapsed
if(TimingMark){//display timing marks and trigger,ifpresent
Serial.print(5.0);
}
Serial.print(0.1);
}
Serial.print(0.0);
Serial.print(' ');
ChannelFloor=5.0-ChannelHeight;//display trigger level,ifapplicable
Serial.print(TriggerLevel*ChannelScale+ChannelFloor);
}
for(int AnalogPin=0;AnalogPin<=Beams-1;AnalogPin++){//sample1-6analog signals and display them
Value=Value*ChannelScale+ChannelFloor;
Serial.print(' ');
}
Serial.println(');
}
Tagged With arduino plotter set trigger , trigger state sweeping in oscilloscope , how to make serial plotter ocsluscope , find oscilloscope ino , eastjfy , D1XA , channelscale = 5 0 / 1024 0 / beams; , arduino serial plotter different windows , arduino oscilloscope using serial plotter , arduino analog input osilloscope

Arduino Ide Serial Plotter Free

In previously published articles we discussed about oscilloscope and also kit to build oscilloscope. Logic analyzer is another tool which somewhat used for production grade checking of circuits. Ordinary users do not need dedicated oscilloscope, a multimeter should serve most purposes. Here is a Basic Arduino Oscilloscope, Which Will Show Plotting on Serial Plotter of Arduino IDE and Analog Inputs Work as 6 Channels. This project we found on Arduino Project Hub :

https://www.instructables.com/id/Another-Arduino-Oscilloscope/

How to Create, Test This Basic Arduino Oscilloscope

This is practically a code dependent oscilloscope. Arduino boards have six analog inputs – A0, A1, A2, A3, A4, A5. One need to check the code and set the adjustable variables, then run the sketch. Then open the serial plotter of Arduino IDE. On Arduino web IDE, you’ll find serial plotter under tool’s menu.

This sketch will simulates a 6 channel oscilloscope. The input at the analog pins expected be be between 0 volt and 5 volts, with a maximum frequency of 1 KHz. Adjustable variables are within the code. This oscilloscope runs in two modes:

Continuous
Triggered

Arduino serial plotter

The criterion is further conditioned in code by whether it is increasing or decreasing. 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 Volt. The builtin LED (which is on-board LED, usually at pin 13) is an indicator of the oscilloscope states – (1) ON : continuous mode, sweeping in triggered mode
(2) Blinking : armed in triggered mode
(3) Off : all operations paused (by push button).

A push button can be connected to ground and digital pin 12 as optional component. When push button will be pressed, signal sampling and sweep will be stopped. Here is the code, it is heaving commented for helping the users :

Arduino Ide Serial Plotter System