PIC based Oscilliscope

Not rated 24,461

Circuit Image

To achieve this project, the initial concept involves sampling an input using an Analog-to-Digital Converter (ADC) at consistent time intervals and subsequently displaying the waveform on a graphic LCD. Adjusting the time scale can be done by modifying the sampling rate, while the voltage scale can be altered by multiplying the measured values. The project will require components such as an ADC, a microcontroller, a graphic LCD, and an input source. A search for suitable LCD displays revealed a 4-inch touchscreen available for $25, which is a competitive price for its resolution. With the display and input source identified, further consideration is necessary for the graphical interface. The next component to address is the ADC. Several 24-bit Microchip microcontrollers with onboard ADC capabilities that can sample at 1.1 Msps have been identified. These microcontrollers are optimized for digital signals and can sample multiple channels simultaneously, making them suitable for a two-channel oscilloscope if future upgrades are planned. The selected microcontroller is the dsPIC33FJ128GP802, which can perform background sampling while utilizing onboard Direct Memory Access (DMA), allowing the code to focus on display drawing, data plotting, and input handling. The dsPIC33 is a 16-bit processor, which facilitates faster and easier mathematical operations compared to 8-bit processors. It can operate at speeds up to 40 MIPS, providing ample processing power for potential FFT or other data analysis tasks. Initially, the touchscreen was interfaced with the microcontroller's onboard ADC; however, to conserve resources, a dedicated touchscreen controller, the AR1010 from Microchip, was chosen. This decision was influenced by the availability of free samples for both the microcontroller and the touchscreen controller, which helped maintain a low budget. A significant challenge remains: the dsPIC operates at a voltage level of 3.5 volts, which is inadequate for analyzing 5V, 12V, or 24V waveforms. To address this, a voltage divider network and an operational amplifier (op-amp) will be necessary to isolate and match the impedance of the dsPIC's ADC input. Protecting the main controller is a priority, so a generic op-amp will be used for this purpose. Samples of op-amps from Texas Instruments have been ordered for circuit design, although they are not available in DIP packages. Additionally, a design from an AVR-based oscilloscope utilizing generic op-amps has been considered. The hardware overview has been outlined, and the software theory involves using a layered method to draw and plot data on the display (refer to the LCD controller datasheet S1D13700), where the plot is rendered on the back layer while graph lines and touch interface displays are on the front. This approach allows for the plot to be redrawn only when the buffer fills. To ensure a clear signal without excessive fluctuations, a triggering mechanism is required. The onboard comparator and DAC of the dsPIC will be employed to initiate sampling at a consistent voltage level that is in phase with the previous sample. The DAC will serve as a reference point for adjustable triggering, while the comparator will generate an interrupt when a threshold is exceeded. Currently, a functional oscilloscope and spectrum analyzer is in place, capable of displaying waveforms and calculating frequencies.

The project centers around creating a digital oscilloscope that utilizes a dsPIC33FJ128GP802 microcontroller, which is equipped with a 24-bit ADC capable of high-speed sampling. This microcontroller's architecture allows for efficient data handling and processing, making it well-suited for applications that require real-time data analysis. The integration of a graphic LCD display enables visual representation of the sampled waveforms, while the touchscreen interface provides user interactivity for a more intuitive experience.

To manage the varying input voltage levels, a voltage divider will be implemented to scale down higher voltage signals to the safe operating range of the microcontroller. The choice of an op-amp for impedance matching ensures that the ADC receives a signal that is both isolated and appropriately scaled, thus protecting the microcontroller from potential damage. The use of a dedicated touchscreen controller alleviates resource constraints on the microcontroller, allowing it to focus on data acquisition and processing tasks.

The software will employ a layered graphical rendering approach, which optimizes performance by minimizing the need to redraw static elements of the display. The implementation of a trigger system utilizing the onboard comparator and DAC will further enhance the oscilloscope's functionality by allowing precise control over when sampling begins, thus facilitating accurate waveform capture.

Overall, this project embodies a comprehensive approach to designing a digital oscilloscope that balances hardware selection, software architecture, and user interface design, resulting in an effective and versatile tool for waveform analysis.In order to accomplish this my initial thought is to sample an input (ADC) at consistant time increments and then display the waveform on a graphic lcd display. If I want to change the time scale I can just change the rate of time between samples, and if I want to increase the voltage scale I can scale the measured values by some multiple.

With that basic concept, this project will require an ADC, microcontroller, graphic lcd, and some form of input. After doing a bit of search for the LCD display this link was selling a 4 inch display with touch screen for a mere $25 (which is dirt cheap for that type of resolution if you check sparkfun or other website). So now I had the display and the input source, though more thought will be needed to have graphical interface, the next item to tackle was the ADC.

I had a few 24bit Microchip microcontrollers that had onboard ADC that could sample at 1. 1 Msps, as they were designed to be optimized for digital signals. Not only that but they can sample multiple channels at one time which would be good for a two channel oscilliscope (if I decide to upgrade later on). The chip is a dsPIC33FJ128GP802, and it also has the capability to do sampling in the background while filling up an onboard DMA so that the only work in code will be to draw the display, plot the data, and handle inputs.

The dsPIC33 is a 16 bit processor as opposed to the 8 bit processors which makes math on larger values much easier and quicker. On that same note, it also can run up to 40 MIPS so there should be plenty of speed if math operation may be needed to do an FFT or other analysis of data.

Initially in testing I was interfacing the touch screen with an onboard ADC of the microcontroller, but after thinking about how that ties up a resource I decided to go with a dedicated touch screen controller the AR1010, which is another Microchip product. I`m not trying to show a bias, I was able to get free samples of both chips (uC and Touch Controller) so they kept the budget low, and I really like the organization of datasheet put out by Microchip.

There is still one looming problem, and that is the fact that the dsPIC only works at voltage levels of 3. 5 volts. This isn`t very useful if 5/12/24 volt waveforms want to be analyzed (I left out 120 because of safety issue that I don`t want to mess around with).

So in order to scale down the signal I`ll need some sort of voltage divider network and an opamp to isolate and match the impedance of the dsPIC`s ADC input. Basically I would rather destroy a generic op amp before I hurt the main controller of this project. An idea I found from Texas Instrument was this, and I have ordered samples of their opamps to try and design this circuit but they don`t come in a DIP package.

Another idea I found was here, which is from an AVR base oscilliscope and it just uses some generic opamps. So above breifly explains the hardware, the theory of software is to draw/plot data on the display using a layered method (see lcd controller datatsheet S1D13700 ) where the plot is on the back layer and the graph lines and touch interface displays are on the front.

This way only the plot has to be redrawn every time the buffer fills. In order to have clear signal (ie the waveform isn`t always bouncing around) there has to be some type of trigger. For this I am going to try to use the onboard comparater and DAC of the dsPIC to start the sampling at a consistant voltage level that is inphase (positive going or negative going) with the previous sample.

The DAC will act as the reference point and allow for an adjustable trigger, while the comparator will allow for an interupt when a threshold is passed. As of now there is a generically working oscilliscope and spectrum analyzer that display the wave form and can calculate the frequency.

🔗 External reference




Warning: include(partials/cookie-banner.php): Failed to open stream: Permission denied in /var/www/html/nextgr/view-circuit.php on line 713

Warning: include(): Failed opening 'partials/cookie-banner.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/nextgr/view-circuit.php on line 713