PDA

View Full Version : Pullups and pulldows



xnihilo
- 31st March 2008, 13:26
Hi.

Could somone tell me what should be the values for External weak pullups.
I'm using 10K but I thing it is too much. I read somewere I should use 4.7K.
So what value should I use to be safe?

My second question:

Do I need to use external pulldown resistors on pins that are default LOW.
Let's say I want RA5 on PIC16F684 to be low by default oce I disable internalm wpu, should I use an external weak pull down resistor to tie it to ground? If yes, what value?

My third question:
Should use a RC networks (0.1 capa with an external resistor for weak pull ups or just a resistor?

I've seen that in some circuit, the designer used a 47 UF capacitor on his 7.2V power supply for supplying a circuit with a PIC16F684. Why would he use this capacitor as the current is DC?? Is it needed to filter something or to prevent some voltage loss or something?

Thanks for any replies !!!

Rob
- 31st March 2008, 15:25
Hi.

Could somone tell me what should be the values for External weak pullups.
I'm using 10K but I thing it is too much. I read somewere I should use 4.7K.
So what value should I use to be safe?



I have used both values without problems although I normally use 10k.



Do I need to use external pulldown resistors on pins that are default LOW.
Let's say I want RA5 on PIC16F684 to be low by default oce I disable internalm wpu, should I use an external weak pull down resistor to tie it to ground? If yes, what value?


It really does depend on what the input to the PIC is coming from although, generally, it is best to use a pull-down resistor otherwise it mght be left 'floating'.



Should use a RC networks (0.1 capa with an external resistor for weak pull ups or just a resistor?


again, depends on what it is being connected to. Some times it is necessary to use a capacitor to reduce noise etc



I've seen that in some circuit, the designer used a 47 UF capacitor on his 7.2V power supply for supplying a circuit with a PIC16F684. Why would he use this capacitor as the current is DC?? Is it needed to filter something or to prevent some voltage loss or something?


I'm assuming the capacitor was placed across the power supply of a voltage regulator. This is common practice and helps "smooth" the voltage. If I'm using a 5V regulator, I normally have a 47uF or 100uF across the input to the regulator and 10uF on the output of the regulator. Normally, I have 100nF capacitors across both input and output of the regulator in addition to the 47/100uF and 10uF caps. Some may say that this is unneccessary with todays voltage regs. Have a look at the specific voltage regulator data sheet; it may suggest different values.

Hope this helps

Rob

xnihilo
- 31st March 2008, 21:05
I have used both values without problems although I normally use 10k.



It really does depend on what the input to the PIC is coming from although, generally, it is best to use a pull-down resistor otherwise it mght be left 'floating'.


The signal is 5V output from another PIC16F684 (on the same power supply).



again, depends on what it is being connected to. Some times it is necessary to use a capacitor to reduce noise etc



I'm assuming the capacitor was placed across the power supply of a voltage regulator. This is common practice and helps "smooth" the voltage. If I'm using a 5V regulator, I normally have a 47uF or 100uF across the input to the regulator and 10uF on the output of the regulator. Normally, I have 100nF capacitors across both input and output of the regulator in addition to the 47/100uF and 10uF caps. Some may say that this is unneccessary with todays voltage regs. Have a look at the specific voltage regulator data sheet; it may suggest different values.

It is between the anode and the cathode of the battery...



Hope this helps

Rob

mackrackit
- 31st March 2008, 23:07
If you use 10K you will have 0.0005 amps across the resistor.
If you use 4.7K you will have 0.001 amps across the resistor.
That is why 10K is normally used. It saves power if you have this condition several times.

Power supplies:
If you are running off of batteries a capacitor may not be necessary. If there is some thing in the circuit though that creates some noise then a 22uf or larger might be needed. It is difficult to figure before hand, you will find what works.

The regulators used now days are pretty good, but there is still some noise getting through from the rectifier. So caps and some times inductors are needed. If you do not have a scope but a good multi-meter foe AC, read the voltage in AC and see what you have. For example , I some times use a power supply from a PC for a bench supply. The AC voltage on the 12 volt side will be 0.004 volts. When a 4700uF cap is placed across the positive and negative (0) rails the AC voltage drops to .000. Now it is good enough for a PIC.

The larger the capacitor
It is between the anode and the cathode of the battery... in this case will also help in brown out conditions.

xnihilo
- 1st April 2008, 00:01
If you use 10K you will have 0.0005 amps across the resistor.
If you use 4.7K you will have 0.001 amps across the resistor.
That is why 10K is normally used. It saves power if you have this condition several times.

Power supplies:
If you are running off of batteries a capacitor may not be necessary. If there is some thing in the circuit though that creates some noise then a 22uf or larger might be needed. It is difficult to figure before hand, you will find what works.

The regulators used now days are pretty good, but there is still some noise getting through from the rectifier. So caps and some times inductors are needed. If you do not have a scope but a good multi-meter foe AC, read the voltage in AC and see what you have. For example , I some times use a power supply from a PC for a bench supply. The AC voltage on the 12 volt side will be 0.004 volts. When a 4700uF cap is placed across the positive and negative (0) rails the AC voltage drops to .000. Now it is good enough for a PIC.

The larger the capacitor in this case will also help in brown out conditions.

What is a brown out? A decrease in the supply? I don't use BOD in my config byte.

What would make noise in my circuit?? voltage regulator? LCD display?

Okay for 10K. I will use them as pullups and pulldown. In my circuit I have strange behaviors on a portA.5 pin set as input (internal WPU disabled), default low and with no external Weak pulldown. When I touch any pin (no matter which one), there is an INT trigger as if +5V was getting to this specific pin (this pin is int enabled when getting from LOW to HIGH). I guess I should use a weak pull down...???

mackrackit
- 1st April 2008, 00:19
What is a brown out? A decrease in the supply? I don't use BOD in my config byte.Even if you do not configure BOD the PIC will only operate within a certain voltage range for the OSC speed it is running at. So if something causes a voltage draw for a short period of time that the regulator can not handle the large capacitor will help. (maybe a LCD back light coming on )


What would make noise in my circuit?? voltage regulator? LCD display?
A switch used as an input that changes position rapidly, or an output to a high speed relay, etc...


Okay for 10K. I will use them as pullups and pulldown. In my circuit I have strange behaviors on a portA.5 pin set as input (internal WPU disabled), default low and with no external Weak pulldown. When I touch any pin (no matter which one), there is an INT trigger as if +5V was getting to this specific pin (this pin is int enabled when getting from LOW to HIGH). I guess I should use a weak pull down...???
Personally I never have like the internal pull-ups, I always use an external pull up/down. And never let a pin float, always have control.

xnihilo
- 1st April 2008, 09:42
Even if you do not configure BOD the PIC will only operate within a certain voltage range for the OSC speed it is running at. So if something causes a voltage draw for a short period of time that the regulator can not handle the large capacitor will help. (maybe a LCD back light coming on )

A switch used as an input that changes position rapidly, or an output to a high speed relay, etc...

Personally I never have like the internal pull-ups, I always use an external pull up/down. And never let a pin float, always have control.

Thank you very much for the information.
I need internal wpu because for my project i need to enable and disable them on the fly in software. Is there another easy alternative?

a

mackrackit
- 1st April 2008, 09:51
I need internal wpu because for my project i need to enable and disable them on the fly in software. Is there another easy alternative?


Can you tell us a little about your project? At this point I would just be guessing more than usual. :)

xnihilo
- 1st April 2008, 15:51
Can you tell us a little about your project? At this point I would just be guessing more than usual. :)


Can you tell us a little about your project? At this point I would just be guessing more than usual. :)

Sure, it is a lasergame system. the mag module performs a handshaking with the gun module. i.e. gun asks the mag if there are still ammo in the mag. if there are, the gun receives a signal and the ammo is used.

there are 2 pics 16f684 communicating. the mag ra5 is set as input and used at default low state (porta.5=0, wpu disabled).
when the gun sends a +5v to mag's ra5 for 1ms, mag then sets ra5 as output and it sends +5v out via ra5 to the gun as a reply then ra5 is set again as input at logic low. this ra5 pin is used as input/output for handshaking. TRISA is used to chang pin direction as needed.
so my trouble is, if i use an external 10k weak pulldown to avoid leaving it floating (and triggering a fake int on ra5 if there is some noise) i won't be able to disable the pull down in software when i'll be using the pin as output. do you see?

Rob
- 1st April 2008, 16:09
Sure, it is a lasergame system. the mag module performs a handshaking with the gun module. i.e. gun asks the mag if there are still ammo in the mag. if there are, the gun receives a signal and the ammo is used.

there are 2 pics 16f684 communicating. the mag ra5 is set as input and used at default low state (porta.5=0, wpu disabled).
when the gun sends a +5v to mag's ra5 for 1ms, mag then sets ra5 as output and it sends +5v out via ra5 to the gun as a reply then ra5 is set again as input at logic low. this ra5 pin is used as input/output for handshaking. TRISA is used to chang pin direction as needed.
so my trouble is, if i use an external 10k weak pulldown to avoid leaving it floating (and triggering a fake int on ra5 if there is some noise) i won't be able to disable the pull down in software when i'll be using the pin as output. do you see?

There should be no problem with using a 10k pull-down resistor. So the gun pin (the one that's connected to RA5 of the mag) goes to an input immediately after sending a 1ms high signal? This pull-down resistor would therefore stop the gun input pin floating as well.

Please correct me if I've mis-interpreted you

Cheers

Rob

mackrackit
- 1st April 2008, 19:07
I agree with Rob.
You can have an external pull up or down and still do what you want.
Think of it like this.

If you had a switch connected to a pin (input) that is set to receive a high signal when the switch is closed you would have a pull down resistor to hold the pin low so not to give a false reading.

If you had a mosfet or relay connected to a pin (output) that is set to go high to activate the mosfet or relay you would have a pull down resistor to hold the pin low so not to have the mosfet or relay coming on when is is not supposed to.

The thing I will suggest in your case is a 100K pull down might be better. It should increase the sensitivity.

mister_e
- 1st April 2008, 19:20
Problem when switching internal-pull up could be some false interrupts events. Your software MUST compensate for it. But i see no advantage to do so.... too bad... i can't take beer 'till few months ... in some occasion, it's an eye opener :D

xnihilo
- 1st April 2008, 19:27
There should be no problem with using a 10k pull-down resistor. So the gun pin (the one that's connected to RA5 of the mag) goes to an input immediately after sending a 1ms high signal? This pull-down resistor would therefore stop the gun input pin floating as well.

Please correct me if I've mis-interpreted you

Cheers

Rob

In fact RA5 of the PIC used in the gun is connected to RA5 of the pic used in the mag.
Pins used for this handhasking, both in the gun and in the mag are used both as input and output in a specific sequence.

GUN (with weak PD) MAG (with 10K external weak pull down)

RA5 RA5

OUTPUT, LOW INPUT, LOW
Set high for 1ms Portachange interrupt is triggered, goto int handler
1ms delay RA5 becomes an output pin
RA5 becomes input RA5 starts outputing 5V ONLY if an ammo is available in the mag
start polling RA5 2ms delay
RA5 reverts to output RA5 reverts to input
Here the gun either received a 5V pulse on RA5 (got an ammo from the mag) or no pulse was received, which means mag is empty
The respective programs continue...

That's how I implemented my handshaking between the pics. I would have used separate pins one for input, one for output for each pic but I don't have enough free pins, anyway, such usage of the pic should be okay anyway

What will happen when the 5V output is sent. As there is a 10K weak pullup connecting the pin to the ground... I guess some current will sink to the ground but most of it will reach the target pic, right?

mackrackit
- 1st April 2008, 19:27
too bad... i can't take beer 'till few months ... in some occasion, it's an eye opener :D

HUH? No beer? Whats up?

mister_e
- 1st April 2008, 19:31
Long story :( PM or e-mail....

mackrackit
- 1st April 2008, 19:34
What will happen when the 5V output is sent. As there is a 10K weak pullup connecting the pin to the ground... I guess some current will sink to the ground but most of it will reach the target pic, right?
Yep, that is why I think a 100K might be better in you situation.
I think :)

mister_e
- 1st April 2008, 19:39
I'm kinda lost in here... sorry :( And there's some danger also.. unless you also use a current limiting resistor between your PIC and the mag.... hence why i asked for a schematic awhile back... and weak pull-up can't be tied to GND... unless it would be pull-down.

xnihilo
- 1st April 2008, 21:13
I will make a schematic/diagram with the stuff by draw it by hand will be a mess. I will try to understand how to use EAGLE pcb designer so I make some decent diagram.

In the meantime, as I said, the two pics have to communicate using each one porta pin.

The communications is:
Gun-PIC send +5V to Mag-PIC who then turns its pin as output and sends back a +5v to the Gun-PIC.

I'll make my schematics and system description and source available on my website by the end of the week.

Anyway THANKS a lot for your help guys.

xnihilo
- 1st April 2008, 21:15
I'm kinda lost in here... sorry :( And there's some danger also.. unless you also use a current limiting resistor between your PIC and the mag.... hence why i asked for a schematic awhile back... and weak pull-up can't be tied to GND... unless it would be pull-down.

Sure, pull-down because I use the pin in low state so to avoid the pin to be left floating I tie it to GND, I read it is a good practice.