Asked — Edited

Pull Down Resistor

I have a switch that is always closed. If it becomes open that is a condition that I take some action. I put together a pull down resistor (based off the attached picture from another post). But I noticed that it gets really warm to the touch. Is that expected? Should I use a larger resistor (or smaller).

Thanks in advance.

User-inserted image


ARC Pro

Upgrade to ARC Pro

Unlock the true power of automation and robotics by becoming a proud subscriber of Synthiam ARC Pro.

PRO
USA
#1  

Questions:

  1. Are you using that pull down with a Digital Port ?

White - Digital Port Black - GND Red - VCC

1.1) Red - voltage value ?

  1. Resistor value ?
PRO
USA
#2  

using port D20 on the EzB. Resistor value is 47 ohm 1/2 watt.

PRO
USA
#3  

red wire - voltage, is from D20 Vcc In port ? EZB voltage ?

PRO
USA
#4  

According to the documentation on the EzB:

The digital ports of the EZ-B v4 are unregulated power. This means that the power you provide to the EZ-B v4 is outputted to the power pin of the digital ports.

This is because digital ports are generally used for servos. It is very energy inefficient to regulate power for servo motors and therefore generates a lot of heat, kills batteries quickly, etc.. It is recommended to power the EZ-B v4 with a 7.4v LiPo battery so servos do not require regulators.

The ports are unregulated, I am using a LiPo battery.

This is my understanding of the pinouts: Black is ground. Red is VCC, White is signal (i/o).

PRO
USA
#5  

I hope you understand the BIG problem... when you press the button you are feeding 7.4V to a digital port 3.3v although 5v tolerant.

You are lucky If your EZB and/or the PORT are still good...

#7  

The digital pin is 3.3v, 5V tollerant and rated a 10mA... watch for the magic smoke...:)

PRO
USA
#8  

There is no smoke. The EzB is fine.

Still would like to know how to setup the a switch as I stated.

PRO
USA
#9  

Solution:

  1. Use the Digital Port but connect the red wire to an Analog's VCC pin (3.3v) OR
  2. Use an Analog Port

Regarding the resistor 47 ohm is a strong resistor, a 4.7K is a weak resistor.

Weak or Strong affect two things: current consumption and response time.

For a button, the time it takes to switch the button, plus the code is not executed in the controller (wifi delay, desktop cpu processing etc) is not relevant stronger takes more time to react.

A strong pull resistor would, when the button is pressed and kept pressed, cause a large drain of current from vcc through the resistor to ground, so a weak resistor is better.

I would use a 4.7K resistor, but it can work with 1K.

PRO
USA
#10  

Ok, just to make sure I understand.

Let me take option 2.

If I use an ADC port do I need the pull down resistor?

If I do, same setup GND and VCC?

Option #1

So connect the pull down resistor to ground and VCC (red), not white as I have it.

I have a 4.7 k resistor will try it.

Thanks for the info.

#11  

Wait.... Of the 3 wires, which ones are connected to the switch? If just the white and black, then the discussion about white smoke and such are irrelevant, you are just connecting 3.3v to ground, so it is just a matter of getting the right resister value for the pull down. Most of the threads I have seen suggest a 1k, but I am not that savvy on electronics (mostly a software guy) so not sure how to calculate the optimal value. Resisters to get warm, because what they are doing is slowing down current and throwing it away as waste heat. If it is ~100 degrees, no worries. If it is hot enough to burn, then you have the wrong value, or have wired the unregulated (probably 7.4 if you are using the Lipo) high amp current to the switch (red wire), which is a major issue.

Alan

PRO
USA
#12  

There has been no smoke.

I have smaller resistors.

I am not an electrician either and browsed many threads talking about the pull down resistor.

So is my solution to install a smaller resistor and make sure the GND and White goto the switch.

My switch has two wires. I want to set it up so that as long as the button is pressed so switch is closed I take no actions, but if the switch is open (or no longer pressed) I want to take an action.

PRO
USA
#13  

Sorry, work call.

To avoid doubts:

User-inserted image

PRO
USA
#14  

Quote:

But I noticed that it gets really warm to the touch. Is that expected

P (Watts) = I * I * R = V * V \ R P = 7.4 * 7.4 \ 47 = 1.16 w your resistor can handle 1/2 = 0.5 W, so eventually will get harm and then black smoke.

P (Watts) = I * I * R = V * V \ R P = 3.3 * 3.3 \ 1000 = 0.01 W

P (Watts) = I * I * R = V * V \ R P = 3.3 * 3.3 \ 4700 = 0.002 W

Like i said i use 4.7K but it can work with 1K, the consumption is not relevant.

Note: you can use the 47 ohm:

P (Watts) = I * I * R = V * V \ R P = 3.3 * 3.3 \ 47 = 0.2 W

You are wasting 0.2W it's your battery:)

PRO
USA
#15  

Ok. Will change to 4.7 or 1, whichever I have.

One more stupid question. I want to wire with the button pushed, so it will probably be pushed most of the time. Will this be an issue or if I have it wired correctly with the right resistor I should be OK?

And some low level heat is expected just based on the way a resistor works, but it shouldn't be to hot to handle, correct?

PRO
USA
#16  

the above scenario:

  1. always open (Input Pin = GND)
  2. Pushed (Input Pin = 3.3 and power consumption)

If you keep the button pushed for a long time, makes sense a weak resistor to avoid battery draining, and is expected the heat dissipated but with 1/2 W or 1/4 resistors you can't fry anything:)

If you want a different logic e.g. always closed, I would work the logic at the script level, to avoid power consumption.

#17  

What are you doing with this button? Are you turning power on and off? What's it's purpose? What do you mean by "take action"?

PRO
USA
#18  

You can change the wiring to always "on":

User-inserted image

VCC = ideal 3.3v, no more than 5V. Resistor = same rules

@Dave: I believe you can use that logic for robot bumper switches, imagine the robot hits the wall.

If the idea is to monitor switches states, can be problematic if the verification code takes longer and misses a transition.

#19  

I am asking what the op is doing with this switch. I think it's important to find out to offer the right answer and solution. It's odd that he first had it attached to a digital port.

PRO
USA
#20  

Attached to digital port because that is what I thought it should be, but maybe not.

It is a stationary robot and I am using to determine if it gets lifted, knocked over, etc..

PRO
USA
#21  

@Dave you're right, my initial concern was the voltage on the red pin, before serious damage.

but i missed something:

Quote:

I have a switch that is always closed. If it becomes open that is a condition that I take some action.

I would change the wiring (post 19)

Quote:

It's odd that he first had it attached to a digital port.

I have 6 bumper switches, 3 front, 3 back, you have more digital ports than analog ports so why not ?

@dbeard Can you provide more details ? you have our attention:)

PRO
USA
#22  

It is a stationary robot and I am using to determine if it gets lifted, knocked over, etc..

PRO
USA
#23  

also, why change to D19 instead of D20?

Trying to understand.

PRO
USA
#24  

post 19 related to this conversation, not port 19.

#25  

Great thread guys,following this, in all my testing the sonar just can't always see everything when it moves at an angle there are blind spots to the sonar sensor.I have some contact switches salvaged from some wow wee toy robots that seem to work great! Nice to see other people working on these switches and sharing the info! For the newer people that don't have much electronics experience there should be a tutorial on basic wiring setup to the EZB-4,I'm sure there must be more info but the searching is time consuming sometimes.Although with me the answers always pop up quickly with the way EZ Robot web pages work,great job on those that designed the web page! :)

PRO
USA
#26  

PTP

I know you must be getting tired of me. But I have a question about post 19.

So there are 3 pins coming off of the EZB. Black Red White, with Black being ground, Red is VCC, and white is signal.

So based on your drawing the Switch gets connected to Black and White.

I put the resistor on Red and connect inline with the white pin.

PRO
Synthiam
#27  

Keep your existing setup and use any of the ADC ports instead. Your resistor wire mod will work fine if connected to ADC port.

  1. disconnect the cable/plug mod you showed in the picture from the Digital port

  2. connect the cable/plug mod to ADC port 0

Voila.

PRO
USA
#28  

ADC Port it is. Have plenty not in use.

It would be really cool if one of the electronics people would put together a tutorial on this. I think there is some assumed knowledge around electronics that some of us don't have, especially how this wiring stuff relates to the ports on the EzB.

PTP - Thanks for you time and hanging in there with me. I appreciate the help.

Also, thanks to everyone else who jumped in and added support.

#29  

@Ptp, "odd" may have been the wrong word for me to use. I should have said that attaching to the digital ports raised some questions in my mind as to how he was using this button and the best port to attach to. ;)

PRO
Synthiam
#30  

When the button is pressed, it's connecting 3.3v provided by the ADC to the white wire, which is ADC input. The code would have a threshold and look like..


If (GetADC(adc0) > 100)
  say("Button is pressed")
endif

#31  

Quote:

It would be really cool if one of the electronics people would put together a tutorial on this. I think there is some assumed knowledge around electronics that some of us don't have, especially how this wiring stuff relates to the ports on the EzB.

I agree. A tutorial on pull up/pull down resistors and why and where they are used would be great.

Alan