Shop OBEX P1 Docs P2 Docs Learn Events
How would I use the Propeller to take voltage readings (very low frequency A/D) — Parallax Forums

How would I use the Propeller to take voltage readings (very low frequency A/D)

Dennis FerronDennis Ferron Posts: 480
edited 2007-01-10 15:15 in Propeller 1
I read the forum postings about using the propeller to take high frequency a/d samples, but the caveat is that the breadboard introduces too much parasitic loading. What if I only want to take voltage measurements over a longer period of time? I assume the breadboard electrical loading would be negligible at low frequencies - right? How would I change the circuit to do low speed A/D conversion?

I'm building a motor controller and I want to measure back emf to guess current. Essentially what I will be doing is spinning up a motor, then turning off power to the motor for 100 ms and measuring how much voltage the motor generates free spinning. Supply voltage minus back emf voltage gives me effective voltage. Effective voltage divided by the motor's parasitic resistance gives me estimated current. At a stroke I get a rough measure of how fast the motor is (probably) spinning and how much current the motor is (probably) drawing.

Edit:
Is the estimate accurate? Maybe not - on the other hand, maybe it will turn out to be almost 100% accurate. But I need to build a test rig on the breadboard to find out!

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-07-27 16:29
    Your theory is sound, the method is used to drive brushless motors (though how they do it is a little different). The issue however is the counter is providing feedback into the ADC circuit, you would need to slow the rate at which the feedback is provided in order to compensate for the additional parasitics of breadboarding. I cannot say whether this is possible without delving into the details of how the counters work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ...
  • Stan671Stan671 Posts: 103
    edited 2007-01-10 00:33
    As a follow-up to the original question, what is the issue with these "parasitics of breadboarding" and this ADC circuit/software for the Propeller?· I mean,·is the requirement that the circuit components need to be right next to the Propeller because of the speed at which consecutive readings are taken or because of the way·each reading is taken?
    ·
    Very simply, I would like my robot to be able to check the voltage on the motor batteries and logic batteries no more often than every 5 seconds, more likely once per minute.· So, my ADC consecutive reading rate would be VERY slow.· And I would certainly not need more than 8-bits of resolution.· Given these circumstances, is the parts layout of the ADC circuit critical?
    ·
    And, I have not delved into the program for the ADC, but would be be easy/pratical/worth while to modify it to do only 6 or 8 bits of resolution?

    Stan Dobrowski
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-01-10 01:14
    The feedback path is critical regardless of your sampling period because the feedback path always works at the core clock speed (80 MHz typically). If you read the Ap Note on the counters I explain which components required careful placement (there are 3 of them).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • T ChapT Chap Posts: 4,223
    edited 2007-01-10 01:16
    Did you already try hooking up another motor via shaft to shaft, read the voltage off the non powered motor over a longer time period than 100ms? Then, subtract the two values to determine effective voltage more accurately over various speeds. The motors load affects the effective current/voltage as well correct? As the motor produces the same back emf voltage, regardless of load, however the effective voltage has to take into account the load it has to move.

    Post Edited (originator) : 1/10/2007 1:20:39 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2007-01-10 01:20
    Tracy Allen has a website rich with information about the Stamp that's often directly applicable to the Propeller. Look at this page on ADC using the Stamp's RCTIME statement www.emesystems.com/BS2rct.htm. It is very applicable to your circumstance where you want to measure voltage and/or current that's slow to change. Just write a zero to a pin for a short time to discharge the capacitor, then change the pin to input mode, save the current system clock (CNT) and wait for the value to change from 0 to 1. Take the difference between the new CNT value and the saved one and you have the time in system clocks. Divide by (clkfreq/1_000_000) and you have the time in microseconds which you can use in Tracy's formulas.
  • crgwbrcrgwbr Posts: 614
    edited 2007-01-10 15:06
    This may not be acurate, but I think an easyier way of doing this would be to take a coil of wire wrapped around your motor cable, and measure the voltage induced into the coil.· In theory that should work; right?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    NerdMaster
    For
    Life
  • Stan671Stan671 Posts: 103
    edited 2007-01-10 15:15
    Thanks for the info, Paul.· I don't want to have to deal with critical placement, so I'll not bother with that ADC - it is way more than I need anyway.

    Mike, thanks for the reference to Tracy Allen's information site.··There is some very interesting and useful stuff there.· Using an RCtime function for a simple ADC to measure battery voltage will be just what I need.· Perfect.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Stan Dobrowski
Sign In or Register to comment.