I have a TTL (3.3V HIGH, 0V LOW) serial port on my microcontroller. I want to use it to communicate with another device, which uses (5V HIGH, 0V LOW) and the signal is also inverted.
What's simple circuit to invert and level-shift this signal in each direction?
To complete Mike ML's suggestion, if you want to to go from the device output to 3.3V TTL on your µC, use the same circuit but connect the 4.7k pull-up to +3.3V.
I was trying to do this with an NPN BJT, 3.3v signal IN to base, emitter to GND, collector to 10k resistor to +5v, then reading the signal from the collector. I must have screwed up.
I took a picture of the correct, desired signal from the original USB serial adapter that came with my device ---
Unfortunately I didn't manage to get a picture of the output of the uC but it measures +3.3v, idle on high.
I was trying to do this with an NPN BJT, 3.3v signal IN to base, emitter to GND, collector to 10k resistor to +5v, then reading the signal from the collector. I must have screwed up.
the level shifter shown within the dotted box is for a 3.3V OC output (with or without a pullup). for active outputs, you can simplify it by shorting across R4 and removing R2.
3.3V logic meets the VIL and VIh input requirements for TTL logic. You could just use a cmos inverter with TTL compatible inputs like HCT or ACT family.
I tried putting this together. The waveform looks perfectly like what I need in the oscilloscope, but the target device won't respond to this signal. Looks like I need to have an open drain or totem pole output for this to work, like in the drawing shown by unclejed613... but I don't fully understand it yet.
unclejed613 said:
the level shifter shown within the dotted box is for a 3.3V OC output (with or without a pullup). for active outputs, you can simplify it by shorting across R4 and removing R2
V1 is a pulse signal used to drive the transistor that simulates your 3.3V device output. it's just a signal source used for part of the example.. it's not part of the level shifter. i will post the waveforms from the circuit in operation if you like, then you can see what's going on in it.
V1 is a pulse signal used to drive the transistor that simulates your 3.3V device output. it's just a signal source used for part of the example.. it's not part of the level shifter. i will post the waveforms from the circuit in operation if you like, then you can see what's going on in it.