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(' ');
@ErikBongers6 жыл бұрын
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.
@davidkempton28944 жыл бұрын
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.
@davidprice28616 жыл бұрын
Got to say that is very very nifty and clever, brilliant concept and code. Thanks..
@KrisKasprzak6 жыл бұрын
You're very welcome. Glad I could help.
@FreiR7 жыл бұрын
the most simple I ever seen. Nice!
@jsmythib7 жыл бұрын
A valuable contribution. I wish I could map out its effect over time for diy'ers :) Cheers!
@davidkempton28944 жыл бұрын
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!!
@KrisKasprzak4 жыл бұрын
glad i could help
@i.ismail7 ай бұрын
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.
@evanang96997 жыл бұрын
Awesome, btw was wondering if this would work on a transient circuit? i.e. Measuring the output voltage for an RLC circuit.
@ChoudryArif8 жыл бұрын
lovely, works like charm, though I had to increase font size of Hz to read properly
@KrisKasprzak8 жыл бұрын
Glad I could help.
@69MazdaR1007 жыл бұрын
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.
@Taran726 жыл бұрын
thank you for sharing! Looks Great!
@vtech87169 жыл бұрын
very good project, but what about triggering level? or how to stop graph?
@MrBobWareham7 жыл бұрын
Very nice and thank you but could I use a bigger screen to get a better view.
@KrisKasprzak7 жыл бұрын
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.
@spwim6 жыл бұрын
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)
@JerryEricsson4 жыл бұрын
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.
@lintangwisesa7 жыл бұрын
great project, Sir
@maxwellmoojw85448 жыл бұрын
Oscilloscope great job
@KrisKasprzak8 жыл бұрын
You're very welcome.
@EmbeddedEnigma3 жыл бұрын
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 ?
@JerryEricsson8 жыл бұрын
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.
@KrisKasprzak8 жыл бұрын
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.
@JerryEricsson8 жыл бұрын
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.
@manne3d8 жыл бұрын
what is the software oscilloscope program you use on the computer?
@KrisKasprzak8 жыл бұрын
The software that came with the oscilloscope.
@manne3d8 жыл бұрын
aha, the USB Oscilloscope SainSmart DDS-120 i guess...thanks.
@KrisKasprzak8 жыл бұрын
Correct.
@blackburnmichelson61897 жыл бұрын
hello my friend can i use it for tft shield ardunio uno set
@KrisKasprzak7 жыл бұрын
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.
@alejandromontes896 жыл бұрын
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 .
@juanportalanza7114 жыл бұрын
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?
@KrisKasprzak4 жыл бұрын
What error?
@juanportalanza7114 жыл бұрын
@@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.
@KrisKasprzak4 жыл бұрын
@@juanportalanza711 are you sure you have the correct board selected from the Arduino IDE that matches the board you are using?
@juanportalanza7114 жыл бұрын
Kris Kasprzak yes sir, I’m pretty sure. If I could, I would send you a screenshot. I don’t know what’s incorrect
@KrisKasprzak4 жыл бұрын
@@juanportalanza711 well I see you're using an UNO, this code will not compile on that have to have a Teensy 3.2
@josephjensen87747 жыл бұрын
Digital Dope. Thanks.
@angelomadonna8 жыл бұрын
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!!!!
@KrisKasprzak8 жыл бұрын
+Angelo Madonna What is it not doing? Compile, run, etc? Hard to debug with provided info,
@angelomadonna8 жыл бұрын
+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.
@KrisKasprzak8 жыл бұрын
+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?
@JerryEricsson8 жыл бұрын
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.
@glasseffect7 жыл бұрын
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!
@KrisKasprzak6 жыл бұрын
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.
@glasseffect6 жыл бұрын
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!
@KrisKasprzak6 жыл бұрын
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.
@glasseffect6 жыл бұрын
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
@KrisKasprzak6 жыл бұрын
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.radiophysique7 жыл бұрын
Hey ! thx for this, I still wanted to know, is a 2.8 TFT Touch Screen also working ?
@KrisKasprzak7 жыл бұрын
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.
@chriswright30077 жыл бұрын
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?
@KrisKasprzak7 жыл бұрын
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.
@chriswright30077 жыл бұрын
Thanks for the response Kris, I'll have a look into it and see what i can do. thx for the help.
@KrisKasprzak7 жыл бұрын
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.
@EmbeddedEnigma3 жыл бұрын
hi I want to ask how did u calculate this value for (x = 10; x
@KrisKasprzak3 жыл бұрын
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.
@EmbeddedEnigma3 жыл бұрын
@@KrisKasprzak thanks for the reply. just last question how can I slow the speed little bit ?
@carlosvallejo43267 жыл бұрын
Great video and project is amazing, maybe this can be enhanced with two channels, do you try it???
@KrisKasprzak7 жыл бұрын
Yes I have it working with 2 channels (but using 2 displays).
@carlosvallejo43267 жыл бұрын
I mean two channels on the same display
@KrisKasprzak7 жыл бұрын
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.
@carlosvallejo43267 жыл бұрын
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)??
@KrisKasprzak7 жыл бұрын
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).
@carlosvallejo43267 жыл бұрын
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!
@KrisKasprzak7 жыл бұрын
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.
@rollback20375 жыл бұрын
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?
@KrisKasprzak5 жыл бұрын
If you use a display with a different driver chip other than the 1306 this code utilizes you will need to change the code.
@TheXbustax6 жыл бұрын
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.
@KrisKasprzak6 жыл бұрын
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
@skillradius98675 жыл бұрын
Max voltage?
@KrisKasprzak5 жыл бұрын
analogRead on Arduino is 5 VDC
@TheXiaoxiangshi8 жыл бұрын
Really cool stuff !! worth not just $20, probably $200
@bocmanisbertrups92926 жыл бұрын
Xiaoxiang Shi arduino = 15$ display = ~5$ what else do you need?
@FLBRGZ6 жыл бұрын
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 👍
@KrisKasprzak6 жыл бұрын
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.
@daanishmufti64565 жыл бұрын
i can see half the screen
@KrisKasprzak5 жыл бұрын
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
@nasimarana20238 жыл бұрын
it's not compile in my compiler. it's see error compiling . what can i do now ?
@KrisKasprzak8 жыл бұрын
Given your description, what do you think I can do?
@hdkaudioproject63196 жыл бұрын
Hello! I find your project very interesting, I want to do the same, can you share with me the project, thank you
@asunasposibol8 жыл бұрын
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!
@KrisKasprzak8 жыл бұрын
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.