Subscribe to Test & Measurement World
RSS
Reprints/License
Print
Email
Average Rating:
  • (21)
    Rate this:
  • Measure resistance with a microcontroller

    Create a voltage across an unknown resistance and digitize it.

    By Adolfo Mondragon, Electrolux Products, Juarez, Mexico -- Test & Measurement World, 2/1/2011 12:01:00 AM

    pdfbutton.gif

    Have a test idea you'd like to share?
    Publish it here and receive $150.
    Send us your ideas.

    Also:
    Read other Test Ideas
    Read Design Ideas published by EDN
    Stepper motors contain coil windings that require resistance measurements. Measuring resistance in a production environment often requires some special circuits that minimize errors. Resistance is easy to measure indirectly by using a constant-current source to force a voltage across the winding's unknown resistance, measuring the voltage, and applying Ohm's Law.

    Figure 1
    shows the basic concept of a circuit I designed to check the resistance of the wire coil winding of a stepper motor. An op amp configured as a differential amplifier produces a voltage proportional to the unknown resistance. You can use this circuit to measure resistances—just start by identifying the range of resistances to measure. The stepper motor has a coil with a resistance of 50 Ω ±15%, which ranges from 42.5 Ω to 57.5 Ω.

    Op amp schematic

    Figure 1. The op amp produces a voltage proportional to the resistor under test where the microcontroller digitizes the voltage to calculate resistance.  
    Next, define the scale measurement or digital value within the microcontroller. The nominal value of the DUT (device under test) should be close to half of the scale selected. Thus, you should set the full-range scale from 0 Ω to 100 Ω.

    If you use a microcontroller that contains a 10-bit ADC, it will produce a digital span from 0 to 1023 counts. Set the range of the ADC so that 0 Ω produces a count of 0 and 102.3 Ω produces a count of 1023. This range simplifies the math and maximizes measurement precision. Half of this scale, 512 counts, represents 51.2 Ω. That's close to the nominal 50-Ω measurement of the DUT. Table 1 shows the correlation among the input voltage to the ADC, the number of counts, and the coil's resistance.

    The differential configuration of the op amp works as a four-wire measuring circuit similar to those used in many DMMs. Using separate wires for excitation current and voltage measurement eliminates much of the common-mode noise and errors introduced from the DUT wiring and connections.

    Relationship of input voltage, digital counts, and coil resistance

    You must define the op amp's gain and, from that, the resistor values. In this circuit, the op amp provides adequate voltage for the microcontroller. It also provides isolation between the DUT and the microcontroller's ADC input. To minimize errors, select resistors RA through RD so that the op amp operates at unity gain. To verify that you can run the op amp at unity gain, you must calculate the current that passes through the coil. Using the values from Table 1, calculate the current (IIN) needed to achieve a half scale of 51.2 Ω:
    TMW Feb Test Ideas equation 1

    The constant-current source is based on an LM317 regulator, which can easily provide 48.8 mA. Thus, you can run the op amp at unity gain, which simplifies selection of the resistance values of RA, RB, RC, and RD. For unity gain, all resistors should be equal. Their values should be considerably higher than the DUT's resistance. Keep the resistor values between 10 kΩ and 100 kΩ.

    The circuit works best if you use resistors with 1% or better tolerance. If you need to reduce cost, then measure 5% resistors from a batch with a DMM. Select the four resistors that best match each other's values. You may be able to achieve better than 1% matching this way.

    The op amp also provides some isolation that can prevent dangerous voltages from reaching the microcontroller's ADC input. An op amp such as the LM6132 connected to a 5-V power supply will limit the power supply's output voltage to 5 V, even under extreme conditions.

    To operate an LM317 regulator as a constant-current source, you need to calculate a resistor value:
    TMW Feb Test Ideas equation 2
    where IIN = 48.4 mA, so R = 25.86 Ω. You should, therefore, use a fixed 15-Ω resistor and a 20-Ω potentiometer.

    Complete circuit for stepper motor

    • Capacitor C1, connected at the output of the constant-current source, will stabilize oscillations caused by the inductance of the winding coils from the stepper motor.
    • Diode D1, connected at pin 15 of the microcontroller, protects the microcontroller input from unexpected voltages when there are components connected outside of the main circuit board.

    Figure 2. The complete circuit shows the LM317 constant-current supply, the stepper motor under test, two LEDs, and an LCD screen.

    Microcontroller software flow chart

    Figure 3. A flow chart of the microcontroller code shows how the system decides pass/fail conditions and reports them to an LCD screen and the LEDs.
    Average Rating:
  • (21)
    Rate this:
  • RSS
    Reprints/License
    Print
    Email
    Talkback
    Similar Content from T&MW

    No related content found.

    »MORE

    • 0 rated items found.

    Datasheets.com Electronic Parts & Inventory Search

    185 million searchable parts
    • Part Number
    • Description
    • Inventory
    • Products
    • Manufacturers
    Canon Resource Center

    Featured Company


    Most Recent Resources

    Featured Job On
    Scroll for More Jobs
    Advertisement
    More Content
    • Blogs
    • Webcasts

    Sorry, no blogs are active for this topic.

    » VIEW ALL BLOGS RSS
    • All


    Advertisement
    Advertisement
    About Us   |   Advertising Info   |   Site Map   |   Contact Us   |   FREE Subscription
    © 2011 UBM Electronics . All rights reserved.
    Use of this Web site is subject to its Terms of Use | Privacy Policy

    Feedback Form
    Feedback Analytics