Microcontroller Projects

Two-Channel PC Based Oscilloscope USB
Inroduction

More and more experiments are now ‘PC-assisted.’ Also conventional acquisition systems are very expensive. Since portable  PCs are today common and a USB link is a better solutionhere we present an oscilloscope using USB port of the PC that operates at up to 10 kHz with ±16V input voltage. It has much more improved features than the PC-based oscilloscope . The oscilloscope uses IC PIC18F2550 from  Microchip as the main controller, which makes the oscilloscope compact as there is no need of additional power supply for the entire circuit board.


Circuit description

     At the heart of this oscilloscope is USB2.0-compliant microcontroller PIC18F2550 from Microchip. You can also use  IC18F2445 in place of PIC18F2550. Specifications of this microcontroller are:-
Features of 18F2550
Programming
1. Up to 32 kB of flash memory, 2kB RAM and 256-byte EEPROM
2. Extended instruction set (optimised for ‘C’ compiler)
3. 8x8 single-cycle multiplier
4. Single-supply serial programming and easy debugging
USB transceiver
1. USB1.1 and 2.0 from 1.5 MB/s to 12 MB/s
2. Isochronous, bulk and interrupt transfer modes
3. 1 kB of access RAM usable with 32 endpoints (64 bytes each)
Multiple oscillator and power modes
1. From internal 31 kHz to external 48 MHz with PLL
2. Possible software switching between ‘run,’ ‘idle’ and sleep
modes. In sleep mode, current is down to 0.1 μA.
3. Wide operating voltage range (2.0V to 5.5V). Useful for battery
operations.
Complete set of classical peripherals
1. Several input/output (I/O) ports, four timers with capture/
compares
2. Synchronous and asynchronous enhanced modules
3. Streaming parallel port
4. 10-bit ADC module with up to 13-channel multiplexer.

This microcontroller has a USB2.0-compliant transceiver and a CPU running up to 12 MIPS.





avobe figrue shows the circuit of the two-channel PC-based oscilloscope. MCP6S91 from Microchip Technology is an analogue programmable gain amplifier that is well suited to driving analogue-to-digital converters (ADCs) and an analogue input to a PIC microcontroller. Two MCP6S91 programmable gain amplifiers (IC4 and IC5) make it possible to choose the input ranges for each of the two channels, by selecting a gain from 1:1 to 32:1. The amplifiers are small, cheap and easy to use. A simple three-wire serial peripheral interface  (SPI) allows the PIC to control them through  pins 5, 6 and 7.

The MCP6S91 amplifier is designed with CMOS input devices. It is designed to not exhibit phase inversion when the input pins exceed the supply voltages. The maximum voltage that can be applied to the input pin is –0.3V (VSS) to +0.3V (VDD). Input voltages that exceed this absolute maximum rating can cause excessive current into or out of the input pins. Current beyond ±2 mA can cause reliability problems. Applications that exceed this rating must be externally limited with a resistor to the input pin.(pin 3), which is an analogue input, should be at a voltage between VSS and VDD. The voltage at this pin shifts the output voltage. The SPI interface inputs are chip-select (CS), serial input (SI) and serial clock (SCK). These are Schmitt-triggered, CMOS logic inputs.

     The only disadvantage is that these amplifiers accept only positive signals. That’s why voltage-shifting amplifiers LF353 (IC2A and IC3A) are used,one each for each channel input (see Fig. 1). The LF353 is a JFET input operational amplifier with an internally compensated input offset voltage. The JFET input device provides wide bandwidth, low input bias currents and offset currents. This voltage-shifting amplifier results in a high input impedance and an attenuation factor of 1:4.5. A ±16V input signal is then shifted to the0-5V range when the programmed gain is 1:1.

       Two halves of the LF353 (IC2B and IC3B) are used as voltage followers to provide a low-impedance shifting voltage (Vref) to the programmable amplifiers. This voltage must be precisely adjusted with two 4.7-kiloohm presets to measure precisely 2.5V level on the inputs of IC2 and IC3 when the input signals are grounded.

      Because LF353 opamps need a symmetrical supply voltage, a small DC-DC voltage converter ICL7660 (IC1) is used to feed –5V to LF353. With its small 8-pin DIP package, it needs only two polarised capacitors. ICL7660 can be replaced with a MAX1044. The MAX1044 and ICL7660 are monolithic, CMOS switched-capacitor voltage converters that invert, double, divide or multiply a positive input voltage.These are pin compatible with the industry-standard LTC1044

Overview of the universal serial bus 


All the data is transmitted on the D+/D- symmetrical pins using a variable bit rate. The position of a resistor (R13) on D+ or D- allows you to choose between the full-speed (12 Mbps) and lowspeed modes (1.5 Mbps). Note that the IC18F2550/2455 devices have built-in pull-up resistors designed to meet the requirements of low-speed and fullspeed speed USB. The UPUEN bit (UCFG=4) enables the internal pull-ups. In this project, R13 is not used. External pullup may also be used. The VUSB pin may be used to pull up D+ or D-. The pull-up resistor must be 1.5 kilo-ohms (±5%) as required by the USB specification

The PIC software

The program for the microcontroller is written in ‘C’ language. MPLAB 8.70 along with MPLAB_C18 is used as the software tool for development. The software tools can be downloaded for free from website ‘www.microchip.com.’ Based on Microchip’s application notes, the program for the chip is centered on a main loop continually polling the USB transceiver state. This loop never stops and each USB operation is done in one pass. All operations are initiated by the host (the PC), which ends a 16-byte command
The first command byte determines the chip actions. The four possible actions are:
1. Command 80h: Clears the EEPROM calibration memory
2. Command 81h: Receives parameters, and stores the gain-error compensation for the two channels.
3. Command 83h: Initiates a zero calibration sequence of the two chan The first command byte determines the chip actions. The four possible actions are:
4. Command 80h: Clears the EEPROM calibration memory
5. Command 81h: Receives parameters, and stores the gain-error compensation for the two channels.
6. Command 83h: Initiates a zero calibration sequence of the two channel.


Installation of the USB driver.
 1. If everything is fine, plug the oscilloscope with a USB cable to your PC (running Windows 98SE or higher version). A “new hardware detected–USB2-MiniOscilloscope”  dialogue box must immediately appear on the screen.
NOTE:- The driver for this oscilloscope is not for windows 7 or vista.

2. Now you can start the driver installation process. To download drive click here . The goal is to select a good driver (mchpusb.inf) by choosing the ‘specific location’ option. Don’t let Windows take a generic driver by default.
3.When you are done with installation, go to ‘device manager’ and check whether ‘USB2-MiniOscilloscope’ is under ‘other device’ in ‘view devices by type' option. Otherwise, repeat Steps 1 and 2.

User interface program and operations.
A user-interface software written in Visual Basic 6, called ‘OscilloPIC,’. You can download this sofware click here to download Run the set up program , This will automatically install the ‘OscilloPIC’ user-interface program.


application program looks like a small digital oscilloscope as shown in the screenshot below. Various settings for operations are given in the following menu bars:
1. Inputs: Selects the active channels
2. Sampling: Sets time-base and number of samples
3. Trigger: Sets the triggering condition
4. Cursors: Selects horizontal or vertical cursor positions
5. Num: Shows numerical  sampled values, with an export command (text file format)
6. Config: Configures gain and offset errors

Calibration is to be done as described below before reading the output signals on the monitor screen by clicking ‘channels calibration’ under ‘config’ menu bar. Feed the input waveforms (say, sine, rectangular, sawtooth, etc) from the source. Click ‘go’ button. The output waveform will be displayed on the monitor screen. Channel-1 and channel-2 output waveforms can be differentiated by screen and red lines, respectively. By default, the time base is 200 μs per division and amplitude is 4V per division. You can set these parameters as per your requirements.


Test and calibration



        The first step is to adjust the zero offset error. Connect the two analogue inputs to the ground level and tune the two 4.7- kilo-ohm presets until pin 2 of both MCP6S21 is at 2.5V. A more precise tuning can be achieved through ‘OscilloPIC’
software. Choose the smallest calibration value at ±0.5V for both the inputs.


           The ‘zero calibration’ command tells the PIC to start its own internal compensation for all calibrations. Don’t forget to  connect the inputs to the ground while calibrating.


       The second parameter to check is the gain error. By clicking the ‘gain calibration’ command, it’s possible to specify a small correction factor. This can be done after several measurements. You have to know the actual levels  sine and triangular waveforms and the measured levels (with the cursors) for the two channels. The gain error is less than 0.1 per cent. The number of samples can be set between ‘10’ and ‘500.’ The minimum sampling 10 μs for two channels.


Construction 
           assembly on a bread board.

          An actual-size, single-side PCB layout for the two-channel PC-based USB oscilloscope circuit is shown in Figure and its component layout . Since the circuit is compact, the construction is easy. 


          It is advised to use IC bases for mounting IC1 through IC7 on the PCB for easy troubleshooting. The USB connector (CON1) must be firmly soldered and fixed on the board. It is located on the extreme right of the board (refer Figure.). 





Two BNC connectors can be used for the input signals for channels ‘1’and ‘2,’ respectively. The connectors can be fixed on the front panel of the enclosure. The performance of the oscilloscope can be improved by changing the PIC and its ADC with a faster model. AD9238 (20 MS/s) is a good choice. This fast, parallel ADC converter could be used with a powerful DSP PIC.


DOWNLOAD Firmware and PC Software:-


Click here to Download PIC Firmware
Click here to Download PC Software  and Driver
Click here to Download PCB File 


NOTE:-  PCB file optimized for home made process That's why thread are so thick, if you want to PCB manufacture by professional the you can reduce the size further

Comments

Popular posts from this blog

Download Huawei Modem Unlocker v5.8.1b by BOJS

Hidden Secret Service Menu Codes for Sony, Samsung, LG and Philips TV

Solving power supply problems (s.m.p.s)