Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

68hc12 for processing a sensor input

  1. Aug 7, 2006 #1
    Hello,
    this is something I am not sure about, so want to make sure before burning my friends electronics :biggrin: .
    we are trying to use 68hc12 for processing a sensor input, but the signal from the sensor comes out to be more than 5 volts (around 15 or 20 v), so what we need is to scale the voltage from 15 to 5 volts. Would I use just a low-pass (RC) filter for that, or what would I need to do?
    Thanks in advance.
     
  2. jcsd
  3. Aug 7, 2006 #2

    berkeman

    User Avatar

    Staff: Mentor

    What is the output impedance of the sensor? What is the input impedance specification for the analog input pin that you are using in the 68HC12? (I assume it's an A/D input?) What is the bandwidth of the sensor signal that you want to be sure to preserve? Is the sample/hold part of the ADC external or internal to the 68HC12?
     
  4. Aug 7, 2006 #3

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Berkeman's questions are all good, but, I'd bet that one of two solutions would be adequate for virtually any such situation:

    1) a simple high-valued resistor divider
    2) an op-amp with a gain of 1/4

    - Warren
     
  5. Aug 7, 2006 #4

    berkeman

    User Avatar

    Staff: Mentor

    Awww, you're taking the fun out of this, chroot! :biggrin:

    BTW, did you get my PM about the ICL7106 question thread?

    https://www.physicsforums.com/showthread.php?t=127935
     
  6. Aug 7, 2006 #5

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Yeah, I got the PM, but I don't know anything about the part, and didn't have the time to go reading up on it.

    - Warren
     
  7. Aug 7, 2006 #6

    berkeman

    User Avatar

    Staff: Mentor

    :biggrin:
    Fair enough -- me neither. I'm in the middle of another first-silicon verification and preparing to present at a conference in September. Pesky chips! :biggrin:
     
  8. Aug 7, 2006 #7
    I am digging the manuals, berkemann, I can answer all your questions except for the sensor, since I don't have the specs of it....my friend does.

    -I/O pins on 68hc12 all have 5v nominal voltage, could not find anything on impedance though;
    -sampling is done internally, actually all we need right now is to detect the pulses, which I can use pulse accumulator for that purpose (the TIM module).

    op-apm went thorugh my mind....

    thanks a lot!
     
    Last edited: Aug 7, 2006
  9. Aug 7, 2006 #8

    berkeman

    User Avatar

    Staff: Mentor

    Oops, sorry about hijacking the thread there, EvLer. I asked about the impedances to see if you can just use a voltage divider without getting too much gain error. Plus, if you use too high values for the resistors and have moderate input capacitance in your uC pin, that will cause an RC rolloff of the input signal, which is bad for higher-frequency signals.

    When you say filter, is that what you mean? A resistor divider with added capacitance? That is actually desirable for an ADC input -- it's called an anti-alias filter, and you set the breakpoint based on the ADC sample frequency.
     
  10. Aug 7, 2006 #9

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    The front-end of the A/D is likely to have an impedance of several megohms, so it's effectively an infinite input impedance.

    The sensor is likely not buffered, and probably has an output impedance of several hundred ohms (you should look that up). If you use a high-valed resistor divider, it will not draw much current from the sensor, thus avoiding any loading problems.

    If the sensor happens to have a very high output impedance, somewhere north of 1kohm or so, you'd be better off buffering it with an op-amp. An op-amp can "convert" a high-impedance output signal into a low-impedance output signal. You could then follow the op-amp with a resistor divider, or, accomplishing the same thing, integrate the resistor divider in the op-amp's feedback network.

    Note: I'm assuming that the signals here are low-bandwidth. Most sensors measure variables that change very slowly, like temperature, and the bandwidth of their signals is effectively zero, so it doesn't matter what kind of frequency response your network produces.

    - Warren
     
    Last edited: Aug 7, 2006
  11. Aug 7, 2006 #10

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    BTW, EvLer, most electrical engineers use the word "filter" to describe circuits that have carefully designed magnitude vs. frequency behavior. They're used to get rid of unwanted components of signals.

    It seems like you're just trying to find a way to turn a 20V DC signal into a 5V DC signal, so the word "filter" is not really appropriate. "Level shifting" is probably the term most EEs would use for the purpose.

    Just an FYI. :biggrin:

    - Warren
     
  12. Aug 9, 2006 #11
    thanks for all the help and terminology.
    Here is the sensor attached. Also, if I use an op-amp, what am I looking for? I checked out Digi-key, and they classify them very thoroughly as low-voltage, CMOS, etc. and I am not quite sure what we need besides gain of 1/4. All we need to detect is the signal off the sensor, which is an impulse actually, just a spike. The sensor is laid on the floor and a heavy weight is rolled quickly over it, so we are detecting the "event" of something passing by on the floor.
    Sensor specs are attached.
     

    Attached Files:

  13. Aug 9, 2006 #12

    dlgoff

    User Avatar
    Science Advisor
    Gold Member

    "...if I use an op-amp, what am I looking for?"

    Looks like a simple application for a 741 op-amp.
     
  14. Aug 9, 2006 #13

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Oh, jeez, that's all this is? A brief 20V spike, containing no specific information other than the fact that it occured?

    You really should have told us that information from the beginning EvLer.

    Since this is an entirely different kind of "sensor" than the ones we originally imagined you were talking about, my recommendation has changed entirely. You don't need a filter, or even an op-amp. All you need is a resistor divider to limit the maximum voltage.

    The most difficulty you're likely to have is that a very brief spike is going to be hard to detect with a microcontroller. An ADC will miss a spike that occurs so quickly that it falls completely within a single sample period. If the "spike" lasts more than a few tens of milliseconds, however, it might be okay.

    If your microcontroller has a timer/counter module (most do), you can probably configure it to count rising edges of your input signal. Alternatively, you could use a 555 or other timer IC, configured as a one-shot, to extend your sensor's "spike" into a longer, more easily captured pulse. If the pulse is long enough, your microcontroller could detect it simply by polling.

    - Warren
     
  15. Aug 9, 2006 #14

    berkeman

    User Avatar

    Staff: Mentor

    One possible improvement on the resistor voltage divider idea would be to use a resistor divider that provides about 5V peak from the lightest vehicle that will cross the cable, and put a diode clamp from that sensing midpoint of the divider to the 5V rail of the uC. That way, much heavier vehicles can be sensed, and the voltage at the uC input will not be a problem.

    BTW, if you did end up needing to use an opamp, you should look for a fairly new CMOS opamp that runs well off of a single supply (like your 5V rail). The old 741 series opamps need fairly wide split rails -- their inputs and outputs are nowhere near the rails.
     
  16. Aug 10, 2006 #15
    not sure if I should start another thread, but....
    in timer module of 68hc12 there is a free running 16-bit counter TCNT, and i cannot see in the documentation whether reading from it resets the counter or not, I need to reset it after 2 pulses in pulse accumulator. I know that channel 7 Output compare resets the counter. But not sure how else, maybe besides clearing it directly?
    here is the link for documentation: http://www.freescale.com/files/microcontrollers/doc/ref_manual/S12TIM16B8CV1.pdf?srch=1
    Was wondering if someone knows or can help me with that.
    Thanks.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: 68hc12 for processing a sensor input
  1. CMOS sensor process (Replies: 6)

  2. Sensor Failure (Replies: 1)

  3. What is this sensor? (Replies: 1)

Loading...