Shop OBEX P1 Docs P2 Docs Learn Events
Monitoring a DC voltage signal with the BS2 — Parallax Forums

Monitoring a DC voltage signal with the BS2

Otaku1031Otaku1031 Posts: 34
edited 2011-03-08 17:09 in BASIC Stamp
Hi all,
I'm using the BS2 to control a TC junction test system. The program turns on small lamps that are used to heat these junctions. When the amplified junction voltage exceeds a certain threshold level, the test is considered a "Pass". The problem here is that some junctions require longer heating times, so using a fixed "lamp on" time is not very efficient. The reverse is also a problem - I need to allow enough time for each heated junction to cool down before proceeding to the next test. There are eight TC's being tested and after the TC under test passes, the remaining seven are tested to see if any wires are cross-coupled which would result in more than one TC reading "high". A false positive can be generated due to residual heat in the fixture, hence the requirement for the cool-down time.

Here's what I'd like to do: I would like to monitor the amplified DC voltage signal. This signal will typically be between 1.0VDC and 1.5VDC. I would put the BS2 into a loop that monitors the amplified TC voltage. Once the voltage crosses the threshold, say, 1.4VDC, the remaining seven TC's would be tested. If all pass, then the code would go into another loop that looks at the incoming voltage signal and when it dips below the threshold, the next test in the sequence would start.
Right now I'm trying use a "one size fits all" program with fixed heating and cool-down times. Depending on varying thermal characteristics of each TC, this doesn't always work. Ambient temperatures also play a part. By monitoring the voltage, both rising and falling, I can essentially customize the test on the fly.

So here's the question - can a BS2 accept and evaluate a DC voltage signal based on it's actual value, not just "high" or "low"? I may have to use a comparator to look at the signal and report a high or low signal to the BS2, but it would be less complicated if the Stamp can do this directly.
All advice is greatly appreciated! Thanks!

Gary

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-07 14:08
    The short answer is no. There is no built-in Analog to Digital Converter (ADC). On the other hand, the Stamp does have the ability to sense High and Low with a high-impedance input and this can be used to create a simple, relatively slow ADC. This website has some discussion on the use of Stamp I/O pins for ADC functions. Look at the RCTIME topic.

    It is quite easy to add an external ADC and you can also use a comparator. The BS2px model does have built-in comparator. All of the BS2 models can act as DACs with the PWM statement along with an external filter (resistor and capacitor). This makes it easy for the BS2px to set its comparator threshold.
  • Otaku1031Otaku1031 Posts: 34
    edited 2011-03-07 14:48
    Thanks for the reply, Mike. Yeah, I was afraid of that. I'm using a LM339 quad comparator to monitor the threshold voltages, and there should be a way to loop that function to optimize the time. I just need to determine when to exit the loop because if there's a fail condition such as reversed TC polarity, I'll be there all day waiting for the comparator signal to go high.
  • ercoerco Posts: 20,256
    edited 2011-03-07 15:36
    My favorite "cheat" is to use the Stamp's 1.4V transition voltage as a poor man's comparator, when the voltage works out right. Barring that, the 339 is cheap and great for so many applications.

    If reversed TC polarity is very likely, you could route each TC voltage through a bridge rectifier using 4 Schottky diodes (~0.3V drop each), which would correct any polarity issues and drop each signal by about 0.6 volts. That's still plenty of signal to measure and you can calibrate it with the 339.
  • bsnutbsnut Posts: 521
    edited 2011-03-07 18:35
    As Mike stated, you can use RCTIME to do it if you don't have the pins to use or you can get a Analog to Digital Converter (ADC) which uses 3 pins.
  • Otaku1031Otaku1031 Posts: 34
    edited 2011-03-08 17:09
    Thanks for the replies, everyone. I was able to resolve the issue by monitoring the state of the BS2 input pin in a For-Next loop. Works great and reduced the time to run the test sequence by ~50%.
Sign In or Register to comment.