Going from 5v to 3.3v using voltage divider

I am making a 2wd robot that will be able to be controlled via bluetooth, and I am following this link for guidance on setting up the bluetooth module:

In his walkthrough, he uses a 10k and 20k resistor to create a voltage divider to step the voltage down from 5v to 3.3v for the bluetooth RX pin, because that is what the pin is rated for. I ordered voltage regulators, but I can’t seem to figure out why my version of the voltage divider circuit I set up isn’t working. Every time I set it up I only get ~1.4v.

I attached a picture of my circuit. It is very similar to the one in the link above, but I am using 3 10k resistors instead of 1 10k and 1 20k. The yellow wire dangling to the right is the wire that is going to the RX pin on the bluetooth module (that is giving me only 1.4v). Any advice?

Have you checked that the software you are running has the arduino output pin set to an output using the pinMode call in the setup function.

In future use a 512R and a 1K for the divider as you bet a lower impedance which gives you a better shaped signal.

With nothing connected to the output of your voltage divider, you should get 2/3 of the input voltage, i.e. 3.3V out for 5V in, and 0V out for 0V in. If not, something is wrong with your cabling. 1.4V is about half the expected voltage, indicating a reversed (1/3) divider, or an unstable input voltage - do you send data via Serial, or did not connect to the Arduino Tx pin? If you’re using a different pin, make sure to configure it to OUTPUT mode and set it HIGH.
Or is your Arduino running at 3.3V, in which case you can connect directly to the 3.3V BT module?

Then connect and power the BT board, and measure the voltage again. If the voltage drops significantly when you connect to the BT Rx line, something is wrong with the module (not powered?). Perhaps the Tx and Rx connectors are swapped, but following the arrows should be safe.

The arduino TX pin is connected. I tested the voltage from that before building the circuit, and I was getting a steady 5v from it. I was thinking that I had something backwards, but I have the circuit setup exactly how it is in the walkthrough. I have the Vin (Arduino TX) going to the R1 (10k), and then a jumper going to R2 (2 10k resistors in series) and the R2 is being pulled to ground. The Vout is being tapped right at the end of the jumper wire in between R1 and R2.

I have nothing connected to the output of the voltage divider, so there's no issues there. Should I just reverse the divider, and see if that works (even though mathematically it shouldn't)?

Can you test your circuit by just hooking up to the +5V on the Arduino, rather than the Tx pin?

Mathematically it is correct, so either the input voltage isn’t what you think it is, or the resistors aren’t what you think they are. Or the load is different.

I just loaded up “blink” onto my Uno. This doesn’t output to the Tx pin at all. Despite that I measured 5V on the Tx pin. However loading it up with 33k load, it then reads 2.3V. So I am guessing you are not outputting anything on that pin.

And therefore it would be less at the voltage divider where you are measuring it (I calculate 1.53V). Try measuring the "top" of the voltage divider - make sure it is 5V. If not, then the rest of the calculations are meaningless.

Then if I add:

  Serial.begin (115200);

to the "blink" sketch then the Tx pin is still 5V even with the 33k load on it.

To explain the reading of 2.3V, even when the pin is input, I think you will find that the Atmega16U2 chip, which does the USB interface, has that pin set to input-pullup. That way it doesn't get garbage readings (and send them via USB) if the Tx pin is not configured as an output.

Now the spec for the Atmega16U2 shows that the input pull-up resistor value for I/O pins is in the range 20k to 50k, so let's assume half-way which is 35k. Plugging that into a voltage divider, along with the 33k load I used, plus the 1k resistor between the Atmega16U2 and the Atmega328P, you get an expected voltage of 2.5V. Pretty close to what I measured.

Hi, Looking at your image you have posted. Gnd is connected to Row11, the resistor is then connected Row11 to Row15, the next resistor is Row15 to what looks like Row20. Your yellow loop to the next resistor and the reduced output is connected to Row19???? Is that right? Or is the image to blurry?

Tom.... :)

nolls: The arduino TX pin is connected. I tested the voltage from that before building the circuit, and I was getting a steady 5v from it. I was thinking that I had something backwards, but I have the circuit setup exactly how it is in the walkthrough. I have the Vin (Arduino TX) going to the R1 (10k), and then a jumper going to R2 (2 10k resistors in series) and the R2 is being pulled to ground. The Vout is being tapped right at the end of the jumper wire in between R1 and R2.

Make sure that the top of the divider is 5V when connected. Then measure the voltage drop over each resistor, which should be somewhat equal (Vin/3). If not, replace the faulty resistor. See also Nick's fine comments.

[quote author=Nick Gammon date=1433569419 link=msg=2264595] Can you test your circuit by just hooking up to the +5V on the Arduino, rather than the Tx pin? [/quote]

That is what did it. Now I am getting ~3.4v. Thank you, now I know I am not insane.

[quote author=Nick Gammon date=1433569934 link=msg=2264598] Mathematically it is correct, so either the input voltage isn't what you think it is, or the resistors aren't what you think they are. Or the load is different.

I just loaded up "blink" onto my Uno. This doesn't output to the Tx pin at all. Despite that I measured 5V on the Tx pin. However loading it up with 33k load, it then reads 2.3V. So I am guessing you are not outputting anything on that pin. [/quote]

The whole point of me doing this was me assuming that the Tx pin on the arduino was outputting 5v, which is too high for the bluetooth module's Rx pin (only can take 3.3v) that I am using. Do I still need this voltage divider I made even though it only yields ~1.4v when it is hooked up to the arduino Tx pin?

TomGeorge: Hi, Looking at your image you have posted. Gnd is connected to Row11, the resistor is then connected Row11 to Row15, the next resistor is Row15 to what looks like Row20. Your yellow loop to the next resistor and the reduced output is connected to Row19???? Is that right? Or is the image to blurry?

Tom.... :)

Yea the image is blurry. The original picture I took was too large for an attachment : /.

[quote author=Nick Gammon date=1433571977 link=msg=2264623] To explain the reading of 2.3V, even when the pin is input, I think you will find that the Atmega16U2 chip, which does the USB interface, has that pin set to input-pullup. That way it doesn't get garbage readings (and send them via USB) if the Tx pin is not configured as an output.

Now the spec for the Atmega16U2 shows that the input pull-up resistor value for I/O pins is in the range 20k to 50k, so let's assume half-way which is 35k. Plugging that into a voltage divider, along with the 33k load I used, plus the 1k resistor between the Atmega16U2 and the Atmega328P, you get an expected voltage of 2.5V. Pretty close to what I measured. [/quote]

So do I have to configure the Tx pin as an output? I thought it was output by default.

nolls: So do I have to configure the Tx pin as an output? I thought it was output by default.

Default is input for all pins, you have to configure it for output. Using Serial the Serial.begin should configure Tx for output.

Do I still need this voltage divider I made even though it only yields ~1.4v when it is hooked up to the arduino Tx pin?

Yes you do because that voltage value is bogus.

nolls: The whole point of me doing this was me assuming that the Tx pin on the arduino was outputting 5v, which is too high for the bluetooth module's Rx pin (only can take 3.3v) that I am using. Do I still need this voltage divider I made even though it only yields ~1.4v when it is hooked up to the arduino Tx pin?

I agree with Grumpy_Mike.

Your test was not correct (you did not have 5V at the pin because it was not output). You cannot deduce that you will only get 3.4V when it is correctly configured. In fact it would be faulty if you did.

Slight disclaimer: When serial is active, it is a pulse of 0 and 1 bits. If you measure with a meter whilst it is sending data, it may "appear" to be less than 5V. However it is still 5V at some times and 0V at others. The 5V parts are what will damage the other device.

nolls: So do I have to configure the Tx pin as an output? I thought it was output by default.

Pins are multi-purpose. The Tx pin is not output until you activate serial with Serial.begin ().

Just a hint to all of us - on voltage dividers:

Simple voltage divider can be analyzed with the great Falstad online simulator: voltage divider

Notice the this circuit was defined in the URL parameters and is a nice way to share circuits that can be altered and experimented with. To obtain an URL to share - select Export as link in the on line circuit file menu.

Clicking wires and components in the simulator will give you a reading of current and voltage. Add the expected load to the circuit and check how much it can drive. The voltage divider can also be transformed into an ideal voltage source and an equivalent impedance. In this case shown all circuits have a load of 1kOhm just to see the theorem works at this time of day.

Thévenin's theorem

Dependning of what load you intend to drive and the response time you want resistors may be altered to reduce current on the processor output. Normally I would stay below 100k since the impedance of the resulting voltage divider becomes to high and subject to interference.

:sunglasses:

Don't forget the input capacitance of the load. This will slow down any rise time. As to the value 100K is way too high, I would always go for 1K or less.

This is what I got using “on the high side” resistor values in your 3.3V divider.

A single CMOS input is about 10pF. For low power projects a 50 kHz 5V signal will swing a 3.3V closeby input. Not so great though - if the input is on a large packplane or object of like 100pF.


A bit slow when applying a 100pF load.

Simulated using free of charge LTSpice from Linear Technolgy. They also have a gigant component library that can be put into simulation.