When turned off, it looks like an ordinary toy car that would entertain a kid for hours, but actually it is an oscilloscope kit in disguise!
The idea and also part of the code for this project came from another scope called STM-32-O-Scope (aka pigScope), which uses a more powerful Arduino cousin called STM32. I originally posted my version on hackaday, but now Iâve deciced to bring it here too, so it may help more people who donât have a commercial oscilloscope and also becase thereâs a contest happening đ
I use this tool daily to watch signals or as a second voltmeter and also to measure inductance of home-wound inductors. As the code is open, you may add, remove or improve features according to your needs.
As itâs more than just an oscilloscope and âoscilloscope and inductance meterâ is too cumbersome, I named this little guy multiScope. Hereâs what it currently does:
- Measure inductances greater than 100uH with 10% precision
- Display analog or digital signals with up to 1.7MS/s sampling rate
- Temperature and pressure sensing (an extra feature)
- Displays voltages, frequency and duty cycle
Step 1: Materials
The core parts for the oscilloscope:
- STM32F103C8T6 minimal dev. board (aka âblue pillâ), buy one like this STM32F103C8T6 min. dev. board
- 3.3V USB/Serial adapter (FT232RL or something like that)
- 2.4 TFT LCD touch screen display (the display library I used was adapted to the model of the picture, but with some changes in code, you might be able to use others). Example link: 2.4âł TFT LCD Shield on eBay
- A box or enclosure (may be something 3D-printed, an old box you have or even a plastic toy)
- 6-9V battery (I used 7.2 li-ion as it lasts very long)
- Small switch (main power switch)
- (2x)2.2K Resistor
- LM7805 (5V regulator)
Parts for the inductance meter:
- LM339 (comparator IC)
- Resistors: 330R, 150R
- 1uF ceramic capacitor (the higher the precision, the better)
- 1N4007 (common diode)
Parts for attenuators :
- 2Ă3 female header socket
- Resistors: how many will depend on how much attenuation you need, but they are regular resistors and trimpots.
Step 2: Add STM32 Support to the Arduino IDE
Before building our hardware, letâs setup our development environment. Here, standard Arduino IDE was used with an add-on called Arduino STM32. The guys who made it also host a forum called Arduino for STM32 that is not so beginner oriented as the Arduino forum, but people can discuss things related to the STM32 board family and also share their projects. Thereâs even a page with other oscilloscopes based on pigScope too, from which Iâve learned many things and maybe you will too.
OK, so do the following:
- Make sure you have a compatible IDE version. They recommend 1.6.9, but I used 1.8.1 without any problem
- Install Arduino SAMD Boards package with the Arduino Boards Manager (in case you donât know, itâs a tool inside the Arduino IDE)
- Download or clone Arduino STM32 into the Arduino/hardware folder
- Open the IDE, select your board (Generic STM32F103C series for blue or red pill) and Serial as Upload Method to program using the USB-Serial adapter
- Connect the board by following the little sketch. You may test it with the ordinay Blink code, just note that the onboard led is on PC13. Every time you upload code, you will have to change the position of the first jumper to switch between Run and Program modes before powering or resetting the board
Step 3: A Quick Arts Class
Once weâre sure the blue pill is working, letâs proceed to the display. I wonât cover the placement of parts in detail because it will depend on the enclosure youâve chosen. Be creative and put them where you think itâs best.
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.
Now, do the display wiring as described in my drawing. After itâs finished, download multiScope_patched_librarires.zip and extract to your libraries folder. To test it, upload lcd_touch_paint.ino. The pins are already adjusted. All you need to do is set your inner artist free.
Step 4: To Measure Inductance
Now, weâre going to build the inductance meter circuit. Itâs a very simple one, and works in a somewhat similar way to ultrasound sensors: STM32 sends a âtriggerâ pulse to pulse_in and receives another trough pulse_out, from which we extract frequency (and thus inductance) information. This site explains the schematic and the physics principles in detail if youâre interested.
You should connect pulse_in to PB3 and pulse_out to PB4. The unknown inductor of the schematic is the one we want to measure. Solder some alligator clips or female jumpers if you want.
Source: Fast, Portable and Affordable Oscilloscope and Inductance Meter