dsPIC® DSC ADC
Microchip dsPIC® Digital Signal Controllers (DSC) contain up to 2 high-speed analog to digital conversion (ADC) modules. All ADCs are Successive Approximation Register (SAR) converters with 10-bit or 12-bit resolution, and up to 4 Msps conversion rate featuring 3.3V low-power CMOS technology. The dsPIC DSC ADCs can have up to 49 input channels plus two voltage reference monitoring inputs. Each ADC module also has a dedicated result buffer.
Basic ADC Operations
This section focuses on the basic ADC operations in conjunction with power conversion applications. At the high level, we have already seen that the ADC converts a signal from the time continuous/amplitude continuous domain into a time discrete/amplitude discrete domain on the Analog to Digital Conversion page. Looking inside the ADC operation, we can distinguish two distinct steps:
- The input signal is first sampled
- The signal is converted and quantized before getting stored in the ADC buffer.
See figure below showing the conceptual block diagram of converting continuous time signal to discrete time signal.
The signal below is a continuous time signal that is fed into the ADC as the analog input.
The sampler in the ADC measures the analog input signal at a specific instant in time, reading the amplitude of the input signal. The instants where the input is measured (sampled) are equally-spaced. The sampler is implemented as a switch followed by a capacitor (cap). When the switch closes (sampling instants), the cap charges to the same voltage as the input. When charged, the switch opens so that the voltage is kept on the cap and measured. The interval during which the switch is closed (the sampling period) is very short - in the range of less than 100 ns dsPIC® DSC. See figure below.
The output of the sampler is a set of values equally spaced in time, because the sampling rate is nearly constant. The amplitude of the sample is represented by a voltage on a cap, so that it is still an analog (amplitude continuous) value. The main change in the sampler is that the time axis does not exist anymore. Between two sampling instants we have NO direct information of what happens of the signal itself. Since the time axis is not continuous, we can replace it with a sequence of indexes, each of them identifies a specific sample taken by the sampler. The indexes are ordered, reflecting the passing of time. See figure below.
Let us now discuss the operation performed by the second block inside the ADC: the quantizer. As shown in the figure below, the quantizer divides the amplitude range in stripes having the same height. The number of stripes depend s on the number (N) of bits (resolution) of the ADC. For example, a 10-bit ADC operating on a voltage range from 0 to 3.3 V, will divide this voltage range into 210 = 1,024 stripes, each stripe corresponds to 3.3 V / 1024 = 3.222 mV wide.
The quantizer assigns each stripe a name: a number from 0 to 2(N -1). The first sample (index 0) will be converted to 0011, the second (index 1) to 1000, the third (index 2) to 0101 and so on.
ADC Frequency Spectra
In the figure below, we have an analog signal in the time domain. On the right, we have its spectrum (frequency domain). Let’s assume the spectrum is non-zero from 0 Hz up to fm Hz.
When we use the ADC to sample the input signal, the effect of the sampling operation in the time domain is to generate, in the frequency domain, a replica of the spectrum along the frequency axis displaced by fs, which is the sampling frequency.
If we change to lower sampling frequency, the replica will correspondingly move as shown in the figure below, (fs1 > fs2). If the fs < 2 fm, the first replica of the spectrum will overlap the fundamental spectrum introducing distortion in the signal which cannot be removed any more. This leads to the sampling frequency selection criteria that the minimum sampling frequency needs to be twice the signal spectrum width (fm), fs = 2 fm
Let's take a look at why we need to sample the voltage information from the input and output in power converter applications. Basically there are two different reasons for collecting data from the system:
- Getting information about the behavior of the system: By reading the output voltage, we can control the variable in order to keep the system under control, i.e. making sure the regulations are within system specifications using the control loop. Because this is a high priority task, it must be performed at a high sampling rate, hence the need of the high-speed ADC. This is the same reason why we're reading the input voltage which controls the duty cycle of the switch, i.e. the Vout/Vin transfer function.
- The second one has a lower priority and is not critical to the correct operation of the system. A typical example is temperature monitoring. Other examples may be sampling analog values in the human interface applications.
Reading Voltage in Power Conversion Applications
Considering first the critical data measurements, the system measures the voltages and currents. Voltages are normally measured at the input and output of the converter.
Depending on the power conversion topology, a front end interface may be required, which could be in the form of a resistor divider. In the case of Switch Mode Power Supply (SMPS) topologies, the voltage detected in the dsPIC® DSC, such as dsPIC33FJ16GS504 can be directly supplied to a component pin, assuming that it is within the allowed range.
The key point here to stress is that voltage and current are used as input to the compensator/controller, so that they take an active role in the loop control. This is the reason why it is important to be as fast as possible in acquiring these data. Of course this is a relative statement. Everything depends on the PWM frequency.
In a digital implementation we should remember that no matter what entity we are acquiring it will always be converted into a number by the Analog to Digital Converter.
Reading Current in Power Conversion Applications
Currents are measured in the inductors, see figure below. In transformers, currents are measured in the primary and secondary windings, and at the output. The inductor current is used to control the loop average current.
There are several ways to measure current:
- Shunt Resistors: One of the most popular current sensing techniques because it is very easy to implement. Shunt resistors are popular current sensors because they provide an accurate measurement at a low cost. The downside of using shunt resistors to measure current is that they are intrusive to the circuit, and the power consumption is high.
Shunt Resistor Example:
Current can be measured by placing a shunt resistor with the meter. Because most of the current flows through the shunt, and only a small amount of the current flows through the meter. This allows the meter to measure larger currents. In some cases, amplification or level shifting is required when measuring high current in connections with the high voltages. In the figure below, an AC motor is powered by a three-phase inverter bridge circuit. The figure shows that the composite current of all three Insulated Gate Bipolar Transistor (IGBT) circuit legs can be measured with a single shunt resistor.
- Hall Effect Current Sensors: are popular because they are accurate, small and non-intrusive. The small size can easily be integrated into an embedded application. The trade-off of the hall effect sensor is high cost, and the lower accuracy over temperature.
Hall Effect Principle:
The Hall effect is based on the principle that a voltage (VH) is created when current (IC) flows in a direction perpendicular to a magnetic field (B), as shown in the figure below. Hall effect sensors can be found in applications such as motor control.
Motor Control and Drive Design Solutions
- Current-Sensing Transformers: Current-sensing transformers are a popular sensor technology, especially in high-current or AC line-monitoring applications. They offer low power consumption, although their accuracy is not as good as the hall effect sensor or the shunt resistor approaches. These sensors use the principle of a transformer where the ratio of the primary current to the secondary current is a function of the turns ratio. The main advantage of a current transformer is that they provide galvanic isolation and can be used in high-current applications. The main disadvantage of a current transformer is that an AC input signal is required to prevent the transformer from saturating.
The figure below shows the schematics of single turn and multi-turn primary current-sensing transformers. The
single-turn primary transformer offers the advantage that the measurement is non-intrusive and the current-carrying
wire can be passed directly through a hole in the transformer. The multi-turn transformer offers the advantage of improved magnetic coupling, since many turns of the primary wire can be provided.
Current is measured at the input in-rush, input control, and peak loop current. See figure below.