How do I use an ADC with the BS1?
ghost13
Posts: 133
Hi,
I got a BS1 and I'm trying to make my own altimeter. I got this ADC:
focus.ti.com/docs/prod/folders/print/tlc3545.html
it is item 3545.
Using my BS1, how do I hook this up (from what pin on the ADC to what BS1 pin)?
Also, what code do I use to get the number value (not the individual bits - I want the bits put together into a number)?
I know it seems like I'm asking for people to do this for me, but I'm not. I'm just seeking guidance/resources/code.
Also, I already have this code (I just need the "waitForSample()" method):
Thanks for your help!!! [noparse]:)[/noparse]
PS: what's the best way to mount the BS1 to a standard circuit board (I want to be able to remove it easily)?
Post Edited (ghost13) : 5/24/2007 3:39:27 AM GMT
I got a BS1 and I'm trying to make my own altimeter. I got this ADC:
focus.ti.com/docs/prod/folders/print/tlc3545.html
it is item 3545.
Using my BS1, how do I hook this up (from what pin on the ADC to what BS1 pin)?
Also, what code do I use to get the number value (not the individual bits - I want the bits put together into a number)?
I know it seems like I'm asking for people to do this for me, but I'm not. I'm just seeking guidance/resources/code.
Also, I already have this code (I just need the "waitForSample()" method):
while(1) { sample = wait_for_sample(); sample = iir(sample); do_something(sample); } unsigned int filter = 0; unsigned int iir( unsigned int val ) { filter -= filter >> 4; filter += val; return filter >> 4; }
Thanks for your help!!! [noparse]:)[/noparse]
PS: what's the best way to mount the BS1 to a standard circuit board (I want to be able to remove it easily)?
Post Edited (ghost13) : 5/24/2007 3:39:27 AM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Anyway, what code should I use to get the number from my sensor through the ADC?
I hooked it up exactly like it said in the manual, but the code confuses me. Which variable is the final number? What code do I need to keep calling to constantly get a new reading? All of it? Or just some of it?
thanks!
Post Edited (Mike Green) : 5/24/2007 4:47:58 AM GMT
www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1335&dDocName=en010533
Will it work? Even though mine has 14 pins, should I simply connect it like the LTC1298 is connected?
And why doesn't the 14 bit one work? It uses the same pins. Is it simply a matter of converting the output? So is it a software program?
Thanks!
And also, now they I can get the input in number form , how do I convert that to barometric pressure. I'm using a barometric pressure sensor. Is there a simple formula for all barometric sensors? Or is there something unique in the datasheet? The datasheet link is below.
www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MPX4115&fsrch=1
Thanks!
Post Edited (ghost13) : 5/24/2007 11:25:42 PM GMT
But Vout, I assume, is the sensor's output. Not the ADC. So how do I get the ADC output into pressure? Can I turn the ADC output back into a voltage, and then apply this equation?
Also, I'd be comparing it to ground, which I would make 5V
Post Edited (ghost13) : 5/24/2007 11:48:52 PM GMT
So here is the only one that remains:
I ordered the LTC1298. I have a question about hooking it up like they did in the manual you linked to. My sensor only lets out a V+. I assume that should go into Ch0 and GND (from my 9V battery but use resistors to make the GND -5V?) can go to Ch1. Correct? Therefore, Ch1 and GND on the chip both go to the same wire.
Thanks!
Similarly, use the circuit given in the Parallax AppNote for the LTC1298 including the bypass capacitor (again, within an inch of the LTC1298). The LTC1298 is a TWO channel ADC. In the AppNote, they show two 0-5V signals, one for each channel and these are relative to ground. In your case, you only need to use Ch0 (or Ch1).
THANKS!!!
1) The sensor is not hooked up anything like what's in the manufacturer's datasheet. Please look again carefully, particularly how the capacitors are connected. The symbol that looks like an upside down triangle is one of the symbols for ground.
2) There are no current limiting resistors for the LEDs. Please look at the "What's a Microcontroller?" tutorial from Parallax (here: www.parallax.com/dl/docs/books/edu/Wamv2_2.pdf) for examples.
3) Your schematic is very messy with things all jumbled up together ... very hard to follow. Keep the sensor stuff together, then the ADC stuff together, then the BS1 stuff (usually left to right). Look at examples from other people.
1) The resistor in the ground lead to the sensor and LTC1298 shouldn't be there. Those "ground" pins really need to be directly connected to the circuit ground.
2) The little square connected to the BS1 I/O pin 7 ... Is that supposed to be a relay? If so, you need a reverse connected diode across the coil to protect the BS1 from "reverse EMF". The "What's a Microcontroller?" tutorial gives an example of this.
3) You didn't give a value for the LED resistors. Do you know how to pick that? Most LEDs use a current between 5ma and 20ma. 5ma usually will light it up and 20ma will give a bright light, but use a bit of current. The LED will use 1.7V of the approximately 4.7V available (with the Stamp using the last 0.3V). That leaves 3V to drop across the resistor. At 5ma, that requires 3/0.005 ohms or roughly 600 ohms. I'd use a 330 ohm or 470 ohm value for a bit more current and these are standard values.
Post Edited (Mike Green) : 5/25/2007 4:39:46 AM GMT
Also, the thing you thought was a relay (the one to the left of "to nichrome") is actually meant to be a transistor. When current is applied, the transistor switch should close, applying a full 9V to the nichrome. Then, after about a second, the nichrome will automatically break itself (it melts itself).
Anyway, how's this third version look? THANKS!!!!!!!!!!!!
I also have another transistor that passes 9V through it. Do I need a resistor there?
Also, what is the best way to mount the BS1? I know the pins are all on one side facing out, not bent over. I don't really want to solder it, because then I can't easily remove it. Other solutions???
www.mouser.com/search/ProductDetail.aspx?R=929850-01-14-10virtualkey51750000virtualkey517-850-01-14
www.mouser.com/search/ProductDetail.aspx?R=315-43-164-41-001000virtualkey57510000virtualkey575-31543164
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Rick
What variable (using the appnote's code) is the ADC output? Is it AD? If so, why (when I run my code) is the same thing always displayed (379). Even when I blow or suck on the sensor's air pressure input, nothing changes. The schematics are also attached.
Because the ADC can utilize 2 sensors, am I on programming it incorrectly?
Thanks!
PS:I'm using the BS1
to this:
or this:
Thanks!