I am a beginner in Electronics and I am not able to understand why do we need to put this resistor(Resistor which comes after the switch) in this schematic? Does it save IC from current? but how ? Thanks
The role of resistor in this schematic
resistors
Related Solutions
First the switches' resistors. Moving one of them to the left side of the switches is pointless: it would just be between +6 V and ground and draw a constant low current. The switches will only see the 6 V, and not even know the resistor is there.
The 4511 is a CMOS IC, and these have the property of having a very high input impedance. So high that the voltage on it may vary all by itself if you leave it unconnected, what we call floating. At best it may change the number on your display, worst case the input may get damaged. When you close a switch this will make that input high, and then there's no problem.
But when the switch is open you want that input to go low. You can't simply connect the pin directly to ground, because closing the switch would short-circuit the power supply. So you use a resistor to bring the input to a defined, low value. When there's current flowing through a resistor it will cause a voltage drop due to Ohm's Law, but with the high-impedance input there's nowhere any current can come from, and then the voltage across the resistor will be zero, so that the input will be at 0 V level.
Here they use 10 kΩ resistors, which is OK. A lower resistance value will give you a more solid connection to ground, but also cause more current when you close the switch. Closing a switch will bring that input to +6 V, and then there will flow a current through the resistors: 6 V/ 10 kΩ = 0.6 mA. That's rather low, but in very low power circuits they may use higher resistance value; 100 kΩ is still OK, and will further reduce the current when switches are closed.
Then the display's resistors. If the LEDs would be all exactly the same you could indeed replace the 7 resistors by one on the cathode side. But this world is not perfect and ther may be small differences in LED voltage. If one LED has 2 V and its neighbor 1.95 V the current will go for the latter. LEDs do have an internal resistance which will balance the currents a little bit, but the difference in current, and hence brightness will still be there.
And as Oli noted it gets worse. The voltage has a negative temperature coefficient, which means that it decreases as temperature increases. The current causes power dissipation in the LED, which increases its temperature. Then the LED with the highest current, which already had the lowest voltage, will see its voltage decrease even further, so that the current increases even more. This may lead to what's called thermal runaway, and only the series resistor and the small balancing effect of the LEDs' internal resistance are there to stop it.
That's one reason to have a resistor for each LED. Another reason is that you won't always have the same number of LEDs on. If the display shows a "1" there's just 2 LEDs on, with "8" that's 7. Suppose you use a single resistor, and you want 10 mA through your LEDs. If they have a voltage drop of 2 V your resistor should be (7 V - 2 V)/(7 \$\times\$ 10 mA) = 71 Ω. Display an "8" and the LEDs will get 10 mA each. But for a "1" that will be higher. The voltage drop across the resistor is still 5 V, so the current will still be 70 mA, but this time for only 2 LEDs, that's 35 mA per LED. Not only will brightness vary for each other digit, but the 35 mA may well be higher than what's maximum allowed.
Giving each LED its own resistor solves all that. The current will be eather zero, or 10 mA, no matter how many other LEDs are on, and no matter the small differences in LED voltage.
The 10K and 1K resistors in the circuit form a voltage divider when the switch is pressed closed. With the +12V supply this divider nominally sets a transistor base bias voltage at about 1 volt. Very little base current flows due to the fact that the emitter of the NPN transistor is held above ground and as such the NPN base emitter voltage never gets high enough to let the transistor turn on. In a simulation of such circuit with a 2N3904 transistor model it shows that the presence of the 1K resistor keeps some bias across the LED of about 0.7V due to very low level currents in the transistor . If the 1K resistor is removed and when the switch is closed to GND then the bias across the LED drops to essentially zero because the transistor becomes fully turned off.
From a functional standpoint to get an LED to turn on and off from the switch there is no need to have the 1K resistor as relates to just this simple circuit. On the other hand if this circuit was used in a more complex system that had a monitor circuit across the LED looking for the above mentioned bias it could be an indicator that all the wiring from the switch to the LED was intact and in place. In an real burglar alarm system where the switch and LED may be located far apart this residual bias detection can play a role to ensure that the wiring has not been tampered with.
Best Answer
The resistor is called a pull-down resistor. If it were not there, when the switch is open there would be no defined voltage on the pin the switch is connected to. This is called a "floating" input and generally does not guarantee that the input is in one state or the other. By adding the resistor we know that the input will be low when the switch is open.