close-circle
Close
0%
0%

multiScope

Fast, Portable and Affordable Oscilloscope and Inductance Meter

Similar projects worth following
close
Don't be deceived by its small size. This little beast has an inductance meter and a oscilloscope with sampling rate of 1.7 MS/s, based on a STM32 running at 72MHz. Frequency, voltage and duty cycle information are included. As a bonus, you get temperature and pressure sensing.

The main goal when I built this was to have a simple to use yet capable scope to view oscillations and an inductance meter to learn about oscillator circuits.

Commercial versions of these tools have a high price that is prohibitive to many of us, so the more affordable and open source approach of this project may allow more and more makers and hackers to explore this wonderful part of electronics.

Building our multiScope isn't hard from the hardware perspective, it is in the software that most magic happens. The base of this project was the STM32-O-Scope (which is also based on another scope), from which I got the DMA code. Without it, our scope wouldn't be so fast.

The STM32F103C8T6 is a 32bit ARM microcontroller (with a quite long name) that has higher clock and ADC resolution than any AVR based Arduino, but is still cheaper than them. Another great thing is that you may program it using the good old Arduino IDE.

I've chosen a touch screen dispay for multiScope to keep user interaction simple and flexible. With these same principles in mind, the input signal is connected to a voltage divider that can be replaced in order to reduce voltage to 3.3V, the maximum value STM32 will safely handle.

Our inductance meter is based on LM339 and a simple LC circuit whose resonant frequency we measure to get the unknown L value.

You may adapt multiScope to your needs. As I had a bmp180 lying around, it was included as an extra feature, but it's your choice. If you don't want it or want to include another kind of sensor, just change a few lines of code.

multiScope_patched_libraries.zip

This file contains 3 Adafruit libraries: BMP180, GFX and ILI9341. This last one was patched to the display I used, while the others are ordinary libraries.

x-zip-compressed - 778.40 kB - 04/15/2017 at 17:44

download-circle
Download

multiScope_v4.1.ino

Latest code version with automatic attenuator detection and corrected time base

ino - 38.98 kB - 04/15/2017 at 17:43

download-circle
Download

lcd_touch_paint.ino

A sketch to test the display wiring, slightly modified version of Adafruit's original example

ino - 5.61 kB - 04/02/2017 at 21:11

download-circle
Download

multiScope_v3.ino

Previous code

- 36.31 kB - 03/31/2017 at 22:44

download-circle
Download

  • 1 × STM32F103C8T6 minimal dev. board (aka "blue pill")
  • 1 × 3.3V USB/Serial adapter I used FT232RL. It's for programming the MCU
  • 1 × 2.4" LCD TFT touch screen display You'll find it by searching "2.4 tft lcd" on eBay
  • 1 × BMP180 For pressure and temperature sensing
  • 1 × A box or enclosure As you might have seen, mine was a pretty toy car

View all 16 components

  • Negative voltage support

    Vítor04/15/2017 at 18:52 0 comments

    I decided to post it on instructables too, and while tinkering with the scope I ended up adding support to negative voltages and offset. Here's a pic of 120VAC input from the mains:

    I've uploaded the new code and plan to properly update the instructions here later, but in the meantime, anyone interested is welcome to check the project there.

View project log

  • 1
    Step 1

    Add STM32 support to the Arduino IDE

    Thanks to the guys from http://www.stm32duino.com/ we are able to program the STM32 family using Arduino. What you need to do is very simple:

    • Install Arduino SAMD Boards package with the Arduino Boards Manager
    • Download or clone the Arduino_STM32 into the Arduino/hardware folder
    • Open the IDE, select your board (Generic STM32F103C series if it's the blue or red pill) and Serial as Upload Method to program using the USB-Serial adapter (like FT232R)

    Connect the board by following my little sketch. You may test it with the ordinay Blink code, just note that the onboard led is on PC13 and that you will need to change the position of the first jumper to switch between Run and Program modes.


  • 2
    Step 2

    Display and power source

    Once we've made sure the main board is working, let's add the touch screen. The wiring is described in my drawing and also in the sketch code.

    Some pictures of my version:

    I've put the regulator(7805), battery(7.2V li-ion) and switch together. The jumper cables connect to the display 5V and GND pins directlty.

    This is the full scope, so just pay attention to the blue pill and display.I know... it's really messy. That's why we have a nice cover to hide everything!

  • 3
    Step 3

    Test the display

    Before proceeding, you should test the display and touch to see if everything is working.

    The patched TFT library contains code that might not work well with the default Wire library due to pin conflict, so let's edit a few lines to avoid trouble:

    • Go to Arduino\hardware\Arduino_STM32\STM32F1\libraries\Wire
    • Open Wire.h with a text editor you like and look for #define SDA
    • Make it like this:
    #define SDA PC15
    #define SCL PC14
    • Save the file. Now SDA is on PC15 and SCL is on PC14.

    I've modified the original example a little, and so may you to adjust the touch sensitivity constants. Upload it (the file is lcd_touch_paint.ino) and you should get something like this (the picture is Adafruit's):

View all 7 instructions

Enjoy this project?

Share

Discussions

andyhull wrote 06/15/2017 at 22:49 point

I love the case you have used... Mini-scope.. 

  Are you sure? yes | no

Vítor wrote 08/27/2017 at 15:34 point

Sorry for the late reply but thanks. None of this would've been possible without your project in the first place!

  Are you sure? yes | no

ldv82 wrote 05/17/2017 at 13:33 point

Hello. I have a problem. Example lcd_touch_paint.ino Works great. And there are a lot of phantom clicks in the oscilloscope sketch. I can not choose the oscilloscope function, because another option is immediately turned on. In function readTouch() has changed if (p.z > MINPRESSURE && p.z < MAXPRESSURE). At the same time, the touchscreen does not work.

  Are you sure? yes | no

Vítor wrote 05/17/2017 at 21:59 point

Hi! The readTouch() function of the scope sketch was changed because using p.z wasn't very good with my display. Try changing if(touchX>20) to a higher number. You may also try using touchY or reverting to p.z code. Besides, MINPRESSURE and MAXPRESSURE are constants that could be adjusted.

  Are you sure? yes | no

ldv82 wrote 04/12/2017 at 07:07 point

How to determine the frequency of the signal, which is in the photo? Can you use this example? Timebase - is the price of one division?I reason so... The period takes 15 small divisions or 1,875 large. One division is now 100 uS (Timebase)? Then 1.875 * 100 = 187.5uS1/187.5=0.00533 .Then 0.00533*1000000=5333 Hz

http://www.stm32duino.com/download/file.php?id=1438

  Are you sure? yes | no

Vítor wrote 04/12/2017 at 11:47 point

One of the ways I found to measure frequency precisely is by using a rising of falling interrupt on the code. Tie the analog input pin to another digital input using a resistor (at least 1k, it's for protection and keeping impedance high) and count rises or falls during a second. As every time one of these happens, you have a full cycle. Then you have cycles/second = Hz.

  Are you sure? yes | no

ldv82 wrote 04/14/2017 at 19:56 point
Thank you. Did the frequency measurement according to your circuit. Everything is working.
I do not see a signal on the display at timebase = 2000 and higher.Is there any restriction?Sketch took not from you, but from the forum http://stm32duino.com

  Are you sure? yes | no

Vítor wrote 04/15/2017 at 18:31 point

Hey! Timebase should indicate how many seconds/div, but it wasn't correct in the original code. See my latest sketch. It's now working as expected.

  Are you sure? yes | no

darth_llamah wrote 04/01/2017 at 12:10 point

You may want to read the Pig-o-scope forum thread (http://stm32duino.com/viewtopic.php?f=19&t=107) as there were some modifications done recently

  Are you sure? yes | no

Vítor wrote 04/01/2017 at 22:42 point

There are some nice things indeed and they've even included a PGA before the analog input. It could certainly be used to make the scope more sensitive to weak signals.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates