The Project board is for sharing projects based on Silicon Labs' component with other community members. View Projects Guidelines ›

1 Introduction

The Oscilloscope Simulation System based on EFM8UB1 works as a tool to sample an ADC value and display it as waveform on a computer screen. Although it is a combination of hardware and software, it looks like a real oscilloscope.

The software architecture of this system consists of firmware running on EFM8UB1 STK and an application running on a computer. The GUI application running on the computer was developed using python 2.7, pyside2, Qt5, and the USBxpress library.

The hardware consists of a computer host and an EFM8UB1EK device. The EFM8UB1EK is connected to the computer with a USB cable. You can use EFM8UB1 to sample the ADC voltage value and, send the collected data to the host via USB. The block is illustrated below.

 

2 Preparation

2.1 Install Python 2.7 32-bit

Most of library made by Silicon Labs was developed with Python 2.7 32-bit. Please download and install Python 2.7 32-bit. Here is the download link: https://www.python.org/downloads/release/python-2715/

2.2 Install Pyside2 and Qt

Official release wheels of Qt for Python can be installed regularly via pip:

pip install pyside2

Pre-release (snapshot) wheels containing the latest code changes are available at http://download.qt.io/snapshots/ci/pyside/

For example you can install the latest 5.11 snapshot wheel using:

pip install --index-url=http://download.qt.io/snapshots/ci/pyside/5.11/latest/ pyside2 --trusted-host download.qt.io

See more info from http://wiki.qt.io/Qt_for_Python/GettingStarted.

2.3 Firmware Programming

The compiled firmware is located in the directory Bin/. Program the Hex file to EFM8 Universal Bee Starter Kit (SLSTK2000A) to make it as an oscilloscope device.

Connection

Connect the EFM8UB1EK device and a computer with a USB cable.

2.4 Execute GUI application

Download the software/ to your local device and run the application with the command below.

python.exe main.py

3 Overview GUI

The application will start with a login widget as shown below. The component 1 is a device combobox that shows the connected EFM8UB1EK device, and the component 2 is a pushbutton.

 

The device shown in the combobox will be open, and the application will jump to a main widget when the pushbutton is pressed.

 

District 1 is a canvas which can be used to display the waveform. When the cursor is in this district, the time and ADC value of cursor position will be shown.

District 2 is the display district. The buttons in this district are the zoom in pushbutton, the zoom out pushbutton, the enable ADC pushbutton, and the single trigger button from left to right.

District 3 is used to control 3 LED on the EFM8UB1EK device.

District 4 is used to enable channels. There are two channels available: the routed to the GPIO pin1.7 and the GPIO pin1.2 respectively.

District 5 is the frequency district. The sample frequency will be set to the value shown in the combobox when the set pushbutton is pushed.

The current information will be shown in district 6.

4 Start sampling

Once you have all the required environments and equipment, you can start sampling by following the steps.

  • Connect the device and host
  • Execute the GUI application
  • Choose the required device in combobox and press the enter button
  • Check the required channel
  • Choose the appropriate frequency and then press the set button
  • Push the enable ADC button in district 2

After that, the waveform will now display in district 1.

5 Software development and functional development

In order to facilitate continued function expansion, a flexible protocol was developed. Every operation is an item of command which consists of preamble byte, command byte, value length and value. The preamble byte is a fixed value 0xAA, the command byte shows the specific operation, and the third byte followed by a value is the length of the value. The table shown below lists the command that have been taken. If you want to develop a new command, you can start with 0x60.

 

6 Conclusion

The oscilloscope simulation system is used to sample analog voltage and show it as waveform. It provides two channels to sample the voltage signal, supports zoom out and zoom in, and can display voltage and time information on the mouse cursor point, making it look like a real oscilloscope. It is an important tool for measuring analog voltages for engineers.

7 Source Code

The source code of the GUI tool and firmware is attached for reference.

  • Projects