DIY Oscilloscope for $20 - FREE CODE

  Рет қаралды 40,840

Kris Kasprzak

Kris Kasprzak

Күн бұрын

Пікірлер: 114
@ErikBongers
@ErikBongers 6 жыл бұрын
An Arduino Uno runs at 16kMHz, with 10 bit resolution ADCs at 10K samples/second but a $3 stm32 ("Blue Pill") runs at 72MHz with a 12 bit ADCs at 850K samples/second. Since a Blue Pill runs Arduino code, it would make for a nice upgrade.
@davidkempton2894
@davidkempton2894 4 жыл бұрын
Hello Erik. I have managed to port it to run on the STM32 Blue Pill. No real problems. Now samples a sine wave quite well up to at least 10KHz . Lower noise too of course.
@damainx
@damainx 5 жыл бұрын
Thanks! I made this, and works great. For those asking for serial info, add these lines in the loop at the end... Serial.print(String(1000000 / ttime) + " Hz"); delay(500); Serial.print(' ');
@davidkempton2894
@davidkempton2894 4 жыл бұрын
Hello Kris. I have just made my own cheap-o-scope and it works really well. Thanks for the code! I found that I needed to modify the display size definition in the Adadfruit_SSD1306.h library code (line 29). It was defaulted to 128 x 32 rather than 128 x 64. Hopefully this might help anyone else who has a similar issue. Thanks again!!
@KrisKasprzak
@KrisKasprzak 4 жыл бұрын
glad i could help
@i.ismail
@i.ismail 5 ай бұрын
Thank you very much sir ! that was the issue with my scope and i don't have enough knowledge yet to fix this by myself.
@jsmythib
@jsmythib 7 жыл бұрын
A valuable contribution. I wish I could map out its effect over time for diy'ers :) Cheers!
@davidprice2861
@davidprice2861 6 жыл бұрын
Got to say that is very very nifty and clever, brilliant concept and code. Thanks..
@KrisKasprzak
@KrisKasprzak 6 жыл бұрын
You're very welcome. Glad I could help.
@FreiR
@FreiR 7 жыл бұрын
the most simple I ever seen. Nice!
@ChoudryArif
@ChoudryArif 7 жыл бұрын
lovely, works like charm, though I had to increase font size of Hz to read properly
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
Glad I could help.
@JerryEricsson
@JerryEricsson 8 жыл бұрын
Wow love this, I have been planning on building something like this for years now, and now I can! Thanks a million, I know I will get lots of use out of this project while working with my HAM equipment, as well as keeping my herd of Arduino's and ESP8266's in line. Just a though, could a fellow do this with an ESP8266 and gain a lot of speed with the faster processor and more RAM? Perhaps I will try it with my ESPDUINO.
@KrisKasprzak
@KrisKasprzak 8 жыл бұрын
I'm not sure about other micro-processors. The only downside with using an arduino is it cant measure anything past around 4 kHz. If that is OK, i have another video showing how to use 2 OLED for a "dual trace" scope.
@JerryEricsson
@JerryEricsson 8 жыл бұрын
I tried to compile for the ESP but received all sorts of errors. Sadly the OLED screens I have, while advertised as the right size only show the top of the screen and the number 5, so I tried building a different scope, but the performance is nowhere near that of this guy. Perhaps I shall try converting to use SPI as I have a couple of 128x128 full color SPI screens.
@evanang9699
@evanang9699 7 жыл бұрын
Awesome, btw was wondering if this would work on a transient circuit? i.e. Measuring the output voltage for an RLC circuit.
@spwim
@spwim 6 жыл бұрын
This is awesome, i will try to build one next week! could i also get the oscilloscope data on my screen or would the serial connection be too slow for that? (for educational purposes)
@JerryEricsson
@JerryEricsson 4 жыл бұрын
I built a little box that filters the signal then feeds it through the sound card of my PC. Works great. I used a couple of 5 volt regulators to filter the voltage, and to begin with I picked up a USB sound card to run it through.
@EmbeddedEnigma
@EmbeddedEnigma 3 жыл бұрын
Hi, I know this is an old post. but can u tell me what if I want to add triggering in this project, I am currently using it. I modified it a bit for different library and for my purpose, but I cant add triggering functionality. Can u explain how I can do that ?
@69MazdaR100
@69MazdaR100 7 жыл бұрын
Mine doesn't display correctly, oled works fine with other projects. It only displays from approx 2.5V up, and the HZ display is 60/40 yellow/blue. Wish I could add a pic.
@Taran72
@Taran72 5 жыл бұрын
thank you for sharing! Looks Great!
@alejandromontes89
@alejandromontes89 6 жыл бұрын
Hello Goodnight. Excuse my English, it's not very good, will there be a possibility of adding duty cycle measurement to your oscilloscope? I'm going crazy and I can not do the measurement. I am new in Arduino and also in programming. If you could give me a help I would be very grateful. thank you very much .
@lintangwisesa
@lintangwisesa 7 жыл бұрын
great project, Sir
@EmbeddedEnigma
@EmbeddedEnigma 3 жыл бұрын
hi I want to ask how did u calculate this value for (x = 10; x
@KrisKasprzak
@KrisKasprzak 3 жыл бұрын
It's just a scaling factor to get the maximum measured bits of resolution to fit into a screen 47 pixels high (1023 / 47). I could have done the typical 5.0 / 1024 to get volts, the some factor to scale volts to 47 pixels, but did all the math in one step.
@EmbeddedEnigma
@EmbeddedEnigma 3 жыл бұрын
@@KrisKasprzak thanks for the reply. just last question how can I slow the speed little bit ?
@FLBRGZ
@FLBRGZ 6 жыл бұрын
Haven't read the code yet but I thought it would have been nice to give credit to the other Chanel with the original project that you built upon. Lucky you didn't charge for the code because I would have just looked at the original projects code. Great work though 👍
@KrisKasprzak
@KrisKasprzak 6 жыл бұрын
Although i made several mods to the original code, I thought I did reference the originators work, I just added a reference in the description section giving credit where credit is due.
@vtech8716
@vtech8716 8 жыл бұрын
very good project, but what about triggering level? or how to stop graph?
@MrBobWareham
@MrBobWareham 7 жыл бұрын
Very nice and thank you but could I use a bigger screen to get a better view.
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
The problem is buffering the video data so you can get fast updates. This OLED and the Adafruit library buffer the video, so basically you write the display to memory first--which is very fast, then with a single call, dump the memory to the display--which is very fast. Larger displays cant' be buffered as there's not enough memory on the MCU, so writing lines and stuff call by call is very slow. There are some techniques to use larger displays though.
@juanportalanza711
@juanportalanza711 4 жыл бұрын
Excuse me, I tried to do ir but in the moment i was trying to upload the code to arduino uno it doesn't leave me beacause it says that there is an error compiling for Arduino Uno. Would you help me please?
@KrisKasprzak
@KrisKasprzak 4 жыл бұрын
What error?
@juanportalanza711
@juanportalanza711 4 жыл бұрын
​@@KrisKasprzak It only says Error compiling for Arduino Uno board. and i tried from a different computer and keeps the same error. I was wondering if you could help me.
@KrisKasprzak
@KrisKasprzak 4 жыл бұрын
@@juanportalanza711 are you sure you have the correct board selected from the Arduino IDE that matches the board you are using?
@juanportalanza711
@juanportalanza711 4 жыл бұрын
Kris Kasprzak yes sir, I’m pretty sure. If I could, I would send you a screenshot. I don’t know what’s incorrect
@KrisKasprzak
@KrisKasprzak 4 жыл бұрын
@@juanportalanza711 well I see you're using an UNO, this code will not compile on that have to have a Teensy 3.2
@josephjensen8774
@josephjensen8774 7 жыл бұрын
Digital Dope. Thanks.
@glasseffect
@glasseffect 6 жыл бұрын
This is an amazing implementation of 20 buck hardware! Very accurate indeed! I have a small request, I'm dealing with very low frequencies, 1Hz-30Hz and as you said, these are not well represented via the oscilloscope. Is there any way to "zoom out" so that the longer wavelenghts are therefore visible? Thanks!
@KrisKasprzak
@KrisKasprzak 6 жыл бұрын
Sure, there are a few things you will need to do. 1) allow more time for the code to find the rising edges there is a while (ecnt++ < 200) which will bail out of the analogReads exceed 200. so for low frequencies you will need to increase the 200 to give the code more time to find the rising edges, maybe 2000??? play around with the value. 2) scaling may be done a few ways, put a delay (millisec or microsec) in the measure loop to cause slower reads (kinda amateur hour but may work) 2) during screen display, skip points to draw but may require building and larger array (if you are skipping 1 point, the array needs to be 2x longer), maybe other ways, these are off the top of my head.
@glasseffect
@glasseffect 6 жыл бұрын
Thanks a lot Kris! It worked beautifully! With ecnt++ < 3000, the Oscilloscope can now detect even a 2Hz input frequency! For the sake of visual impression, I would need the oscilloscope to see a greater frequency than what is applied at A0. So if a 5Hz signal is applied it would see something larger, that way perhaps the large waveforms would not appear as huge rectangles, rather something that happens with a higher frequency input (100Hz?). I know some accuracy would have to be sacrificed, but the lower frequencies I'm dealing with would appear more comprehensible. Is there any way to do that? Thanks again!
@KrisKasprzak
@KrisKasprzak 6 жыл бұрын
Glad it worked. scaling the display to be smaller was my suggestion #2, i've not messed with either of my suggestions so I'm not sure how (of if) they will work. adding a delay during the data read loop would take a minute to test, play with the amount of delay--a buck says it will work.
@glasseffect
@glasseffect 6 жыл бұрын
I feel I might be troubling you with those questions. But I'm elated to express that adding a delay of 10ms worked for frequencies as low as 5Hz. The unfortunate bit is that there's a button in my code that does the frequency switching. So, the 10ms delay affects the responsiveness of the button. I tried what I could by using a elapsedMillis library by Paul Stoffregen with the same 10ms delay over the entire data code: if (timeElapsed > interval) { for (x = 10; x
@KrisKasprzak
@KrisKasprzak 6 жыл бұрын
I'm happy to help, feel free to keep asking. It sounds like the issue is the the button only works outside the delay and pressing button is slow (or doesn't' work) during the delay? If so the fix is easy assuming your button is connected to a pin (if (digitalRead(button_pin) == HIGH)) then add a delay (or something). Correct so far? if so, connect the button to an interrupt-able pin (pin 2 is one if I recall), then add a line of code in setup() to "watch" activity on that pin, something like attachInterrupt(0,button_press) where 0 is interrupt #0 (pin 2), and button_press is a function that will execute your code. In that button_press code, you would change a variable that sets the delay time in your data collect loop. An interrupt stops any code and processes code when the interrupt is triggered. Hope this helps.
@Jaeger.radiophysique
@Jaeger.radiophysique 7 жыл бұрын
Hey ! thx for this, I still wanted to know, is a 2.8 TFT Touch Screen also working ?
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
I seriously doubt it will work with any decent performance. All of the TFT's out there don't seem to have a library with a video buffer. You basically write to the tft as you get the data, the transfer is too slow. These little OLED have a library from Adafruit that has a video buffer, where you fill the buffer then in one call the buffer is sent to the screen.
@TheXiaoxiangshi
@TheXiaoxiangshi 8 жыл бұрын
Really cool stuff !! worth not just $20, probably $200
@bocmanisbertrups9292
@bocmanisbertrups9292 6 жыл бұрын
Xiaoxiang Shi arduino = 15$ display = ~5$ what else do you need?
@rollback2037
@rollback2037 5 жыл бұрын
What if i use a different display? Do i need to change something in the code, idk like the library? or the code will work fine with any display?
@KrisKasprzak
@KrisKasprzak 5 жыл бұрын
If you use a display with a different driver chip other than the 1306 this code utilizes you will need to change the code.
@carlosvallejo4326
@carlosvallejo4326 7 жыл бұрын
Great video and project is amazing, maybe this can be enhanced with two channels, do you try it???
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
Yes I have it working with 2 channels (but using 2 displays).
@carlosvallejo4326
@carlosvallejo4326 7 жыл бұрын
I mean two channels on the same display
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
I'm guessing it can be done, there would be 2 arrays for channel 1 and channel 2, and both would be written to the same display---it would just be very busy.
@carlosvallejo4326
@carlosvallejo4326 7 жыл бұрын
Hello again my friend, I have another question about this scope, can I use an oled display that use 7 pins (GND, VDD, SCK, SDA, RES, DC, CS)??
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
Good question, i'm guessing that is an SPI device and you may not be able to write to it fast enough. The OLED (with the Adafruit library, lets you write the data to memory, the that display is set to the OLED. With SPI you would have to write to the display in a loop).
@carlosvallejo4326
@carlosvallejo4326 7 жыл бұрын
Ok, thank for your answer i more easy to use the 4 pin oled display. I hope to make this project nex weekend. See you!
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
PS, i've been playing with the Teensy 3.2 and OLED for this scope and find I can read frequencies up to 30khz, and with 12 bit resolution. Something to look at.
@chriswright3007
@chriswright3007 7 жыл бұрын
I have a 128x128 Freetronics OLED sheild from a previous project but am still new to this how would i go about using your code with the ardunio made OLED screen?
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
I'm guessing your OLED is SPI based? (SCK, MISO, MOSI pins?) Does your library have a "video buffer"?, w/o one i'm not sure an arduino can push data to the display fast enough. The Adafruit libs have one, so basically this program populates the buffer then a call to mydisplay.display(), sends the data over. The code mods will be to draw lines as you run through the second for loop. i've tried doing this and performance is unusable, but your lib may be fast enough.
@chriswright3007
@chriswright3007 7 жыл бұрын
Thanks for the response Kris, I'll have a look into it and see what i can do. thx for the help.
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
PS i've been messing with a Teensy 3.2 and that sucker un-overclocked runs at 72 mhz, 120 mhz overclocked. i created a cheap-o-scope that ran at 30 khz with just a few mods to the code. Have a look, it may be able to power your OLED w/o the need for the video buffer.
@angelomadonna
@angelomadonna 8 жыл бұрын
We have tried to upload your code, but it doesn't seem to be working. All connections are correct following the video. What should we do? Please!!!!
@KrisKasprzak
@KrisKasprzak 8 жыл бұрын
+Angelo Madonna What is it not doing? Compile, run, etc? Hard to debug with provided info,
@angelomadonna
@angelomadonna 8 жыл бұрын
+Kris Kasprzak The sketch is not working despite all connections are correctly done. I am using an Arduino uno and a mini oscilloscope (5Pcs 0.96 Inch White SPI OLED Display Module 12864 LED For Arduino). It gives me an error every time I try to upload the sketch.
@KrisKasprzak
@KrisKasprzak 8 жыл бұрын
+Angelo Madonna If it's an upload problem, its not the code. Can you get any other sketch to upload? If it's a compile problem, it's most likely an issue with the libraries. Are you sure that display is setup to run on the I2C bus?
@JerryEricsson
@JerryEricsson 8 жыл бұрын
I find when the sketches do not upload there is usually a problem with one of the #include libraries being out of date. To solve this I go to my Library folder and delete the offending library's. You can tell by the date of creation of the folder. If this does not fix the problem, then I download the latest library and remove all others so the Arduino can select the "right" library. There are so many updates to the library's that it is hard to keep up with them. The newest Arduino software now tries to take care of this problem, however I see it doesn't always work properly.
@maxwellmoojw8544
@maxwellmoojw8544 8 жыл бұрын
Oscilloscope great job
@KrisKasprzak
@KrisKasprzak 8 жыл бұрын
You're very welcome.
@blackburnmichelson6189
@blackburnmichelson6189 7 жыл бұрын
hello my friend can i use it for tft shield ardunio uno set
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
I doubt you can, tft libs dont have a vid buffer memory. I have seen spme vids that use tft but im mot sore how. Teensy has a fast tft lib that may work.
@caioqwerty1
@caioqwerty1 8 жыл бұрын
I have 128x64 fully white display, but it doesn't seem to work normally. When I upload the code it looks like the wave is being shown in half of the screen, what do you think that might be the problem? Arduino nano, windows 10, 1.6.8.
@KrisKasprzak
@KrisKasprzak 8 жыл бұрын
+Caio Poit Let's see if we can get you running. Basically the code captures inputs in an array where the bounds is the screen draw coordinates for (x = 10; x
@caioqwerty1
@caioqwerty1 8 жыл бұрын
Comenting out didn't work. It just removes the header showing cheap-0-scope but the oled display keeps showing the wave with the 2.5 to 0 volts part of the wave out of the screen. Where should I put the display.drawFastHLine...
@KrisKasprzak
@KrisKasprzak 8 жыл бұрын
+Caio Poit I would put the display.drawFastHLine(0, 10, 127,10); display.display(); as the only 2 lines in loop(), basically we need to see of you display really can address 0-127 or is it handle the coordinates differently Then try adding this line as the ONLY 2 lines in loop() diagonal line from corner to corner (this should produce a line from top left to bottom right, If not it's possible your screen interprets x-y differently. First things first. display.drawLine(0 , 0,127 , 63, 1); display.display();
@caioqwerty1
@caioqwerty1 8 жыл бұрын
Kris Kasprzak display.drawLine(0 , 0,127 , 63, 1); shows a diagonal line from the upper left edge to the middle down part of the screen.
@KrisKasprzak
@KrisKasprzak 8 жыл бұрын
+Caio Poit I'm guessing your screen is higher resolution than mine. I'm not sure why width of 128 is not full screen since you say the display is 128 wide. Since the line is only drawn to the middle of the screen maybe your display is 255 wide. Try this.. there are 2 for loops that go from 10 to 127, try changing the 127 to 255 from this for (x = 10; x
@manne3d
@manne3d 7 жыл бұрын
what is the software oscilloscope program you use on the computer?
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
The software that came with the oscilloscope.
@manne3d
@manne3d 7 жыл бұрын
aha, the USB Oscilloscope SainSmart DDS-120 i guess...thanks.
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
Correct.
@TheXbustax
@TheXbustax 6 жыл бұрын
hello friend thank you very much for your videos, ask! how can I operate the oscilloscope with the progress bar exchanging with a button between oscilloscope and progress bar (voltmeter). Excuse my english is with Google Translate xddd.
@KrisKasprzak
@KrisKasprzak 6 жыл бұрын
add a button to a digital pin and connect to low (0 volts). Then in setup add a line pinMode(your_pin, INPUT_PULLUP); the in loop() add a line if (digitalRead(your_pin) == low (show oscilloscope, else show volt meter
@nasimarana2023
@nasimarana2023 7 жыл бұрын
it's not compile in my compiler. it's see error compiling . what can i do now ?
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
Given your description, what do you think I can do?
@skillradius9867
@skillradius9867 5 жыл бұрын
Max voltage?
@KrisKasprzak
@KrisKasprzak 5 жыл бұрын
analogRead on Arduino is 5 VDC
@daanishmufti6456
@daanishmufti6456 4 жыл бұрын
i can see half the screen
@KrisKasprzak
@KrisKasprzak 4 жыл бұрын
yea, the adafruit lib is probably choosing the wrong display size. a few ways to fix 1) try adding this line to the declarations section #define SSD1306_128_64 2) or in the file Adafruit_SSD1306.h, then comment all lines but these 2 like this: // Deprecated size stuff for backwards compatibility with old sketches //#if defined SSD1306_128_64 #define SSD1306_LCDWIDTH 128 ///< DEPRECATED: width w/SSD1306_128_64 defined #define SSD1306_LCDHEIGHT 64 ///< DEPRECATED: height w/SSD1306_128_64 defined //#endif //#if defined SSD1306_128_32 // #define SSD1306_LCDWIDTH 128 ///< DEPRECATED: width w/SSD1306_128_32 defined // #define SSD1306_LCDHEIGHT 32 ///< DEPRECATED: height w/SSD1306_128_32 defined //#endif //#if defined SSD1306_96_16 // #define SSD1306_LCDWIDTH 96 ///< DEPRECATED: width w/SSD1306_96_16 defined // #define SSD1306_LCDHEIGHT 16 ///< DEPRECATED: height w/SSD1306_96_16 defined //#endif
@hdkaudioproject6319
@hdkaudioproject6319 5 жыл бұрын
Hello! I find your project very interesting, I want to do the same, can you share with me the project, thank you
@asunasposibol
@asunasposibol 7 жыл бұрын
Great work! Could it be used with a TFT screen like this one ?(www.smokeandwires.co.nz/blog/a-2-4-tft-touchscreen-shield-for-arduino) not my website, just my first result at google. I already have this one. Thanks in advance, and Regards!
@KrisKasprzak
@KrisKasprzak 7 жыл бұрын
In SPI mode sure not, if it supports 8-bit mode, maybe, but a big maybe. the issue with these displays is the amount of data that has to be sent to the display, not only size but color information and to my knowledge there is no video buffer. I've tried drawing lines, points, etc. on these TFT devices (in SPI mode), and draw time is really bad. For example i have a "car dashboard" that displays 10 numbers w/labels and 2 bar charts (simple stuff), and it takes 700ms to draw. For oscilliscope, we need to draw much faster.
Arduino Graph Drawing - FREE CODE!!!
3:57
Kris Kasprzak
Рет қаралды 105 М.
Kluster Duo #настольныеигры #boardgames #игры #games #настолки #настольные_игры
00:47
Smart Sigma Kid #funny #sigma
00:14
CRAZY GREAPA
Рет қаралды 83 МЛН
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 2,1 МЛН
Arduino Display Functions - FREE CODE!!!
11:36
Kris Kasprzak
Рет қаралды 49 М.
DS212: Open source 2-ch oscilloscope and signal generator
6:53
Marco Reps
Рет қаралды 351 М.
Using Multiple Displays with Arduino FREE CODE
3:25
Kris Kasprzak
Рет қаралды 67 М.
Monster magnet meets microwave magnetron...
17:44
Brainiac75
Рет қаралды 38 М.
6 Horribly Common PCB Design Mistakes
10:40
Predictable Designs
Рет қаралды 210 М.
Improve your Arduino programming skills - The budget oscilloscope.
16:05
Why did Raspberry Pi make their own SSD?
12:58
Level 2 Jeff
Рет қаралды 159 М.
Arduino and 128x64 OLED Display FREE CODE!!!
7:28
Kris Kasprzak
Рет қаралды 110 М.
What’s an OSCILLOSCOPE?
11:49
ElectroBOOM
Рет қаралды 1,6 МЛН
Kluster Duo #настольныеигры #boardgames #игры #games #настолки #настольные_игры
00:47