Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
(https://www.youtube.com/c/ELECTRONOOBS)
(https://www.instagram.com/ELECTRONOOBS)
(https://www.facebook.com/Electronoobs)
(https://twitter.com/ELECTRONOOBS) ADVERTISERS
Oscilloscope
draw
page 1/1 XY MODE
H… Help me by sharing this post
Share 66
This is a very simple tutorial. Original posts are here on this link
(http://www.electronicslab.com/blog/?tag=oscilloscope&paged=10). Any way, in this
tutorial we will use two pins from the Arduino to create fast PWM signals. With a small
(http://bit.ly/2JAAfV
filter, we change the amplitude of that signal according to the width of the PWM pulse.
By that, we can draw shapes on the oscilloscope when in XY mode.
Video Ads
Engage with your most
valuable audiences on the
world's largest video
platform.
YouTube Advertising
PART 1 - Schematic
This is the schematic we will use. We need two 1k resistors and two 100nF capacitors
to create the filter. We need the Arduino nano to create the signals and a potentiometer
to adjust the delay time between each loop. The ouptut of each filter will be connected
to the probes of the oscilloscope for X and Y on channels 1 and 2.
You have to number the vertices in the best way so there are not to much overlaps of
the lines. For example if in the picture above instead of going from vertex 1, to 2, 3, 4...
I go from 1, 2, 3, 17, 4 etc... it would create a zig-zag image and we don't want that.
When you have all the vertices, make a small table and write donw the X and Y
coordinates for each point. Now we haev the data.
PART 3 - Code
Christmas tree
For the code, I've prepared a few examples. As you can see in the video and picture
above, we first need the X and Y coordinates of our draw. Once we have that we need
the amount of vertices and put these values in the code.
First, in the code, we define the pins that we will use for the PWM signals. In this case I
use pin D6 for the X data and pin D5 for the Y data. It has to be these pins since later in
the code we change some registers and change the speed of the PWM signals to a
higher value. We also define the pin connected to the potentiometer that will change the
delay time for each loop.
//Inputs/Outputs
int X_pin = 6;
int Y_pin = 5; Alfawise U30
int Pot = A0;
2.8 inch Touch
Screen DIY
Then we define the default delay in micro seconds. Then we add how many vertices our
Desktop 3D
draw has, in my case just 19. Then we add the X coordinates in a vector of 19 vertices.
Printer - U30
We do the same but with the Y vertices and now we have the data prepared.
EU Plug Black
only $$162.89
int point_delay = 1000; //Delay between loops in us (https://www.gearbe
#define how_many_vertices 19 //Put here the amount of vertices that you ahve
//Coordinates for the X axis (remember, up to 254 coordinates) printers-3d-
byte x_axis[how_many_vertices] = { printer-
9,9,3,9,4,9,6,9,8,10,12,11,14,11,16,11,17,11,11};
//Coordinates for the Y axis kits/pp_009954647
byte y_axis[how_many_vertices] = {
lkid=39527337)
3,6,6,10,10,14,14,17,17,19,17,17,14,14,10,10,6,6,3};
In the setup we set the pins as outputs or inputs and then we change some registers.
These registers will change the frequency of the PWM signal since the default one is
very slow and for our filter we need higher speeds. We can now start the void loop.
void setup() {
pinMode(X_pin,OUTPUT); //Define the pin as output
pinMode(Y_pin,OUTPUT); //Define the pin as output
pinMode(Pot,INPUT); //Define the pin as input for the potentiometer
void loop() {
unsigned char loopcount;
{
point_delay = map(analogRead(Pot),0,1024,10,2000); //Read analog value adn map it to
a range between 10 and 2000us
for(loopcount = 0; loopcount < how_many_vertices; loopcount++)
{
analogWrite(X_pin,x_axis[loopcount]); //In this "for" we change the anal
og PWM width according to X axis and Y axis
analogWrite(Y_pin,y_axis[loopcount]);
delayMicroseconds(point_delay); //Add the delay
}
}
}
Upload the code to the Arduino and make the connections as in the schematic. Power
the oscilloscope and select XY mode. Then select high resolution so we have better
lines. You could also add persistance and get even better lines. Adjust the ch1 and ch2
knobs till you center the draw and that's it. You might have to change the resistor value
depending on the oscilloscope you use.
AFFILATE
Oscilloscope draw with PWM and lter test
Creality 3D
Help me by sharing this post Ender-3 V-slot
Share 66 Prusa I3 DIY
3D Printer Kit
220 x 220 x
250mm
Printing Size -
EU Plug Black
only $$153.84
(https://www.gearbe
printers-3d-
printer-
kits/pp_1845899.ht
lkid=39527206)
Alfawise U20
Large Scale
2.8 inch Touch
Screen DIY
3D Printer -
EU - U20 EU
Plug Black
only $$253.39
(https://www.gearbe
printers-3d-
printer-
kits/pp_1841229.ht
lkid=39527285)
Airtable, a…
Ad Airtable
Help students…
Ad Applied…
Arduino POV…
electronoobs.com
Magic: The…
Ad Wizards of…
Code…
electronoobs.com
Sensored ESC…
electronoobs.com
PWM receiver…
electronoobs.com
Arduino RPM…
electronoobs.com
Code PWM…
electronoobs.com
Brushed…
electronoobs.com
1 Ch example…
electronoobs.com
Slider arduino…
electronoobs.com
TRIAC…
electronoobs.com
ELECTRONOOBS 2019
Keep up you guys!