Yup. This end should point towards the ground if you want to go to space. For others, see the comic here: xkcd.com/1133/. You can buy the poster at: store.xkcd.com/products/up-goer-five-poster
I have struggled to understand the reasoning behind pullup values for specific applications (CAN, I2C, SPI, etc.). This video not only explains it well but it's much easier to understand than I thought. I never considered the length of the wire as a major factor until now. Thank you!
I actually grasped more about pullups in these 2 videos (a grand total of maybe 7mins) than in all those months I wasted trying to figure out how to pick them, reading from multiple sources.
If I need a fast response, I use 3k3 ohm and pull up to 3V3. Which give me a nice 1mA sink when using I2C, beware it uses lot's of power. Or just slow down the clock speed and use 10k pull up instead. Strong pull up is required if the boards have lot's of capacitance on the trace. For push button you can use 100k pull up and 1nF COG / NPO to ground.
Another consideration is attempting to help keep CLOSED switch contacts, "clean" by using a lower resistor value in order to pass higher current. The Phone company called it, sealing current" (also called wetting current or fritt current), usually 10 to 14 ma to keep contacts, splices and connections working instead of allowing them to become oxidized or dirty. Since the switch contacts sit OPEN most of the time, that constant sealing current won't flow as a preventative measure, though it may benefit from the micro arc as the button is pressed... Prolly not! lol
One thing you could definitely elaborate on, is what happens when your pull-up/down is too weak of a ratio from the internal resistor. Assuming they are pulling opposite directions, you get a voltage divider effectively. Then your resulting voltage can be referenced to the input high/low specifications to see if you are going to make the guaranteed voltage levels for a certain state.
Great video man. Learned the answer to my question in less than 4 minutes, and I have been on Google for probably an hour reading different sites and getting my head wrapped around this. Thanks. I look forward to watching more of your videos. 👍
It may be worth noting that a strong pull up resistor is useful when there is a weaker pull down resistor already in circuit (say, built-in to a chip.)
Oh man ! Good tutorial. I just came into electronics a few months back and never knew what a resist does in this particular application. Thank you for sharing. Any hopes on doing opamp tutorials 😊 Your explanations are very simple and easy to grasp.
I have not played with electronics since TTL but if the resistance is too high you may find false state changes due to noise can be a problem depending on your circuit layout. Floating a pin is a no-no.
If long button life is a project requirement, note that choosing 1k pull-ups produces 5mV for a standard arduino, the minimum amperage needed to assist with button contact cleaning.
Excellent ! Thank You, I'm re-wiring an E-bike Hub motor and needed to replace Both the Hall Sensors and the Pull Up's, I'm running 48VDC Li-Ion and was concerned the pull up might be to protect the SS41 Honeywell sensor, but no, That's Great, I have some of those in my Arduino kit :) Happy Saturday
I choose pull-up resistors based on the internal resistance of a pin. If it is low, I will rather use a small resistor value. Generally however you are right, a 4.7k is a good choice for almost all applications.
Just found your channel and I absolutely love everything. I have a question.. I have a circuit that constantly turns on and off. Intermittent power is what I thought at first. However, when I touch a point on the board with my tweezers, the circuit turns on and stays on. I measured the frequency of the oscillator and it keeps spiking causing the MCU to reset. Do you think a pull up or pull down resistor could smooth out the waveform preventing random resets? Or, is it because of the additional capacitance from my body and tweezers causing the waveform to smooth out and become stable preventing random resets?
Thank you for the video. I had guessed the reasons for most of this in working with things, but nice to actually solidify it from guess work to knowledge. I normally use which ever resistor I find first. Hehe
Your numbers have me worried. If, as you suggest (~ 1:58), we round up the internal pull-up resistor of the IC to 100kOhms, and then set our external pull-up resistor to 100kOhms (a value at one extreme of your range), then wouldn't the voltage at the input be VCC/2 (i.e. an non-permitted/ambiguous signal)? I would have thought, to make sure you get an unambiguous "logical 1" signal at the input of your IC, that the value of the external pull-up resistor would need to be, say, an order of magnitude smaller than the internal resistance of the IC. So, in this case, if we are rounding up the internal resistance of the IC to 100kOhms, then I would expect to have to set the external pull-up resistor to
@@AddOhms hmmm… that raises more questions in my head. Any chance you could do a more detailed discussion with schematic of internal resistor(s) included? Thx
Page 63: ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf. Upper-Left corner, you can see the built-in pull up resistor is connected to the PIN and to VCC (Through a transistor.)
Also, if your pin change it's mode from INPUT to OUTPUT ang goes LOW, you will blow pin or whole micro! Pins can change their modes for a moment at startup.
> Pins can change their modes for a moment at startup Almost all microcontrollers start-up with their pins as high-impedance (or INPUT). In the case of Arduino, care needs to be taken because Pin 13 is changed to an output pin to flash the LED. But that is by the bootloader and not a function of the microcontroller itself. The high-impedance state is one reason to use pull-up and pull-down resistors for other devices in the circuit. > if your pin change it's mode from INPUT to OUTPUT ang goes LOW, you will blow pin This is not a true statement all of the time. First, a pull-up or pull-down resistor will not save the pin in this case. Second, an OUTPUT to HIGH can destroy the pin just as easily as a LOW, depending on what is connected. Third, it entirely depends on what the pin is connected to.,
>Almost all microcontrollers start-up with their pins as high-impedance Did not know that, thanks for info. >> if your pin change it's mode from INPUT to OUTPUT ang goes LOW, you will blow pin >This is not a true statement all of the time. First, a pull-up or pull-down resistor will not save the >pin in this case. Second, an OUTPUT to HIGH can destroy the pin just as easily as a LOW, >depending on what is connected. Third, it entirely depends on what the pin is connected to. I agree. What I meant is 1K pull-up will limit 5V to nice and safe 5mA or so. Still a problem if pin becomes OUTPUT HIGH and button is pressed (it happens in development :))
The scope is a Rohde and Schwarz RTM3004: www.rohde-schwarz.com/us/product/rtm3000-productstartpage_63493-427459.html. Next to it is a Rohde and Schwarz FPC1500 Spectrum Analyzer: www.rohde-schwarz.com/us/product/fpc-productstartpage_63493-542324.html
Thank you very much, my wires from a limit switch are pretty long and everytime the motor kicks on I get a false signal. The internal pull ups are just not strong enough, even the 10k external. I've been chasing this for a week, thanks.
A 10nF capacitor from signal to ground might well. It does have the negative trade-off of slowing down the edge of the signal, so the switch does not activate as fast, but we are talking less than nanosecond difference. If it cleans up the noise, it might be worth it.
@@AddOhms Wow, yes I can see how a capacitor would help, it would cushion, absorb the pulse from the magnetic wave. Let me explain what I have, it is a parts feeder with a small 12v motor on it. It is controlled with a inductive proximity sensor. This system is completely SEPARATE from the RPI and the limit switches. Every time the proximity sensor kicks on the motor I get the false signal to the pi. The motor and sensor is directly above the wires for the RPi. Going with the external pull up, and changing to the 1k from 10 has eliminated all most all the false signals but I am still getting a few false so will definitely try the capacitor from the feed wire to the ground and let you know how it works. I have thought about using a relay between the limit switch and the RPi but this would be simpler. It is sure nice to have someone who know what they are talking about reply. I have watched a dozen videos and yours is the first to explain why you need a stronger pull up, so thanks so much for your time. Steve
The capacitor is always “assumed” in the circuit. See the “Art of Electronics” text book. They are omitted from circuit diagrams to de-clutter the schematics but should never be omitted from real world circuits. It is a long standing protocol understood by electronics engineers. Unfortunately, most hobbyists find out the hard way. ( and to be clear, that includes me! Till I read the book, corrected my circuits and now have reliable circuits) . Unless of course you want random signals every time you switch the room lights on and off! Then in which case leave out the bypass capacitors.
follow-up questions (critical for actually selecting a resistor): is the POWER RATING of the resister relevant? Obviously, the VOLTAGE RATING needs to be higher than the voltage being used, but is there a minimum power-requirement (which becomes a factor for small SMT resistors). Or is this essentially an irrelevant issue for pull-up/pull-down resistors?
Most resistors don't have a voltage rating. If they did, almost none on the market wouldn't be high enough for a microcontroller. Given that not even a few milliamps (at best) go through a pull-up resistor, 5 seconds with Ohm's Law would tell you that their power rating barely matters.
@@AddOhms All the resistor I use for SMT (Uniroyal), do have a "max working voltage" rating (or is that for something else and not what I I think it's for)? Whereas I do pay attention to resistor power-rating (for other functions), I've never really known if I can just ignore it for pull-up/pull-down.
I have 16 ad9833 spi modules I want to connect to a mux. Can I use pull-up resistors on the module side of the mux to keep the chip select high the use the mux to select the cs to send it low?
Yes. it's usually a good idea to use a pull-up (or down if it is active high) on chip select regardless. That way the signal stays at a known state, especially when a microcontroller or other chip is initialized at reset/power-on.
Hi..My comment is long after this video so ..if and when you have time feel free to answer. I am trying to utilise A6 and A7 pins of arduino Pro mini (to save other pins) because A6 and A7 are strictly only ANALOG INPUT pins (no output no internal pull up) And as my project is with batteries i am following this advice and try to put big resistor. (even if the buttons only pressed a small amoynt of time ..but lets suppose that we are pressing button for large times) And now i put a 1 M resistor (that in multimeter shows as 0.6 M=600 K But i am getting this output 365 =buttoon unpressed -no resistor 319 321 1023 =i connected the 600 K resistor 1023 1019 1008 1015 1009 0 =push the button 0 1001 =release button 1022 1005 977 =disconnect resistor 896 1008 982 862 998 946 241 312 306 335 353 -------------------------------------------------- So my question is Why it is working with such a big resistor? I mean that can i safelly use this resistor to analogRead and consider Pressed when 512 ??? Or is it working only now,here oin my home that maybe i have no intefrerences?
If you measure the resistor while holding the leads, your body's 400-500 kiloohm resistance is in parallel with the 1 Megohm. So the reading is going to be wrong. 1 Meg is an extremely weak pull-up but it is slightly better than no pull-up.
@@AddOhms Yes !...i was holding the resistor!!! Ok...i will try it again and try it to understand. But to avoid overheatting you with questions... ..Just in case....when i will release my beehive scale project running on batteries it will be better to use the maximum resistoir that you are proposing that is 100K . Right? (The A6,A7 and dig2) buttons will NOT be used almost at all. Meaning that the arduino will run on 'silent' mode with no need buttons and ONLY once per month may the pulled up buttons(A6,A7) going to be used for 5 minutes. So...do i have your 'licence' to proceed with 100 K pulling up? Aslo in a kind of thank you and giving you something back (even most propably its not your need) I am giving you the 'almost released ' project of sms beehive scale (open source) And feel free to comment ...and share...if you want And again... THANK YOU FOR YOUR PRECIUS time!!!!!! jimakoskx.blogspot.com/2020/08/sms-beehive-scale-arduino-2-load.html
@@AddOhms This is a confusing answer for me ...because in this video you were saying that we can go up to 100 K if we are on batteries. Anyway.....research is volatile so...i will keep your last proposion of 10K.!!! Goodmorning from locked down Athens!
Thanks...succinct and clear. I have a variation of the problem: Let's say I want to have a pullup on an EEPROM write-protect pin. The Vcc for the EEPROM is 5VDC. The GPIO from the MCU will drive 0 or 1 (0 or 3.3V) per software. I make the GPIO output push-pull. What sorts of information do I start looking at to make the situation safe? The GPIO pin is allowed to sink/source 25mA. If I make the pullup 10K, and the GPIO is 3.3V when '1', then the current would be .33mA--seems safe. But, I'm pulling up 5V via the 10K R. So, do I have to take into account Vcc? Is this the "way" to "think" about these kind of problems? Regards, just a software guy trying to make sense of it all. I very much appreciate your video lessons.
It will vary. What is your input pin. A transistor. A TTL chip, CMOS. Micro controller, CPU. There are formulas that you can use to give you a range, because the 0 and 1 logic work in voltage ranges. Example for a pull up is Rmax = Vcc - Vih / Iih and Ir= Vcc/R. When in doubt 10K seems to do the trick. Not too high and not too low. THere are also formulas for Lower range too. So you can get a range of resistance to use.
can someone explain to me .. if we have a pull up resistor like in the video, isn't the pin in this case always connected to 5 volts? even when we press the button, it is still connected to the 5 volts(and ground as well). so, I just can't understand, how does the pin read the voltage exactly ?
Ohm’s and Kirchhoff’s laws. When the button is pushed there is path for current to flow from +V to ground. Current through a resistor creates a voltage drop, in this case 5 volts. So one side is at 5 and the other is 0 because it is dropping 5 volts. the side with 0 is connected to the pin
@@AddOhms Thank you! Guess I have to check keirchoff's laws again. But I am a bit confused. It is like when we don't push the button there will be no closed loop and thus we don't use kirchoff's law, but when we push the button that's like a closed loop from the 5Volts to ground, which means we apply kirchoff's laws. Am I right?
@@AddOhms um .. got more confused. Then why don't we say that there's a voltage drop when the switch is open, and it will also read LOW? Edit: is it because no current is flowing through the resistor? since it's not connected to ground.
@@AddOhms why does this damage the supply?. in my head. current flows from source to ground. why would having no resistor damage the supply?. is ground not just a way to get the current flowing?.. im genuinely perplexed because having strong pressure on a hose doesn't destroy the faucet. so having voltage with no resistor how can it damage the source?.
Current flows in a closed loop. Ground is not a thing, it is a reference point and a return path for electric fields. When a short circuit happens, nearly infinite current flows causing everything to heat up, meaning the smallest resistive device in the circuit is going to burn on. Usually a transistor.
I don't know how to answer that question. Resistor for what? In that circuit, the only place I could see a pull-up resistor would be on the gate. And as I explained in this video, the exact value is not critical.
Hey! I found your videos very useful and educative for me..but can you please expalin me the difference between ground and negative.. It would be of great help.. Thanks.
Ground is a reference point, also called common. Voltages are relative and so for most of a circuit’s analysis voltage is referenced to its “ground.” Positive voltage are positive to that reference, and negative is, well, negative. In digital circuits negative is sometimes called ground since ground is 0 volts. Also probably because early digital stuff was powered by a battery which has positive and negative terminals. A battery floating in the air doesn’t have a ground reference, so it is referenced to itself, which is why you don’t call one of the terminals ground.
But I am a beginner in the field of elctronics and i am not able to to understand the terms you have used so can you explain it through a video... Please I am very Desperate to know the difference between the two.. Thanks.
Thank you really much for that tutorial! It really helped me understand this! Picket 50kOhm for the Remote control i was working on and its working fine! PS: Love your t-shirt xD
This is my question too (read through comments to see if it was asked). I understand all the pull up/pull down concepts from your other videos). What I don't understand from here and reading elsewhere is the "why" part. If the switch is open, what exactly is a pull up resistor doing physically to "pull up" the pin to "true" when connected to 5V.
Hi, suppose if I put a 100 ohm pullup resistor with 3.3 volt. and the pin connected to this 100 ohm have the max current capacity of 1 mA, will it damage the pin or microcontroller??
@@AddOhms Hi Addohms, Can you please explain? Here total current in the resistor will be 33mA, right. But the pin is only having a capacity of 1mA. But how is it not gonna damage it?
Indeed, with capacitance added (assume the switch is a MOSFET with 25pf), then in series with 10kOhms, the constant time of 3RC gives something which can't exceed much higher than 1MHz.
I claim no expertise, but I came up with this deeper explanation. The changes of state when the pin is flapping in the breeze comes from emf induced voltages. These waves of emf of whatever frequency are likely to induce currents on the line (i.e., and antenna) which translate in to voltages along the line. Not volts, but rather microvolts, but this voltage has no where to go so it rushes back and forth from one end of the line to the other till it equalizes and/or dissipates in the very low wire resistance. But wait, along comes another pulse and another pulse and sooner or later you've got enough to get the microcontroller's attention and seemingly random state changes. So we stick in a pull-up or pull-down resistor depending on the default state we want on the pin. But those induced currents are still creating voltages that want to equalize, now with the supply or ground via the resistor. But resistors slow the pixies so if your pull-up resistor is to large the currents zipping back and forth on the line can add up to a voltage that gets the microcontroller's attention before they can bleed off. So you reduce it down to the lower values, but then you have to factor in the power used when the button is pushed as there will be a current through the resistor.
Technically you should use the largest possible resistor while preventing bad behavior to keep the wasted current as low as possible. If it works with a 100k why would you put 1k? The problem is to find if there's a bad behavior from time to time (if R is too high and the bus is only connected to open collector type drivers then that will slow down the raising edges). Also you don't want to spend time on that if it's not battery operated. So I guess the trick could be to test with 100k and reduce that until it works. Then add another 10x (3x on battery) safety margin for you final design so you know that with variations (in temperature, batch of components, drift over time...) it will still work. You can justify a smaller margin on battery because reliability is useless without power...
@@AddOhms Replaced it with a 4.7k resistor, but it still catches interference from the air conditioner... Much less often, though... And it somehow detects a button press if I simply touch 5v lead of the button with my multimeter probe with the other probe not even connected... I guess the only way now is to increase the size of the capacitor, and add a Schmitt trigger... Oh, wait... (Why didn't I check it in the first place) Maybe the capacitor is simply dead?.. I don't have an oscilloscope, and I want one now... It'll make debugging a lot easier... ADDITION: Scrap everything I said above... It turns out, i don't have a resistor in my RC filter - I've connected both input and output to the same resistor lead on a breadboard by accident, creating a useless resistor... Ouch...
From the title and your introduction, I was hoping to actually get the math behind choosing a pull-up resistor. Sadly, as all most sources, you didn't actually answer that question
I2C is one of the few cases where the math sometimes matter: ruclips.net/video/n2eaY51rkJQ/видео.html (and even when you do the math, the range is massive)
@@AddOhms Thanks for the quick reply and for the link to the more detailed explanation. The answer seems to be: Start with the recommended, measure and experiment.
It still isn't clear to me why you can't just use a wire. When the button is pressed there doesn't seem to be any difference in the circuit whether you are using a resistor or wire. There is still a path for the electricity to flow. All the video says is "that is a short circuit and that is bad" with no indication why it is bad, the electricity is following the path you want when you press the button, why would that be bad?
What a cop-out answer. You have a shirt that says you're good at math. Where's the formula? If you're running I2C in Fast+ and you have a moderate Cb, then you better do the calculation or you'll be stuck in Standard mode.
Was that the "Up Goer 5" poster on the wall? :-)
Yup. This end should point towards the ground if you want to go to space. For others, see the comic here: xkcd.com/1133/. You can buy the poster at: store.xkcd.com/products/up-goer-five-poster
Great explanation and that was a fancy "cut to second camera" feature!
Also look at your BOM if you are not using a 1K resistor anywhere else but you using lots of 5K resistors just go ahead use the 5K resistor.
I have struggled to understand the reasoning behind pullup values for specific applications (CAN, I2C, SPI, etc.). This video not only explains it well but it's much easier to understand than I thought. I never considered the length of the wire as a major factor until now. Thank you!
I actually grasped more about pullups in these 2 videos (a grand total of maybe 7mins) than in all those months I wasted trying to figure out how to pick them, reading from multiple sources.
Thank you! Finally a clear, understandable explanation of what a pull-up resistor is. I appreciate your time and effort!
If I need a fast response, I use 3k3 ohm and pull up to 3V3. Which give me a nice 1mA sink when using I2C, beware it uses lot's of power. Or just slow down the clock speed and use 10k pull up instead.
Strong pull up is required if the boards have lot's of capacitance on the trace.
For push button you can use 100k pull up and 1nF COG / NPO to ground.
thanks!
Another consideration is attempting to help keep CLOSED switch contacts, "clean" by using a lower
resistor value in order to pass higher current. The Phone company called it, sealing current"
(also called wetting current or fritt current), usually 10 to 14 ma to keep contacts, splices and
connections working instead of allowing them to become oxidized or dirty. Since the switch
contacts sit OPEN most of the time, that constant sealing current won't flow as a preventative
measure, though it may benefit from the micro arc as the button is pressed... Prolly not! lol
I always send people here when they start working with micro-controllers. you do the BEST job at elaborating this for people new to it.
Thank you! I appreciate the support.
This is so good. Finally somebody who actually explains the values.
Great, clear, no filler explanation. Loved it!
I watch electronic engineering tutorials all the time. AddOhms tutorials are the best.
Your videos/explanations are always so clear, well illustrated and easy to follow. Very helpful!
3:32 "Pick the resistor that works" really should be "pick the resistor that works that's already on your BOM"
Your explanations are so intuitive. Brilliant.
One thing you could definitely elaborate on, is what happens when your pull-up/down is too weak of a ratio from the internal resistor. Assuming they are pulling opposite directions, you get a voltage divider effectively. Then your resulting voltage can be referenced to the input high/low specifications to see if you are going to make the guaranteed voltage levels for a certain state.
I just asked the same question and got told that your/my assumption is incorrect that the internal and external resistors are in series
Bro. You actually helped me to understand this topic in 4 mins! My lecturer isn't that great I see :P
2021, i just found your channel, you explain very clearly, i hope you come back and keep making more videos like these.
Usually I just pick 10k, unless I can get away with the MCU-internal pull-ups/pull-downs. 1k is almost always an overkill.
Great video man. Learned the answer to my question in less than 4 minutes, and I have been on Google for probably an hour reading different sites and getting my head wrapped around this. Thanks. I look forward to watching more of your videos. 👍
It may be worth noting that a strong pull up resistor is useful when there is a weaker pull down resistor already in circuit (say, built-in to a chip.)
Oh man ! Good tutorial. I just came into electronics a few months back and never knew what a resist does in this particular application. Thank you for sharing. Any hopes on doing opamp tutorials 😊
Your explanations are very simple and easy to grasp.
Yes. Op-Amps are on the list.
I have not played with electronics since TTL but if the resistance is too high you may find false state changes due to noise can be a problem depending on your circuit layout. Floating a pin is a no-no.
If long button life is a project requirement, note that choosing 1k pull-ups produces 5mV for a standard arduino, the minimum amperage needed to assist with button contact cleaning.
Excellent ! Thank You, I'm re-wiring an E-bike Hub motor and needed to replace Both the Hall Sensors and the Pull Up's, I'm running 48VDC Li-Ion and was concerned the pull up might be to protect the SS41 Honeywell sensor, but no, That's Great, I have some of those in my Arduino kit :) Happy Saturday
very good explanation! I am still new to electronics and this helps way more than books..
Great tutorial...Your T-shirt is spot on.
That made my life a whole lot easier. Thank you!
I choose pull-up resistors based on the internal resistance of a pin. If it is low, I will rather use a small resistor value. Generally however you are right, a 4.7k is a good choice for almost all applications.
Thanks for the video, perfectly clear. And most of all: great shirt!!
Could you do a video on optical encoders and using pull-up resistors on the AB lines
Just found your channel and I absolutely love everything. I have a question.. I have a circuit that constantly turns on and off. Intermittent power is what I thought at first. However, when I touch a point on the board with my tweezers, the circuit turns on and stays on. I measured the frequency of the oscillator and it keeps spiking causing the MCU to reset. Do you think a pull up or pull down resistor could smooth out the waveform preventing random resets? Or, is it because of the additional capacitance from my body and tweezers causing the waveform to smooth out and become stable preventing random resets?
Sounds like you have a grounding issue
Thank you for the video. I had guessed the reasons for most of this in working with things, but nice to actually solidify it from guess work to knowledge. I normally use which ever resistor I find first. Hehe
You got my attention at the first 20 seconds. Its exactly what I want to know lol
Short and sweet !
Will capacitor between input pin and ground make any diference when using weak pull-up?
Your numbers have me worried. If, as you suggest (~ 1:58), we round up the internal pull-up resistor of the IC to 100kOhms, and then set our external pull-up resistor to 100kOhms (a value at one extreme of your range), then wouldn't the voltage at the input be VCC/2 (i.e. an non-permitted/ambiguous signal)? I would have thought, to make sure you get an unambiguous "logical 1" signal at the input of your IC, that the value of the external pull-up resistor would need to be, say, an order of magnitude smaller than the internal resistance of the IC. So, in this case, if we are rounding up the internal resistance of the IC to 100kOhms, then I would expect to have to set the external pull-up resistor to
External pull-up resistors would be in parallel to the internal pull-ups. Not in series.
@@AddOhms hmmm… that raises more questions in my head. Any chance you could do a more detailed discussion with schematic of internal resistor(s) included? Thx
It’s not that complicated. It’s just a resistor.
Page 63: ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf. Upper-Left corner, you can see the built-in pull up resistor is connected to the PIN and to VCC (Through a transistor.)
Great video. Very clear and concise. Thanks
Very nice tutorial, thanks for uploading!!
You should make your 2 videos about Pull-up resistors to a single one. this one here answers all my questions i had after the other one.
Interesting idea, but that's not how youtube... works ...
Also, if your pin change it's mode from INPUT to OUTPUT ang goes LOW, you will blow pin or whole micro! Pins can change their modes for a moment at startup.
> Pins can change their modes for a moment at startup
Almost all microcontrollers start-up with their pins as high-impedance (or INPUT). In the case of Arduino, care needs to be taken because Pin 13 is changed to an output pin to flash the LED. But that is by the bootloader and not a function of the microcontroller itself. The high-impedance state is one reason to use pull-up and pull-down resistors for other devices in the circuit.
> if your pin change it's mode from INPUT to OUTPUT ang goes LOW, you will blow pin
This is not a true statement all of the time. First, a pull-up or pull-down resistor will not save the pin in this case. Second, an OUTPUT to HIGH can destroy the pin just as easily as a LOW, depending on what is connected. Third, it entirely depends on what the pin is connected to.,
>Almost all microcontrollers start-up with their pins as high-impedance
Did not know that, thanks for info.
>> if your pin change it's mode from INPUT to OUTPUT ang goes LOW, you will blow pin
>This is not a true statement all of the time. First, a pull-up or pull-down resistor will not save the >pin in this case. Second, an OUTPUT to HIGH can destroy the pin just as easily as a LOW, >depending on what is connected. Third, it entirely depends on what the pin is connected to.
I agree. What I meant is 1K pull-up will limit 5V to nice and safe 5mA or so. Still a problem if pin becomes OUTPUT HIGH and button is pressed (it happens in development :))
What brand is the oscilloscope that is on the table directly behind you?
The scope is a Rohde and Schwarz RTM3004: www.rohde-schwarz.com/us/product/rtm3000-productstartpage_63493-427459.html.
Next to it is a Rohde and Schwarz FPC1500 Spectrum Analyzer: www.rohde-schwarz.com/us/product/fpc-productstartpage_63493-542324.html
Thanks for the great vid! Very straightforward.
Thank you very much, my wires from a limit switch are pretty long and everytime the motor kicks on I get a false signal. The internal pull ups are just not strong enough, even the 10k external. I've been chasing this for a week, thanks.
A 10nF capacitor from signal to ground might well. It does have the negative trade-off of slowing down the edge of the signal, so the switch does not activate as fast, but we are talking less than nanosecond difference. If it cleans up the noise, it might be worth it.
@@AddOhms Wow, yes I can see how a capacitor would help, it would cushion, absorb the pulse from the magnetic wave.
Let me explain what I have, it is a parts feeder with a small 12v motor on it. It is controlled with a inductive proximity sensor. This system is completely SEPARATE from the RPI and the limit switches. Every time the proximity sensor kicks on the motor I get the false signal to the pi. The motor and sensor is directly above the wires for the RPi. Going with the external pull up, and changing to the 1k from 10 has eliminated all most all the false signals but I am still getting a few false so will definitely try the capacitor from the feed wire to the ground and let you know how it works.
I have thought about using a relay between the limit switch and the RPi but this would be simpler. It is sure nice to have someone who know what they are talking about reply. I have watched a dozen videos and yours is the first to explain why you need a stronger pull up, so thanks so much for your time. Steve
The capacitor is always “assumed” in the circuit. See the “Art of Electronics” text book. They are omitted from circuit diagrams to de-clutter the schematics but should never be omitted from real world circuits. It is a long standing protocol understood by electronics engineers. Unfortunately, most hobbyists find out the hard way. ( and to be clear, that includes me! Till I read the book, corrected my circuits and now have reliable circuits) . Unless of course you want random signals every time you switch the room lights on and off! Then in which case leave out the bypass capacitors.
Thanks, man! I was really struggling to undertand this :)
Great video!
follow-up questions (critical for actually selecting a resistor): is the POWER RATING of the resister relevant? Obviously, the VOLTAGE RATING needs to be higher than the voltage being used, but is there a minimum power-requirement (which becomes a factor for small SMT resistors).
Or is this essentially an irrelevant issue for pull-up/pull-down resistors?
Most resistors don't have a voltage rating. If they did, almost none on the market wouldn't be high enough for a microcontroller. Given that not even a few milliamps (at best) go through a pull-up resistor, 5 seconds with Ohm's Law would tell you that their power rating barely matters.
@@AddOhms All the resistor I use for SMT (Uniroyal), do have a "max working voltage" rating (or is that for something else and not what I I think it's for)?
Whereas I do pay attention to resistor power-rating (for other functions), I've never really known if I can just ignore it for pull-up/pull-down.
Yes, agree value is a check pint.
Thank you!
Great video as always.
Which application do you use for the drawings in the videos?
Primarily After Effects and Illustrator, with an assist from Audition, Photoshop, and Premiere.
I have 16 ad9833 spi modules I want to connect to a mux. Can I use pull-up resistors on the module side of the mux to keep the chip select high the use the mux to select the cs to send it low?
Yes. it's usually a good idea to use a pull-up (or down if it is active high) on chip select regardless. That way the signal stays at a known state, especially when a microcontroller or other chip is initialized at reset/power-on.
You could use pull down resistors and wire the buttons to the positive rail.
Depends on what you're doing, and the type of switch.
Sorry but could you explain 1:16? Why is a short-circuit between the supply and ground bad? What will this do? Total electronics newbie here
Since short circuits destroy things, most people consider them bad.
GREAT. I need more.... Great explanation. Thx for your vid!
after watching many videos , just now i understand this idea , Thank you brother
Hi..My comment is long after this video so ..if and when you have time feel free to answer.
I am trying to utilise A6 and A7 pins of arduino Pro mini (to save other pins)
because A6 and A7 are strictly only ANALOG INPUT pins (no output no internal pull up)
And as my project is with batteries i am following this advice and try to put big resistor.
(even if the buttons only pressed a small amoynt of time ..but lets suppose that we are pressing button for large times)
And now i put a 1 M resistor (that in multimeter shows as 0.6 M=600 K
But i am getting this output
365
=buttoon unpressed -no resistor
319
321
1023
=i connected the 600 K resistor
1023
1019
1008
1015
1009
0
=push the button
0
1001
=release button
1022
1005
977
=disconnect resistor
896
1008
982
862
998
946
241
312
306
335
353
--------------------------------------------------
So my question is
Why it is working with such a big resistor?
I mean that can i safelly use this resistor to analogRead and consider
Pressed when 512
???
Or is it working only now,here oin my home that maybe i have no intefrerences?
If you measure the resistor while holding the leads, your body's 400-500 kiloohm resistance is in parallel with the 1 Megohm. So the reading is going to be wrong.
1 Meg is an extremely weak pull-up but it is slightly better than no pull-up.
@@AddOhms Yes !...i was holding the resistor!!!
Ok...i will try it again and try it to understand.
But to avoid overheatting you with questions...
..Just in case....when i will release my beehive scale project running on batteries
it will be better to use the maximum resistoir that you are proposing
that is 100K .
Right?
(The A6,A7 and dig2) buttons will NOT be used almost at all.
Meaning that the arduino will run on 'silent' mode with no need buttons
and ONLY once per month may the pulled up buttons(A6,A7) going to be used
for 5 minutes.
So...do i have your 'licence' to proceed with 100 K pulling up?
Aslo in a kind of thank you and giving you something back
(even most propably its not your need)
I am giving you the 'almost released ' project of sms beehive scale
(open source)
And feel free to comment ...and share...if you want
And again...
THANK YOU FOR YOUR PRECIUS time!!!!!!
jimakoskx.blogspot.com/2020/08/sms-beehive-scale-arduino-2-load.html
I wouldn't recommend anything over 10K for a pull-up.
@@AddOhms This is a confusing answer for me ...because in this video you were saying that we can go up to 100 K if we are on batteries.
Anyway.....research is volatile so...i will keep your last proposion of 10K.!!!
Goodmorning from locked down Athens!
Love your Saturn V "blueprint"
It is xkcd's Up Goer Fiver: store.xkcd.com/products/up-goer-five-poster
Thank you! I finally get it!
Marvelous Video.
Thanks...succinct and clear. I have a variation of the problem: Let's say I want to have a pullup on an EEPROM write-protect pin. The Vcc for the EEPROM is 5VDC. The GPIO from the MCU will drive 0 or 1 (0 or 3.3V) per software. I make the GPIO output push-pull. What sorts of information do I start looking at to make the situation safe? The GPIO pin is allowed to sink/source 25mA. If I make the pullup 10K, and the GPIO is 3.3V when '1', then the current would be .33mA--seems safe. But, I'm pulling up 5V via the 10K R. So, do I have to take into account Vcc?
Is this the "way" to "think" about these kind of problems? Regards, just a software guy trying to make sense of it all. I very much appreciate your video lessons.
If the MCU is 3v3, then it probably isn’t 5V tolerant. So pull-up the enable to 3v 3.
It will vary. What is your input pin. A transistor. A TTL chip, CMOS. Micro controller, CPU. There are formulas that you can use to give you a range, because the 0 and 1 logic work in voltage ranges. Example for a pull up is Rmax = Vcc - Vih / Iih and Ir= Vcc/R. When in doubt 10K seems to do the trick. Not too high and not too low. THere are also formulas for Lower range too. So you can get a range of resistance to use.
Excellent
This is so confusing, I cant still wrap my head around this pull up/pull down resistors arrrggg
can someone explain to me .. if we have a pull up resistor like in the video, isn't the pin in this case always connected to 5 volts? even when we press the button, it is still connected to the 5 volts(and ground as well). so, I just can't understand, how does the pin read the voltage exactly ?
Ohm’s and Kirchhoff’s laws. When the button is pushed there is path for current to flow from +V to ground. Current through a resistor creates a voltage drop, in this case 5 volts. So one side is at 5 and the other is 0 because it is dropping 5 volts. the side with 0 is connected to the pin
@@AddOhms Thank you! Guess I have to check keirchoff's laws again. But I am a bit confused. It is like when we don't push the button there will be no closed loop and thus we don't use kirchoff's law, but when we push the button that's like a closed loop from the 5Volts to ground, which means we apply kirchoff's laws. Am I right?
You always apply them. There is always a loop.
@@AddOhms um .. got more confused. Then why don't we say that there's a voltage drop when the switch is open, and it will also read LOW?
Edit: is it because no current is flowing through the resistor? since it's not connected to ground.
an open switch doesn’t “drop” the voltage. an open switch has the same voltage on both sides. Kirchhoff’s law.
Why is it bad for the supply to short the ground?
Is it because it damages the ground? If this were the case?
It damages the supply and anything between it and ground.
Shorts are bad.
@@AddOhms why does this damage the supply?. in my head. current flows from source to ground.
why would having no resistor damage the supply?.
is ground not just a way to get the current flowing?..
im genuinely perplexed because having strong pressure on a hose doesn't destroy the faucet.
so having voltage with no resistor how can it damage the source?.
Current flows in a closed loop. Ground is not a thing, it is a reference point and a return path for electric fields. When a short circuit happens, nearly infinite current flows causing everything to heat up, meaning the smallest resistive device in the circuit is going to burn on. Usually a transistor.
Why do you have a grill oven in your cupboard?
It's a toaster oven that I use for reflowing PCBs. You can see it in action in this video: ruclips.net/video/mY8NE3OuPfM/видео.html
Keep up the good work. Nicely explained. What resistor do you recommend for P channel mosfet with 20v battery supply ?
I don't know how to answer that question. Resistor for what? In that circuit, the only place I could see a pull-up resistor would be on the gate. And as I explained in this video, the exact value is not critical.
good add-ohms !!! good video! I can't wait to see the raspberry pi project!! cheers!!
Hey! I found your videos very useful and educative for me..but can you please expalin me the difference between ground and negative.. It would be of great help.. Thanks.
Ground is a reference point, also called common. Voltages are relative and so for most of a circuit’s analysis voltage is referenced to its “ground.” Positive voltage are positive to that reference, and negative is, well, negative. In digital circuits negative is sometimes called ground since ground is 0 volts. Also probably because early digital stuff was powered by a battery which has positive and negative terminals. A battery floating in the air doesn’t have a ground reference, so it is referenced to itself, which is why you don’t call one of the terminals ground.
Thanks man.
But I am a beginner in the field of elctronics and i am not able to to understand the terms you have used so can you explain it through a video... Please I am very Desperate to know the difference between the two.. Thanks.
Thank you really much for that tutorial! It really helped me understand this! Picket 50kOhm for the Remote control i was working on and its working fine!
PS: Love your t-shirt xD
it was so simole and useful
What counts as a long I2c line?
More than 12 inches / 30 cm. Remember I2C = IIC which was meant for Inter-IC communication. It was meant for talking to things on the same PCB.
Thank you for the reply. Today it is often used for sensors that are mounted away from the PCB.@@AddOhms
how to calculate mosfet gate resistor
nice job
How does the pull up resistor along with 5v supply solve the problem or EMI.
This is my question too (read through comments to see if it was asked). I understand all the pull up/pull down concepts from your other videos). What I don't understand from here and reading elsewhere is the "why" part. If the switch is open, what exactly is a pull up resistor doing physically to "pull up" the pin to "true" when connected to 5V.
Hi,
suppose if I put a 100 ohm pullup resistor with 3.3 volt. and the pin connected to this 100 ohm have the max current capacity of 1 mA, will it damage the pin or microcontroller??
No
@@AddOhms Hi Addohms,
Can you please explain? Here total current in the resistor will be 33mA, right. But the pin is only having a capacity of 1mA. But how is it not gonna damage it?
The pin in parallel with the resistor. It is high impedance. Almost no current goes into it.
best ever, thx.
Or take ohms in case of fast signals, and/or long wires. :D
Indeed, with capacitance added (assume the switch is a MOSFET with 25pf), then in series with 10kOhms, the constant time of 3RC gives something which can't exceed much higher than 1MHz.
Thanks
I normally use 10K. Just seems to work great for me. Tried 1M once but was unsuccessful. 10K are common enough.
I claim no expertise, but I came up with this deeper explanation.
The changes of state when the pin is flapping in the breeze comes from emf induced voltages. These waves of emf of whatever frequency are likely to induce currents on the line (i.e., and antenna) which translate in to voltages along the line. Not volts, but rather microvolts, but this voltage has no where to go so it rushes back and forth from one end of the line to the other till it equalizes and/or dissipates in the very low wire resistance. But wait, along comes another pulse and another pulse and sooner or later you've got enough to get the microcontroller's attention and seemingly random state changes.
So we stick in a pull-up or pull-down resistor depending on the default state we want on the pin. But those induced currents are still creating voltages that want to equalize, now with the supply or ground via the resistor. But resistors slow the pixies so if your pull-up resistor is to large the currents zipping back and forth on the line can add up to a voltage that gets the microcontroller's attention before they can bleed off. So you reduce it down to the lower values, but then you have to factor in the power used when the button is pushed as there will be a current through the resistor.
Спасибо, всё понятно.
Thanks Adam!
Who is Adam?
Great video, thank you for sharing your knowledge. :-) subscribed for more.
Can you explain a pull up and pull down crank sensor
No clue what that is.
why does it work like an "open" when I use resistor +100K ohms?
An open is super high resistance. 100K is high resistance. So 100K acts like an open.
Nice and simple. Just like me! Ha ha, thanks for the great explanation James. Keep up these videos and I may be able to repair things again!
Technically you should use the largest possible resistor while preventing bad behavior to keep the wasted current as low as possible. If it works with a 100k why would you put 1k?
The problem is to find if there's a bad behavior from time to time (if R is too high and the bus is only connected to open collector type drivers then that will slow down the raising edges). Also you don't want to spend time on that if it's not battery operated. So I guess the trick could be to test with 100k and reduce that until it works. Then add another 10x (3x on battery) safety margin for you final design so you know that with variations (in temperature, batch of components, drift over time...) it will still work.
You can justify a smaller margin on battery because reliability is useless without power...
Nice
👍👍
1k pullup pulldown is standard for me tho
hahah, nice T-shirt
Why is so much of electronics just picking random value components?
Because in engineering there is no best or perfect answer. There are always trade-offs to consider. Some are critical, some are not.
I used 50K, and my "button" thinks it's been pressed every time a relay in my air conditioner opens...
Good example of why a very large value (above 10K) is considered a "weak" pull-up.
@@AddOhms Replaced it with a 4.7k resistor, but it still catches interference from the air conditioner... Much less often, though... And it somehow detects a button press if I simply touch 5v lead of the button with my multimeter probe with the other probe not even connected...
I guess the only way now is to increase the size of the capacitor, and add a Schmitt trigger... Oh, wait... (Why didn't I check it in the first place) Maybe the capacitor is simply dead?..
I don't have an oscilloscope, and I want one now... It'll make debugging a lot easier...
ADDITION: Scrap everything I said above... It turns out, i don't have a resistor in my RC filter - I've connected both input and output to the same resistor lead on a breadboard by accident, creating a useless resistor... Ouch...
Didn't know dana white is an electronics enthusiast
From the title and your introduction, I was hoping to actually get the math behind choosing a pull-up resistor. Sadly, as all most sources, you didn't actually answer that question
I2C is one of the few cases where the math sometimes matter: ruclips.net/video/n2eaY51rkJQ/видео.html
(and even when you do the math, the range is massive)
@@AddOhms Thanks for the quick reply and for the link to the more detailed explanation.
The answer seems to be: Start with the recommended, measure and experiment.
It still isn't clear to me why you can't just use a wire. When the button is pressed there doesn't seem to be any difference in the circuit whether you are using a resistor or wire. There is still a path for the electricity to flow. All the video says is "that is a short circuit and that is bad" with no indication why it is bad, the electricity is following the path you want when you press the button, why would that be bad?
Creating a short circuit from supply to ground damages the supply and everything between it.
What a cop-out answer. You have a shirt that says you're good at math. Where's the formula? If you're running I2C in Fast+ and you have a moderate Cb, then you better do the calculation or you'll be stuck in Standard mode.
ruclips.net/video/n2eaY51rkJQ/видео.html. Spoiler: do all math and end up with a ridiculous range.
thanks