Author Topic: Voltage Dividers (Resistors)  (Read 426 times)

millennial

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Voltage Dividers (Resistors)
« on: September 20, 2016, 10:53:24 am »
For people with basic Physics of Electricity and Digital Electronics knowledge, how do we know if it is OK to use a sensor directly with the mc-Module pins? What do we look for in product specifications that let us know if a voltage divider (or maybe a pull-up resistor) is necessary for a sensor?

In moisture sensor video (link below), there was a mention about not necessarily needing resistors because there are some built in to the mc-Module.

I've found sparkfun to be a source of information in this area. https://learn.sparkfun.com/tutorials/pull-up-resistors and https://learn.sparkfun.com/tutorials/voltage-dividers, specifically.

Also, is there ever a case where we would use the SWDCLK and SWDIO pins? SWD stands for serial wire debug, which doesn't sound like something for production purposes. Or is this for UART? SDA and SCL are for I2C, I guess. Any general knowledge about using the pins for additional sensors and expansions would be appreciated.

« Last Edit: September 20, 2016, 10:55:38 am by millennial »

Share on Facebook Share on Twitter


mc-Josh

  • Global Moderator
  • Newbie
  • *****
  • Posts: 27
    • View Profile
Re: Voltage Dividers (Resistors)
« Reply #1 on: September 21, 2016, 10:26:21 am »
If you take a look at the schematic for the module: http://www.mcthings.com/s/mcMod110-Schematic-1.pdf . It shows what resistor values are connected to the pins.

The SWDCLK and SWDIO pins are required for production programming of the mcModules, they are not used during normal operation and must be left unconnected.

millennial

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Voltage Dividers (Resistors)
« Reply #2 on: September 21, 2016, 12:08:35 pm »
Re: SWD* pins -- Understood.

So it looks like Pins 0-4 have 470K resistors, and SDA + SDL have 10K resistors. Pins 5-8 have none?

millennial

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Voltage Dividers (Resistors)
« Reply #3 on: September 21, 2016, 03:57:25 pm »
Is it really Kilo Ohms? Most LED tutorials say 330 Ohms is good. Are they leaving out the "Kilo?"

Nick_W

  • Full Member
  • ***
  • Posts: 215
    • View Profile
Re: Voltage Dividers (Resistors)
« Reply #4 on: September 21, 2016, 08:50:19 pm »
Resistors values used for pull-up or pull-down are different from current limiting resistors.

A low value pull-up/down (10k or so) are sometimes called "strong" and large value pull-up/down (470k to 10M) are sometimes called "weak". Many chips have built in pull-up/down resistors that can be enabled, so no external resistors are needed. The McModule is like this.

I2C needs strong pull-up resistors for technical reasons to do with the way the bus is operated.

The lower the value of resistor used, the more current is drawn, so low value pull-up/down resistors are not a good thing, and can damage a chip, if it is limited to how much current it can source/Sink.

The resistor you are talking about (330 ohm for LED's) is a current limiting resistor. LEDs are not voltage driven devices, you can use almost any voltage, as long as you limit the current through the LED to less than it's maximum rating. If you use an Arduino to drive an LED, you need to limit the LED current. An Arduino can source/sink 20mA at 5V. Most LED's are OK with this, but some will blow, and you don't want to overload the output of the Arduino. Using our trusty Ohms law, 330 ohms at 5V will limit the current to 15mA, good for the LED, good for the Arduino. Other chips will be different! Different voltages, different current capabilitys, different resistor values. A chip which can source 2mA will not work an LED, and may be damaged if you try. This is what transistors and FET's etc. are for.

An in-line resistor is not a voltage divider! It is a current limiter. If you try to use an in line resistor to step down voltage, you are using the input/output impedance of the pin as the "other" part of the divider, and that varies hugely from chip to chip. This won't work unless you know exactly the characteristics of the chip. This is well known for Arduinos, so some people "get away" with things that otherwise wouldn't work. Don't do this.

A voltage divider is different again, you are reducing a voltage (say from 5V to 3.3V) by dividing it by the ratio of two resistors. A 1k resistor connected to a 2k resistor will divide the voltage by 1/3 so 5 to 3.3 V at the junction. The lower the resistor values, the more current/power drawn, but the faster you can switch. Voltage dividers do not work for high frequencies (that's what transistors are for ...). They work best with high values, and analog signals. You can get away with TTL serial (low baud rate), but not I2C or SPI.

If one leg of the voltage divider is a sensor that works by varying a resistance (LDR, soil moisture sensor), choosing the other leg carefully, makes a variable voltage divider that gives an analog output proportional to the sensor output, with a voltage range you can select. This generally will not provide any current (that will skew the values) so best to use it with a high impedance input. The MCModule has 2 of these. Low impedance = high source/sink current, high impedance = little/no source/sink current (but this is generally a good thing, no power loss, easily worked out currents and so on). FET's are high impedance, transistors are not (you have to limit the current through the base of a transistor, just like an LED). That's why FET's are used as switches.

Voltage dividers waste power, so only use them if you don't care about power (i.e. Not battery powered), or other devices use so much that it isn't a factor.

This was resistors and Ohms law 101.
« Last Edit: September 21, 2016, 09:24:24 pm by Nick_W »
Like Like x 3 View List