In the circuits we design, different chip pins use different voltages, such as the common 1.8V, 3.3V, 5V, etc. When communicating between two different voltage chip pins, we need to make the levels on both sides meet our own needs and be able to communicate normally. This process is level conversion.
For the level conversion scheme, we need to choose according to the actual application scenario. The main considerations are the transmission speed and direction of the signal.
For different application scenarios and cost control, four level conversion schemes are provided:
- Level conversion circuit using diodes
When the input terminal 5V-IN is at a high level, the diode is reverse-cut off and the output terminal outputs a high level;
When the input terminal 5V-IN is at a low level, the diode is forward-conducted and the output terminal outputs a low level.
Due to the self-generated characteristics of the diode, there is a reverse cut-off recovery time and a conduction voltage drop. In actual use, due to the reverse recovery of the diode and the internal junction capacitance, positive and negative voltage spikes will appear at the output. Connecting a capacitor in parallel at the output terminal can eliminate voltage spikes.
Due to the increase of capacitance, the output waveform will become slower and the data rate will be reduced. This is because the output end needs to charge the capacitor. In use, it is necessary to consider the rate of communication data, and adjust the output pull-up resistor and filter capacitor value according to the actual diode and output waveform used to keep the output waveform intact.
This circuit can be used for high voltage to low voltage conversion, but is not suitable for low voltage to high voltage conversion.
- Level conversion circuit using triode
The figure above shows a circuit that uses a transistor for level conversion. Q1 is an NPN transistor. The VIN voltage is the same as the IN voltage, the VOUT voltage is the same as the OUT voltage, and the input and output directions cannot be swapped.
When the input is at a low level, transistor Q1 is turned on, the output is turned on with the input, and the output is pulled down to nearly 0V, so that both ends are at a low level.
When the input is at a high level, transistor Q1 is turned off, and the output is pulled up to a high level by the pull-up resistor (R26 in the figure above), so that both ends are at a high level.
Because this circuit uses the on and off characteristics of the transistor to achieve level conversion, it has the same voltage spikes and low rate as the diode level conversion, and can only be converted in one direction.
- Bidirectional level conversion circuit using MOS tube
In this circuit scheme, the voltage V1 is less than or equal to the voltage V2, and the voltage V1 is greater than the voltage of the MOS tube conduction.
When S1A is at a low level, the MOS tube Q3 is turned on, S1A and S2A are turned on, and the S2A end is pulled down to 0V, so that both ends are at a low level.
When S1A is at a high level, the MOS tube Q3 is turned off, and the S2A end is pulled up to a high level by the pull-up resistor (R28 in the figure above), so that both ends are at a high level.
When S2A is at a low level, the parasitic diode inside the MOS tube is turned on, pulling S1A down to a low level, and then the MOS tube is turned on, S1A and S2A are turned on, and the output end is pulled down to 0V, so that both ends are at a low level.
When S2A is at a high level, the MOS tube Q3 is turned off, and the S1A end is pulled up to a high level by the pull-up resistor (R29 in the figure above), so that both ends are at a high level.
This circuit that uses MOS tubes for level conversion has a high switching rate and is suitable for scenarios that require high-speed level conversion.
- Use a dedicated dual-power level conversion chip
For scenarios that require high-speed signal level conversion, dual-power level conversion chips are more suitable. There are many types of level conversion chips, including unidirectional level conversion, bidirectional level conversion with direction control, automatic bidirectional level conversion, and dedicated level conversion.
Level conversion chips have two structures: MOS tube level conversion circuit structure and gate circuit drive. These two structures are suitable for open-drain circuits and push-pull circuits respectively. The gate circuit drive structure has a higher conversion rate. Level conversion chips are the most stable and reliable, but also more expensive.