Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Voltage Dividers - current draw

Status
Not open for further replies.

Yobortsa

Member
Attached is a schematic showing the voltage divider from the PICkit1 board used to test the analog input by providing varying voltage (I think this is accurate!! Correct me if I'm wrong).

1. Why doesn't the circuit try to flow 5 amps (i=v/r =5V/1ohm =5A) of current to ground when you have RP1 turned all the way down (ie. 1ohm resistance or less)? Isn't this a short circuit?

2. This leads to my second question: When designing circuits (at the moment i'm using a PIC12F675), how much current should you aim to feed into the IO ports when used in analog mode? For example, here the resistance between +5V and RA0 is between 1K and 11K which according to Ohm at 5V drop would be between 5mA and 0.5mA. Or isn't this how it's calculated?

3. What about when the port is in digital mode? I think this is called TTL mode - how much current should you feed them? In other words, what size resistor should be used for a switched input? 1K / 4.7K / 10K?? Confused! Pull up, pull down, can somebody please explain!

Thanks,

David :)
 

Attachments

  • vd.png
    vd.png
    18.6 KB · Views: 361
1. Why doesn't the circuit try to flow 5 amps (i=v/r =5V/1ohm =5A) of current to ground when you have RP1 turned all the way down (ie. 1ohm resistance or less)? Isn't this a short circuit?

I think because it never gets to 1 ohm due to the 1kohm resistor as a voltage divider, I would need to stare at this longer to tell you a real answer :)


2. This leads to my second question: When designing circuits (at the moment i'm using a PIC12F675), how much current should you aim to feed into the IO ports when used in analog mode? For example, here the resistance between +5V and RA0 is between 1K and 11K which according to Ohm at 5V drop would be between 5mA and 0.5mA. Or isn't this how it's calculated?

The less resistance the better because it allows for a quicker reading time (The internal capacitor gets discharged faster)

3. What about when the port is in digital mode? I think this is called TTL mode - how much current should you feed them? In other words, what size resistor should be used for a switched input? 1K / 4.7K / 10K?? Confused! Pull up, pull down, can somebody please explain!

Max current on a pin is about 20mA, take this into account when designing your circuit!
 
Oops - RP1 Clarification

Regarding question 1: I was wrong about RP1 - it always has 10K ohm resistance between pins 1 and 3. The varying resistance is tapped off at pin 2. So presumably there is always a current draw of 0.5mA between +5V and Gnd. So it never gets to a short circuit.
 
I like to do my switches like this. You only use power when switch is pressed
sw-png.33444

The 1 k resistor limits you pot to 1 k so the max it can sink is 5mA

You can pull 20 mA from a pin but you shouldn't go over 200 mA total for all ports
 
I like to do my switches like this. You only use power when switch is pressed

You will find that the preferred method is a pull-up resistor, with the switch to ground - there are a number of good reasons why this is the most common method.

Many PIC's have switchable pull-ups on some pins for this very reason.
 
Last edited:
When a pin is set to analogue or digital input it will have a very high impedance and the typical current that will flow into/out of the pin will be less than 1uA. In your example the only current that will flow will be through the 10k pot and will follow ohms law. In this case 5/10,000 A (500uA) will flow through the resistor and less than 1uA will flow through the 1k resistor into the pic pin. The 1k resistor and capacitor are not really needed unless you are doing very fast acquisitions and even then it would be rare they would be required.

A typical pullup resistor would be 20k and this is all that is required. The 1-4.7k resistor in Burt's diagram is not needed. And has has already been mentioned it is more normal to have pullups rather than pulldowns

Edit, BTW, the above assumes you are not going to do something silly like making the pin an output.

Mike.
 
Last edited:
You all are some thing The Op ask on number 3 what size resistors I posted that and said
I like my switches low changing to high on press saves power

The 1k in his circuit limits the pin to max of 5mA
 
You all are some thing The Op ask on number 3 what size resistors I posted that and said
I like my switches low changing to high on press saves power

The 1k in his circuit limits the pin to max of 5mA

Burt,

The 1k resistor is irrelevant. There is no way that when a pin is set to input that 5mA can flow thought it. The only (max) current that will flow through the 1k resistor is 1uA (typically 0.1uA). (inrush on ADC excepted, but still irrelevant).

Whether you should use pullup or pulldown resistors is also pretty irrelevant. It's personal choice or is defined by what you are interfacing. However, with pic chips it is normal to pullup as that is what Microchip built in.

Mike.
 
Ok mike so the irrelevant 1 k resistor is there for no reason.
LOL It there because if the OP set that pin HIGH and a output it would be a short.

The Op ask why it can't short because of the 1 k being there that's one forsure reason

Mike you should tell microchip to stop doing it like that they could save a bunch by removing them from there demo boards
 
Hi Nigel,
Why are pull-ups the common practice? What are the good reasons?

Probably the most important is that you aren't running live wires to switches, which could potentially short out and cause damage, as this could directly short the PSU to ground.

It's just the preferred way, and it's almost always done that way.

be80be - sorry, but you aren't saving any power, PIC inputs are VERY high impedance, and even high value resistors pull it up almost to Vdd (difficult to measure as a meter would affect it more than the PIC does).

There's nothing 'wrong' with pull-downs, just that there's usually no reason to use them instead of pull-ups.
 
There's nothing 'wrong' with pull-downs, just that there's usually no reason to use them instead of pull-ups.

Don't pull-ups provide a cleaner input signal to the uP? For instance, a low input signal would be more indicative of a true signal than a high, which might be caused by noise or other outside influence?
 
I prefer the opposite. The more critical an external input is the better it is to be normally at ground and heavily filtered. So the switch pulls it up. The ground is a better reference from the PIC to the external world (car etc) and also when the PIC and its circuit powers up (or from brownout) etc the input pins will start from a low volt or zero volt state.

For little buttons close to the PIC i'll use the internal pullups and save resistors. But for a "proper" app like external switches on machinery etc i'll run a pull down resistor and RC filter, so the PIC pin is normally zero volts and the switch pulls up, and also add a 470 ohm resistor to supply the switch +ve in case of shorts etc.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top