Boosting Signal with Transistor

Hey
im currently trying to interface with an existing device.
For whatever reason I can only find digital signals switching between about 1,8V and 0V.
I´ll have to convert those signals into ones from 0v to 5V

I thought I could simply use NPN PN2222A Transistor in the configuration as shown in my schematic.
(Note that I´m only using the analog pin for debuging purposes, I intend to use a digital one)

The transistor is switching like its supposed to, when I feed GND into the Base I get 0V at A0 as expected.
When I feed 1.8V into the base I only get about 1.2V at A0. I expected it to give me like 4.8V which would be enough to trigger the digitalRead. As of now I actually lowered my signal level instead of lifting it up to 5V.

I´ve played around with all kinds of different values for the pulldown and base resistors but to no avail.

I must have something wrong with my schematic or have some basic misunderstanding about how transistors work.

What am I missing here folks?

Thanks

This configuration is an emitter follower. The voltage on the emitter will be the voltage on the base minus around 600mV (because of the voltage drop across the base-emitter junction).

Why do you have such a large input impedance? It doesn’t matter in the circuit you posted, as the transistor will be happy to supply the necessary current. Combined with the input capacitance, the resistor will result in terrible signal degradation.

Connect the emitter to ground, the collector to the input pin, enable the internal pull-up resistor, and connect the signal via a resistor to the base.
Note that this inverts the signal, but that’s not a problem, invert it again in software.

Alternatively: https://www.sparkfun.com/products/12009

Pieter

And ... google using a “transistor as a switch”

Hey Pieter,

thanks for your input, your circuit works great!

The 100MOhm imout impedence is just what the specs provide for an input pin.

I´ve read up a little on Emitter followers and understand what they do but havent really why they behave that way. Just out of curiosity, do you have a simple explantion for it?

@hammy
I did and saw a lot of people switch solenoids or whatever. I took that working principle and tried to adapt it to my problem. As stated above, I still dont really understand why it works as an Emitter follower and not the way I intented it to work. I did my best to come up with a solution myself without bothering anybody and only asked for help once I got stuck.
This way I get more out of than just following some prewritten tutorial.

Thanks

Input pins are way more than 100 megohms at room temperature - the 100M value is worst case across the
temperature range of the chip.

Basically CMOS inputs take zero current for all practical purposes (at DC, and assuming the voltage is between
ground and Vcc at all times).

The emitter follower circuit has no voltage gain, so its useless for logic, it only has current gain.

For switching always use common-emitter, never use the normal gain parameter (called beta or hfe)
as that doesn't apply to a saturated transistor, take the gain to be about 10 to 20.

You know "input impedance" does not mean that you add a resistor of that value, right?

kRz_4tw:
I´ve read up a little on Emitter followers and understand what they do but havent really why they behave that way. Just out of curiosity, do you have a simple explantion for it?

Imagine switching the input from 0V to 1.8V. Because no current was flowing before, the voltage across the load (the pull-down resistor in this case) is 0V (Ohm's law). However, now that the input is 1.8V, a small current starts to flow from the base to the emitter. This results in a larger current from the collector to the emitter (this is a basic property of the transistor).
Now that current is starting to flow, the emitter will no longer be at 0V, but some higher voltage (again, Ohm's law). As the current keeps on increasing, the voltage at the emitter increases as well. This is up to the point that the voltage difference between the base and the rising emitter is around 600mV, because at that point, no more current would flow between the base and the emitter, so no more current would flow from the collector to the emitter either, as a result, lowering the current through and voltage across the load, meaning that the emitter voltage would decrease again.
As you can see, an equilibrium will be reached.