Outputting analog signal with Basic Stamp 2
bannor32
Posts: 20
Hi there. I am working on a project where I am taking accelerometer measurements and outputting it to a 3.5 digit·LED display. I already have a nice·LED voltage meter that I want to use to output the voltage numerically, but it only outputs a signal in real time without the ability to pause the output. (I want·to be able to read the display for·about·5·seconds without the number fluctuating.) Is it possible to have the signal from the accelerometer to be fed into the Stamp, detecting the highest measurement (speed) over a two second period,·and have·that information fed out as an analog·signal into the 3.5 digit·LED voltage meter? I'd want the Stamp to·store the max voltage that was supplied in that 2 second sampling period, and then steadily output that max voltage as an analog signal, which would then·display on the voltage meter's·LED for about 5 seconds.·
Comments
·· You could do this using a DAC (Digital to Analog converter).· It really just depends on what voltage range your LED Panel Meter is expecting.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
·· A quick look at the docs <hint> tells you that the Memsic returns a PULSE value, which the Stamp can read using PULSIN.· So, no, you don't need an A/D converter, but you should read the docs for the parts you want to use so you know what you'll need to do.·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
' {$STAMP BS2}
' {$PBASIC 2.5}
PulseInput CON 15
Pulse VAR Word
Main:
PULSIN PulseInput, 1, Pulse
DEBUG "Value: ", DEC Pulse, " ", CR
GOTO main
When I run the program, the Debug Console shows Value: 0 steadily. Turning the dial up and down on the variable power supply has no effect. Is my code correct for measuring a pulse value on pin 15?
·· What A/D converter are you using that outputs a PULSE value to indicate the voltage input?· In all honesty, I have never heard of one that does that.· Do you have a part #?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
http://www.bobblick.com/techref/projects/a2d555/a2d555.html
·· Sounds like kind of a VCO, so to speak.· Obviously something's not working though.· Without seeing the circuit, I couldn't guess what though.· If you don't mind me saying, it sounds like you're trying to overly complicate things for yourself.· You can actually do what you want to do in a more straight forward manner.
·· An accelerometer that returns a PULSE width can be directly read by the Stamp Module without any extra hardware.· As for LED output, the MAX7219 can display the output on up to 8 7-Segment Displays (you can use 4 each for the X & Y axis, respectively).· Or, you could use an LCD Display, as these are cheap (We sel one for $29.99 which is serial).
·· So much has changed since your original specifications already anyway, and you still aren't able to output to the Digital Penl Meter yet, are you?· That would require a D/A Converter.· We actually have code that displays the output of the Memsic Dual-Axis Accelerometer to a Serial LCD Display.· Just some thoughts.·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Post Edited (Chris Savage (Parallax)) : 4/22/2005 2:58:08 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
' {$STAMP BS2}
' {$PBASIC 2.5}
PulseInput CON 15
Pulse VAR Word
Main:
PULSIN PulseInput, 1, Pulse
DEBUG "Value: ", DEC Pulse, " ", CR
GOTO main
Should this be outputting the number 15000 to the debug console without any weight applied to the transducer? Value keeps coming up at 0. Is this code correct? is 15000 pulses too fast?
Post Edited (bannor32) : 4/22/2005 6:10:30 PM GMT
· Can you try another PIN for input with your new circuit?· I can't help but wonder if the PIN may be blown since you're apparently unable to read anything.· You could also try connecting that pin HIGH and LOW and reading the value to see if it's changing states that way.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Thanks,
Dennis
·· CA or CC 7-segment displays really depend on how they're connected.· Either could be used with the Stamp Module, but certain driver chips require one of the other.· For example, the MAX7219 uses CC displays.· For Common Anode you would connect the Anode to Vdd, and the 8 cathodes to port pins through resistors (The value would depend on the forward segment current).· When a pin was LOW a segment would light up, and when it was HIGH it would go out.· The default state of the pins is INPUT so they would be off until the pins were initialized anyway.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com