Electronic – Arduino and resistors

arduinoresistors

So , hopefully this is my last question on this system
enter image description here

it's about the connections:

  1. about the transistor, i want to use it like a switch, so i wanted to know how to determine the value of the resistance needed before the base, i searched a bit and found this on resistance , IC, and transistors half way through the page there are some calculations, according to them i need about 250 ohms (if anyone wants to redo the calculations, the resistance of the relay is 400 ohms and max IC current is 20 mA), why did he use a 10K?
  2. why did he wire the temperature sensors like this? can't we just wire them 1 pin ground 1 Vin and 1 Vout?
  3. do we have to use resistors before the sensors? if yes how to determine it and how is this guy is not ? if no, why?
    (note: i will be using a LM35 not LM335)
    edit:according to this i will need to put a shield if i am going to connect the sensor away from the arduino , then i will need a cable and a shield
    how is that going to affect the resistance need

Best Answer

  1. Your relay needs 12 V / 400 Ohms = 30 mA of current in the coil. The transistor you are using has a DC current gain of at worst 110 (from the datasheet). So you need at least 0.27 mA going into the base. The Arduino puts out 5 V and the transistor base is at 0.7 V, so the maximum resistor you can use is (5V-0.7V)/(0.27mA) = 15.8 kOhm. Any larger and you will be limiting the current available to the coil. 10 kOhm is a nice round value that is sufficient. You could use smaller, but then you'd be wasting power on the base current.

The page linked says you need hFE at least 5 times the ratio of collector and base current. This is crazy. Yes, you need some design margin, but there's nothing special about 5x and it seems like overkill.

  1. Because that's how that particular sensor has to be wired, check the datasheet.

  2. Again, read the datasheet for the parts in question. As for a shielded cable, that seems like overkill unless you are in a seriously electrically noisy environment (like a factory). Try it without and if the measurement seems noisy try putting a capacitor to ground at the input pin of the Arduino. You might also want a series resistor to form a low-pass RC filter.