Shop Learn P1 Docs P2 Docs
ARLISS Team NH - Page 8 — Parallax Forums

ARLISS Team NH

1568101159

Comments

  • Andrew (ARLISS)Andrew (ARLISS) Posts: 213
    edited 2010-06-08 22:27
    Mark in NH said...
    Andrew and Rocketeers,

    Let's move ahead with trying to get the new ASP program running. Andrew, I think one thing we need to do is to "assign" pins #3 and #4 as I/O definitions in the program. Likewise with the "Vin" and "Vss" wires. Here's where they connect to the BOe

    "Vin" pin on the CO2 sensor goes to "Vin" on the BOE

    "Com" (GND) pin on the CO2 sensor goes to "Vss" on the BOE

    "CNTL" pin on the CO2 sensor goes to "P4" on the BOE

    "ALR" pin on the CO2 sensor goes to "P3" on the BOE

    I think, though I'm only 37% certain, that the "HIGH 4" command line has to be replaced or rewritten somehow to make the program activate the pin that runs the heater. That's one reason why you have to "assign" pins #3 and #4 in the I/O definitions part of the program. Use some of the programming knowledge you acquired last summer at Math and Science Camp.

    Rocketeers, here's where you begin to use the information in the "What's a Microcontroller?" book. Read, think, and then dive in an offer your ideas about how to get the program working. It's time to rock and roll. Tomorrow the CO2 sensor will be wired to the ASP. I'll look for everyone's ideas and input here on the forum each day.

    Mr. Kibler

    Mr. Kibler,

    I'll try to do what I can with the program tonight. I have a homework board, and a few assorted bits and pieces sitting around but not enough to fully emulate the ASP. Nonetheless, I'll try to fix up the program as best as I can. Other team members should start doing the same with the knowledge you've gained from reading "What's a Microcontroller?".

    Andrew
  • Mark in NHMark in NH Posts: 447
    edited 2010-06-08 22:35
    Rocketeers -

    · Check·to see what the CNTL pin on the CO2 sensor activates. This factors in to how you write the·program.·The first Rocketeer to respond correctly gets two extra cookies at team practice on June 19th...! Those who do not reply will lose··shocked.gif· a cookie (each.) OUCH!

    Mr. Kibler, Rocketeer
  • Mark in NHMark in NH Posts: 447
    edited 2010-06-08 22:44
    Andrew,

    For now you're our team's software designer. Work closely with Dr. Allen and let him guide you. We'll construct the hardware at this end and then·run your program. At practice on June 19th I'll get you a CO2 sensor and a·MAWD so you can emulate the ASP precisely. Let me know what else you need so we can all build the same set-up and run the same programs at different·locations·(MAWD-BOE-CO2 sensor) = ASP. Keep in mind that Dr. Allen doesn't have a MAWD and so·we're all essentially pieces of a large jig-saw puzzle.

    Do you have a BOE board (other than the one with the built-in stamp?) I was certain that you did. If not, then I'll·get you one, or·give you "Phidippides" to use.

    Will YOU be the Rocketeer to get earn the two extra cookies...?! (see above post)

    Mr. Kibler
  • Dylan LandryDylan Landry Posts: 235
    edited 2010-06-08 22:53
    Dear Mr. Kibler,

    When HSW is fully heated it sends a small voltage to the ALM. This voltage has to first pass through two buffers. Once through the second buffer it reaches the ALM through a 1k Ω resistor. This small impulse also triggers the LED to turn on. Then in a logistic understanding, the ALM passes the voltage from the second buffer and makes the LED turn on. So CNTL sounds the LED.

    Dylan Landry
  • Mark in NHMark in NH Posts: 447
    edited 2010-06-08 23:04
    Dylan,

    ·Hmmmm...·your answer·seems cryptic (or maybe I'm just hungry.) It's a more·elaborate answer than I was looking for. So let me rephrase the question:

    When current runs between P4 and the "CNTL" pin, what's activated?

    What's·another name (or abbreviation)·for "CNTL" so we write in on the masking tape we put on the 'SIP' connector wires today?

    Recall that:


    "Vin" pin on the CO2 sensor goes to "Vin" on the BOE

    "Com" (GND) pin on the CO2 sensor goes to "Vss" on the BOE

    "CNTL" pin on the CO2 sensor goes to "P4" on the BOE

    "ALR" pin on the CO2 sensor goes to "P3" on the BOE


    Conclusion: No bonus cookies awarded... yet!

    Mr. Kibler
  • edited 2010-06-09 01:27
    Mr.Kibler,

    I believe that another word for "CNTL" is control. I am still working on the other question.


    Sean
  • Tracy AllenTracy Allen Posts: 6,641
    edited 2010-06-09 06:04
    As to Sylvie369's "One big question: if the sensors work by responding to chemical reactions between CO2 and certain substances inside the sensor, won't those substances eventually be used up?" I puzzled about that too. My chemistry courses are a long while back, and the solid electrolyte NASICOM is a hot new technology.

    From basic principles though, I think the core of the answer is that the reaction is reversible. Think about a flashlight battery. Or better yet, a long life lithium coin cell. So long as you don't draw any current from it, that is to say, extract energy from it, you can measure its EMF (potential) without using up any of the internal chemicals. The internal reactions continue to occur, but they go both forward and backward in tiny equal amounts. Electrons pile up on one electrode and positive charge (deficit of electrons) on the opposite electrode. But they only pile up to a certain point, the cell voltage. No further change in the measured voltage. The same with this CO2 sensor. it is indeed a little battery and the voltage output by design depends on the amount of CO2 present in the surrounding air. The substances are not used up, not even the CO2.

    Note the part about not drawing current. That is is what makes it imperative to have a buffer amplifier. The buffer amplifier that Parallax uses in the 27929 module draws an input current of only 20 femtoAmps (10-15 well under the1 pA maximum specified in the Hanwei data sheet. The buffer amplifier is labeled "U2A, LMC6035" on the Parallax 27929 schematic. See it?

    A battery usually takes two electrodes and an electrolyte. The electrolyte in the CO2 sensor is the NASICOM. (Sodium Super Ionic Conductor). It is a solid electrolyte, unlike the liquid or gel electrolytes found in typical batteries. Sodium (Na) ions are is free to move through the crystal lattice of Zirconium, Phosphorous and Silicon oxides. I'm puzzled about the structure on the surface of that little tube inside the sensor.

    Here is a diagram from an engineering article (www.mdpi.com/1424-8220/8/8/4774/pdf) about another NASICOM based CO2 sensor.
    attachment.php?attachmentid=70988
    The point here is that there are two electrodes, one on each end that connect to the outside wires at the gold (Au) grids. The NASICOM is the solid electrolyte that runs the whole length. (It is really quite like like dissimilar metals stuck in a lemon!) The CO2 sensitivity comes from the "carbonate phase" on the left side.

    Hanwei does not reveal the microstructure of the MG811, but maybe it is similar to the above. Here are the reactions in the MG-811. Note that this reaction involves Lithium in the "carbonate phase". A "carbonate is a molecule with a CO3 group attached, so Li2CO3 is lithium carbonate.
    attachment.php?attachmentid=70985
    On your sensor, the two end electrodes are labeled "A" and "B" on the Parallax schematic. The ceramic tube is the AL2O3 substrate like the one in the above diagram. The heater is not shown in the above diagram, but they talk about it in the associated text, about running it up to 500 or 600 °C. In your sensor, the heater runs up the center of the ceramic tube.

    I don't know how to answer the question about endo- vs. exothermic. There is probably something there. But it may be secondary. The heat may be necessary more to increase the mobility of the sodium ions in the NASICOM. Or high temperature may be needed to make the reactants jiggle around fast enough to jump over the hill, that is, an activation energy. I don't know. It's all such new stuff and way out of my knowledge zone.

    Young Rocketeers, take note, sensors built on the solid electrolyte principle seem to be a huge topic in materials science and applications these days. You are working with some cutting edge stuff!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 6/9/2010 7:06:02 AM GMT
    831 x 300 - 41K
    562 x 240 - 20K
  • Tracy AllenTracy Allen Posts: 6,641
    edited 2010-06-09 06:44
    Okay, here is my puzzler question for today. Suppose you have a container that has carbon dioxide gas in air, say 1% (10000 ppm). Suppose you put your ASP in the container at atmospheric pressure and then suck out 1/2 of the gas, so the new pressure is 1/2 atmosphere.
    -- Is it right to say that the gas is still 1% (10000 ppm) CO2?
    -- Will the reading from test point TP1 change?
    -- What does that have to do with rockets?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Tracy AllenTracy Allen Posts: 6,641
    edited 2010-06-09 06:46
    Here is a diagram for discussion, starting with Mr. Kibler's CNTL question on the left side. CNTL what, how, when?

    attachment.php?attachmentid=70989

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
      HIGH 4 'This activates the Heat Switch (HSW)
           'HSW pin is called CNTL on the carbon dioxide (CO2) monoxide
           'HSW pin is marked HSW on the carbon monoxide (CO) module
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 6/9/2010 6:55:29 AM GMT
    451 x 307 - 21K
  • Justin AbbottJustin Abbott Posts: 54
    edited 2010-06-09 17:39
    Hi Everyone,

    We wired the CO2 sensor to the BOE (on treads). Attached is a picture. We will try to get a better picture to you (higher detail). The MAWD is not wired in yet.

    We ran Andrew's "mashed together" 'MAWD-BOE with CO2 sensor' program. It had Dr. Allen's "CO2 v.3" (with 'new' and 'old' commands) as the 'carbon collect' subroutine. When we ran this program, we got an error message when the program came to the word 'new'.

    Then we cut and pasted 'CO2 sensor v.2' in place of·the "carbon collect" subroutine. The program actually·initiallized and ran all the way·down to·the CO2 sensor ('carbon collect') subroutine. This "mashed together" program actually read out the CO2 status ("NOMINAL") but it kept looping there. We had to comment out some of the words that appear when it initializes so we had enough EEPROM space.

    Dr. Allen and sylvie, where do you suggest we go from here with the program? HELP! We will answer your homework questions tonight. Thanks!

    Justin, Dylan, Mr. Kibler
    2272 x 1704 - 699K
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-06-09 17:54
    I'm going to let Tracy alone at the code debugging - too many cooks spoil the soup, you know.

    I do think I should remind you, though, that while it's a good thing to work with the sensor and get it going with a BoE like this, you're still hooking it up simply to set off an alarm when the CO2 is over a certain level. That's a different task than setting it up to give you a reading of the actual CO2 level, which is, as I understand it, your goal. Setting it up to do that will involve more than just a change in the program - you'll need to wire the sensor to the BoE in a different manner, with additional parts.

    So don't go mounting the sensor in your payload bay or anything like that yet: you're going to need to make some hardware changes/additions first.

    P.S. - I'm waiting impatiently to see the answers to Tracy's questions. I have my own answers, but I'm not at all sure of some of them.
  • Tracy AllenTracy Allen Posts: 6,641
    edited 2010-06-09 18:00
    "new" is a variable in the v.3 program, and either the mash-up program did not declare it, or the program has already used up all the variable space. On the other hand, the v.2 program did not declare any new variables. It simply reads the input pin directly using IN3.

    If the program is looping on the CO2 code, that probably means that you left in the DO:LOOP that framed the original code. You need to remove the DO and the LOOP that were part of the original v.2 program.

    It will be helpful if you attach your code just like you attached the photo.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Justin AbbottJustin Abbott Posts: 54
    edited 2010-06-09 19:17
    -- Is it right to say that the gas is still 1% (10000 ppm) CO2?
    -- Will the reading from test point TP1 change?
    -- What does that have to do with rockets?

    1.The amount of gas in the container is now 5000 ppm (0.5 %) since half of it was sucked out. The total amount of gas in the container is 10000 ppm because half of it is in the ASP and the other is still in the container.

    2. The reading will change because if there was 1% of CO2 in the container, TP1 would show 265 mV. If there is only 0.5% CO2 in the container, then TP1 would show 278 mV.

    3. When a rocket ascends, the atmoshpheric pressure becomes less and less. That's why a balloon pops when it reaches a low enough atmoshpheric pressure level. The air that it was filled with at ground level wants to move to fill the space outside the balloon since there is less pressure out there. As equilibrium or osmosis occurs, the air pushes against the balloon to fill the outside of the balloon, and the balloon pops due to the pressure. I don't know exactly know how this has to do with rockets. It's a real head banger for me. Could someone please explain the question to me?

    Thanks,
    Justin
  • Justin AbbottJustin Abbott Posts: 54
    edited 2010-06-09 19:25
    Tracy,

    ·· Attached is the program "SEMI OPERATIONAL MAWD-BOE with CO2 sensor - June 9, 2010." I meant to send it at the end of class but got sidetracked in a lengthy conversation with a student about colleges.·The program·includes "CO2 sensor v.2", not "v.3." That is, Dylan and Justin replaced the "new" and "old" commands. As you indicated, the "new" and "old" commands were not defined (and Dylan picked up on that instantly! Thanks.)

    Thoughts? Ideas? What's next? Tomorrow we will attach the MAWD.

    Mark
  • Justin AbbottJustin Abbott Posts: 54
    edited 2010-06-09 19:26
    F.F.F. or Form Follows Function

    Occam's Razor is a meta-theoretical principle that means to not add something unless it is neccessary. The form of the ASP follows the function of Occam's Razor to not add anything to it that we don't need since space is very limited. This is the restriction that we have that prevents us from putting the CO2 sensor in many spots where the wires can easily access the breadboard.
  • Mark in NHMark in NH Posts: 447
    edited 2010-06-09 19:54
    Sylvie,

    · You said:
    ·
    1) So don't go mounting the sensor in your payload bay or anything like that yet: you're going to need to make some hardware changes/additions first.

    Thanks for the reminder. Yes, we're holding off on mounting the CO2 sensor on the ASP-2 for that, and other reasons. That's why we're just "plugging it into" the MAWD-BOE protoboard (see previously attached picture of BOE... with treads!)


    2) Setting it up... will involve more than just a change in the program - you'll need to wire the sensor to the BoE in a different manner, with additional parts.

    Egads!··freaked.gif· Additional parts!·Which? Where? We "wired" (plugged in)·the CO2 sensor to the MAWD-BOE as detailed previously (Vin to Vin, GRND to Vss, ALM and CNTL to P3 and P4.) But I'm not clear what additional parts we'll need. Can you clarify? Thanks.

    From the lab,

    Mark
  • Mark in NHMark in NH Posts: 447
    edited 2010-06-09 19:58
    Justin Abbott said...
    F.F.F. or Form Follows Function

    Occam's Razor is a meta-theoretical principle that means to not add something unless it is neccessary. The form of the ASP follows the function of Occam's Razor to not add anything to it that we don't need since space is very limited. This is the restriction that we have that prevents us from putting the CO2 sensor in many spots where the wires can easily access the breadboard.
    Justin,

    ·· 1) What does "meta-theoretical" mean?

    ·· 2) What does·"form follows function" mean and how does it apply to the ASP-2 and other engineering projects?

    ······ Occam's Razor, simply put, says that "Simpler is often better." (P.S. - Don't try shaving with Occam's Razor!)

    Keep up the excellent work, team~ ! Great progres today, and excellent participation.

    Mr. Kibler
  • Dylan LandryDylan Landry Posts: 235
    edited 2010-06-09 20:54
    Dear Dr. Allen,

    Here are my answers to your questions..


    -- Is it right to say that the gas is still 1% (10000 ppm) CO2?

    When you take out 1/2 of the gases your are simulating the ASP being far up into the atmosphere. As you raise in altitude, atmospheric pressure decreases. But you are not letting out any gases what so ever. There for the concentrations of the gases stay the same. But are you keeping the same amount of gas all the way up?
    No. You are letting out 1/2 of the total amount of gases. But will that change the PPM?
    No. Referencing back to 5th grade, the rule ,"What ever you must do to one side you must do to the other" still apply. If you have a bag of marbles with 90 red, 8 green, and 2 blue (plus it can only hold 100 marbles), and you take 1/2 of them out you now have 45 red, 4 green and 1 blue. ***BUT*** "What ever you must do to one side you must do to the other". You also have to decrease the capacity by 1/2. Run the the percentages again. It is still 1%.
    -- Will the reading from test point TP1 change? (10000ppm).
    No. You are keeping the same volume of CO2 as you had in the beginning. Even though you are taking 1/2 out, PPM is by volume.
    -- What does that have to do with rockets?
    As you rise in altitude, atmospheric pressure decreases.

    P.S. Dr. Allen, when Justin also showed me the programs today, in V.2, I was looking for trouble shooting errors. The first thing i found was the the, "New" variable was not defined. I believe that you also noticed this.

    Dylan Landry
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-06-09 21:59
    Mark in NH said...

    Egads!··freaked.gif· Additional parts!·Which? Where? We "wired" (plugged in)·the CO2 sensor to the MAWD-BOE as detailed previously (Vin to Vin, GRND to Vss, ALM and CNTL to P3 and P4.) But I'm not clear what additional parts we'll need. Can you clarify? Thanks.
    I'm not sure that I want to spoil Tracy's surprise·· tongue.gif , but I was hinting at this a couple of pages back when I pointed out that you're going to get a test point (TP1) to have a voltage that varies with the CO2 content, but that the BS2 cannot read a variable voltage. Once upon a time, several pages back, there was a brief mention of an analog to digital converter. Unless Tracy has some top secret semi-magical method I'm unaware of, you are, in fact, going to need one of those, and perhaps a couple of supporting parts (capacitors and resistors).

    You can send serial data to a BS2 pin - we're doing that with the MAWD.
    You can send on/off signals to the BS2 pin - that's what the CO2 sensor's alarm does.
    You can send various other _digital_ data formats, such as timed pulses.

    But you cannot send a variable voltage to a BS2 pin and expect the BS2 to be able to tell anything about that variable voltage. All of the BS2 pins are digital I/O: none are analog.

    If you only want to read the alarm status, you don't need anything extra, but if you want your BS2 to know what voltage is on that TP1 point (that is, if you want the BS2 to know the CO2 content), you will need something that can read an analog voltage and turn it into a digital number. Here's the good news: that'll cost you only $3.47:

    http://www.parallax.com/Store/Components/AllIntegratedCircuits/tabid/154/CategoryID/31/List/0/SortField/0/Level/a/ProductID/575/Default.aspx
  • Justin AbbottJustin Abbott Posts: 54
    edited 2010-06-10 00:12
    Mr. Kibler,

    Metatheoretical is a theory of a theory.

    Form follows function is a principle associated with the shape of a building. It means that the building should be based on its intended purpose. This means that the ASP 2 should be built to read CO2 levels as simple as we can build it. This goes for any engineering project: to be made as simple as possible but still be able to carry out its task.

    Justin
  • Andrew (ARLISS)Andrew (ARLISS) Posts: 213
    edited 2010-06-10 00:48
    sylvie369 said...
    Mark in NH said...



    Egads! freaked.gif Additional parts! Which? Where? We "wired" (plugged in) the CO2 sensor to the MAWD-BOE as detailed previously (Vin to Vin, GRND to Vss, ALM and CNTL to P3 and P4.) But I'm not clear what additional parts we'll need. Can you clarify? Thanks.


    I'm not sure that I want to spoil Tracy's surprise tongue.gif , but I was hinting at this a couple of pages back when I pointed out that you're going to get a test point (TP1) to have a voltage that varies with the CO2 content, but that the BS2 cannot read a variable voltage. Once upon a time, several pages back, there was a brief mention of an analog to digital converter. Unless Tracy has some top secret semi-magical method I'm unaware of, you are, in fact, going to need one of those, and perhaps a couple of supporting parts (capacitors and resistors).


    You can send serial data to a BS2 pin - we're doing that with the MAWD.

    You can send on/off signals to the BS2 pin - that's what the CO2 sensor's alarm does.

    You can send various other _digital_ data formats, such as timed pulses.



    But you cannot send a variable voltage to a BS2 pin and expect the BS2 to be able to tell anything about that variable voltage. All of the BS2 pins are digital I/O: none are analog.



    If you only want to read the alarm status, you don't need anything extra, but if you want your BS2 to know what voltage is on that TP1 point (that is, if you want the BS2 to know the CO2 content), you will need something that can read an analog voltage and turn it into a digital number. Here's the good news: that'll cost you only $3.47:



    http://www.parallax.com/Store/Components/AllIntegratedCircuits/tabid/154/CategoryID/31/List/0/SortField/0/Level/a/ProductID/575/Default.aspx
    Sylvie,

    This is beginning to make sense to me now, now that I take a look at the bigger picture and the questions Dr. Allen asked earlier. We definitely want the readout of CO2 data, as the alarm status does us very little use right now, although it is great to see it working. I'll try not to get ahead of myself on this, but I'm guessing without even looking at the breadboard, that the A/D converter would most likely need to be mounted elsewhere because of lack of space remaining on the breadboard.

    To everyone else, I've attached a revised program of the one that Mr. Kibler attached earlier. It is basically the MAWDBOE program with very primitive support for the CO2 sensor. I changed a few things that seemed obvious enough, but other than that, my programming knowledge isn't good enough to figure out the rest. Here's what I did...

    Completed:
    - commented out several "DEBUG" lines in "Carbon_collect" subroutine (aren't applicable anymore)
    - moved "GOSUB" for "Carbon_collect" before the debug command (didn't seem logical the way it was)
    - other small cleanup changes

    What needs to be done (I think):
    - create variable to store CO2 value
    - add that variable to "V_write_record" routine
    - add that variable to output to the debug window
    - anything else...?

    The program's syntax is valid, and still fits on the EEPROM of a BS2. I just ran it on my empty homework board, and the basic functions still work, despite having no sensors at the moment. You can try to run it on the ASP or CO2 board, but there shouldn't be any difference regarding CO2 output (yet) because nothing has been changed as far as the datalogger or debug commands.

    Thank you,
    Andrew
  • edited 2010-06-10 00:55
    Dr.Allen,
    Here are my answers to your questions:
    -- Is it right to say that the gas is still 1% (10000 ppm) CO2?
    No because you sucked out half of the gas. So you would be taking away half of the 10000 ppm and you would have 5000 ppm left over and you would 0.5%.
    -- Will the reading from test point TP1 change?
    I am not sure about this one. What does everyone else think?
    -- What does that have to do with rockets?
    Like what Dylan said, atmospheric pressure decreases as altitude goes up.

    Sean
  • Dylan LandryDylan Landry Posts: 235
    edited 2010-06-10 00:59
    Dear Andrew,
    The reason why we moved the Carbon_collect command was because where it was it would interfere with the debug command that formatted all the information. With where it was before it would display...

    Time (sec) Sample# Temp(C) Humidity(%) Altitude(ft)
    00:09 1CO2 levels NOMINALCO2 levels NOMINALCO2 levels NOMINALCO2 levels NOMINALCO2 levels NOMINALCO2 levels
    CO2 levels NOMINALCO2 levels NOMINALCO2 levels NOMINALCO2 levels NOMINALCO2 levels NOMINALCO2 levels NOMINAL
    CO2 levels NOMINALCO2 levels NOMINALCO2 levels NOMINALCO2 levels NOMINALCO2 levels NOMINALCO2 levels NOMINAL.....


    So we moved it after the debug command that formatted all the information so at least it would get one reading out before it entered the loop.
    Dylan Landry
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-06-10 01:53
    Andrew (ARLISS) said...
    Sylvie,

    This is beginning to make sense to me now, now that I take a look at the bigger picture and the questions Dr. Allen asked earlier. We definitely want the readout of CO2 data, as the alarm status does us very little use right now, although it is great to see it working. I'll try not to get ahead of myself on this, but I'm guessing without even looking at the breadboard, that the A/D converter would most likely need to be mounted elsewhere because of lack of space remaining on the breadboard.
    Andrew -

    Good. I agree that you're not going to be able to put the A/D converter onto your existing breadboard, based on that photo back on page 1 of this thread. Again, I think you should want to hear from Tracy about how best to do this, but I'd expect to put together another board that holds the sensor, the A/D converter, and any resistors or capacitors needed. There are numerous A/D converter chips available - I just sent a link to one that has good resolution, "plays well" with the BS2, and doesn't cost much. There's also·a good sample·program for connecting it to a BS2 on the product page. The code is VERY simple, and the sample code should·only need small changes to work with your sensor. But there may be a reason that you need a different one - let's hear from Dr. Allen about that.

    You only need one channel of A/D conversion, so you should be able to make do with an 8-pin DIP chip (like the one I linked to). They're tiny, so I'm sure you'll have the room that you need.
  • Tracy AllenTracy Allen Posts: 6,641
    edited 2010-06-10 07:38
    Here was the homework and my own answers:
    Suppose you have a container that has carbon dioxide gas in air, say 1% (10000 ppm). Suppose you put your ASP in the container at atmospheric pressure and then suck out 1/2 of the gas, so the new pressure is 1/2 atmosphere.
    1-- Is it right to say that the gas is still 1% (10000 ppm) CO2?
    2-- Will the reading from test point TP1 change?
    3-- What does that have to do with rockets?


    1 --- Consider Dylan's answer with the marbles: If you have a bag of marbles with 90 red, 8 green, and 2 blue (plus it can only hold 100 marbles), and you take 1/2 of them out you now have 45 red, 4 green and 1 blue... Run the the percentages again. It is still 1%. . That is a good picture. The proportion of CO2 molecules does not change when 1/2 of the gas is removed. (assuming the process doesn't choose molecules by "color". So, still 1%, 10000 ppm.

    2 --- This is a trick question! With a scientific point to be made. The graph that we have been referring to shows how the voltage output of the sensor depends on the ppm of CO2 in the gas, right? So from the voltage you can find the ppm. Yes, but look at the following equation from the MG-811 data sheet on how the sensor works:

    attachment.php?attachmentid=71099

    This says that the voltage output depends on the partial pressure of the gas. That is not the same as ppm. In a mixed gas, say carbon dioxide 1% in air, part of the pressure comes from the CO2 and lions share comes from the 99% air. The part that comes from CO2 is its partial pressure. Back to our container, if we remove 1/2 of the gas, both the total pressure and all its partial pressures drop to 1/2 of the value they had before sucking out the gas. So... the reading on the sensor should change, following along with the partial pressure. But what's up with the graph that says the sensor reading depends on ppm? My guess is that the graph assumes one atmosphere pressure, and then a change in ppm does show up as a change in the partial pressure of CO2, which does affect the reading. The graph is meant for earthbound souls, not for rocketeers.

    3 --- You understood the 3rd question well. Atmospheric pressure decreases with altitude. Your rocket will not get high enough to experience 1/2 atmosphere, but it may get high enough to experience 2/3 atmosphere. Am I right or wrong about that? But the new question is, will the reading on the CO2 sensor change simply because of the changing altitude, even if the ppm remains exactly the same as different altitudes? (Maybe the ppm too changes with altitude. That was the subject of an earlier question.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 6/11/2010 9:15:59 PM GMT
    787 x 115 - 19K
    407 x 62 - 5K
  • Tracy AllenTracy Allen Posts: 6,641
    edited 2010-06-10 07:58
    Andrew, I'm glad the bigger picture is making sense to you about the difference between the actual CO2 level and the alarm status and other things. Thanks too for the boost in that direction Sylvie!

    You only need to change the carbon_collect subroutine as follows:
    ' -----[noparse][[/noparse] Carbon dioxide ]-----
    Carbon_collect:
       HIGH 4 'This activates the Heat Switch (HSW=CNTL)
        DEBUG TAB BIN1 IN3 'This displays the alarm status.
                      '1 = CO2 concentration is above threshold.
                      '0 = CO2 is below threshold
       RETURN
    


    All I did was to dispense with the DO and LOOP that had framed the original routine and made it repeat over and over. The long DEBUG statements are gone, and there is a TAB before the data in the current output. That is consitant with the tabs between other data points. The heat switch is going to say on. I will not take long to have this data recorded on the flash drive. But right, to get the quantitative data on CO2, You are going to need an Analog to Digital converter.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Tracy AllenTracy Allen Posts: 6,641
    edited 2010-06-10 16:35
    You want to add the CO2 data to the file on the thumb drive? Here are two program changes that do that. This will just be the alarm status 0 or 1 for now, but let's leave enough space to store the partial pressure or ppm.

    It turns out that you have plenty of variable space left, at least 4 Word size variables. We are going to make a new variable to store the CO2 reading. I've called it "CO2pp" and it is a WORD variable. Change #1 is the carbon_collect subroutine, and change #2 is in the V_write_record subroutine, as follows. This passes the syntax check, but of course I am counting on you to test it, to

    ' -----[noparse][[/noparse] Carbon dioxide ]-----
    CO2pp        VAR WORD    ' <--- new variable!!!!!
    Carbon_collect:
      HIGH 4 'This activates the Heat Switch (HSW)   ' <--- this does not really need to be repeated, but it doesn't hurt
      CO2pp = IN3           ' read the CO2 level.  Later, we will make this do more than just the alarm status
      DEBUG TAB, DEC CO2pp   ' show the CO2 level
      RETURN
    




    V_write_record:
    ' Write data with time to flash drive
     LOW RTS
      SEROUT TX\CTS, vBaud, [noparse][[/noparse] $8,$20,0,0,0,35,CR, HEX2 hour, ":" , HEX2 minute, ":", HEX2 second, "," , 
          degC.BIT15*13+32,DEC3 ABS (degC/10),".", DEC1 ABS degC,",",DEC3 (RH/10),".",
          DEC1 RH,",", DEC5 feet,",",DEC5 CO2pp, CR, LF]
      HIGH RTS
      GOSUB V_purge
      RETURN
    


    Note that there are now 35 bytes in each record, which is 6 more than there were without the CO2 reading. I allowed a comma and six digits for the CO2 reading. See the 35 in the SEROUT? See the new comma and six digits for the CO2pp reading?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 6/11/2010 9:10:14 PM GMT
  • Mark in NHMark in NH Posts: 447
    edited 2010-06-11 00:23
    Andrew,
    ·
    ·· I hope you don't mind that I posted your e-mail (and the attached photo) on the forum so that your teammates (Dr. Allen and Sylvie included) will be sure to see it. You've really come into your own this year as a true Team Captain! You're doing an outstanding job of organizing your team and leading by fine example by coordinating their efforts and working with Dr. Allen to get the program written. You've been with the TARC, SLI and now the ARLISS projects long enough to see that this is by far our most active and involved project year. I credit much of the participation to your leadership. Keep up the excellent work Andrew. It bodes well for your future!
    ·
    I actually can't wait for our next "all team" practice and (I can't believe I'm saying this!) I'm genuinely sad that the school year in ending in three days.· Now that things are REALLY rolling I wish we had more "build" time together! Think about when you might able to meet after school ends during the week so we can squeeze a few more pratices in if you'd like.
    ·
    Rocketeers,
    ·
    Follow Andrew's leadership and fine example. We, and the ASP-2, WILL return to the Nevada skies in September! Maybe Sylvie and Dr. Allen could even join us. That would soooooooooo awesome!
    ·
    **Be sure to answer Dr. Allen's and Sylvie's homework questions promptly and accurately, and be sure to thank them often for their time and guidance.
    ·
    Aim high,
    ·
    Mr. Kibler
    ·


    ·
    From Andrew:
    ·
    Project team,
    ·
    We've had some great participation and conversation happening in the forum recently. If you've been keeping track of what is going on, you will see that Dr. Allen recently posted suggested tweaks to make to our version of the experimental MAWDBOE with CO2 program. I have added those changes into the program, and it appears to work! I don't have a CO2 sensor on my testing board, so I just have an empty value, but it is successfully integrating with the debug window, and *should* be working with the data logger! See the attached program "MAWDBOE_w_CO2_June10.bs2" and a screenshot of it, "mawdboeco2.png".
    ·
    However, as you know, this is only the alarm status -- a binary '1' or '0' to tell us if the sensor has detected levels of carbon dioxide above our preset limit. As Dr. Allen hinted to us several pages ago, we will need to integrate an analog-to-digital converter to read out the actual level of carbon dioxide.· Attached is the specification sheet for the Microchip-brand A/D converter, a whopping 32 page document (attached) for a chip the size of a fingernail. Let's hope it wont be too difficult to integrate! Also, as I previously mentioned on the forum, we will be needing to consider where we will put this. There is no room on the breadboard, and there is the possibility for additional pieces such as resistors, capacitors, wires, etc... in order to get the A/D converter working. Think about this now, so it doesn't catch us by surprise when we install it.
    ·
    Thanks,
    Andrew
    226 x 157 - 26K
  • edited 2010-06-11 02:26
    Sylvie,

    Do you have an idea of any resistors or capacitors that we will end up needing?

    Thank you all for your time and help,

    Sean
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-06-11 04:08
    Sean from ARLISS-NH said...
    Sylvie,

    Do you have an idea of any resistors or capacitors that we will end up needing?

    Thank you all for your time and help,

    Sean
    Dr. Allen is still working with you to understand the sensor, and that's going to partly determine which A/D chip you use. Once you know which chip you're going to use, the chip's datasheet will tell you which resistors and capacitors you will need, if any. There's a fair chance, I think, that you won't need any, but that remains to be seen. You will also need to figure out how to power the chip and to provide it a reference voltage (probably just your Vdd). All of that will also come from the chip's datasheet.

    You don't need to be too concerned about this right now. Whatever external parts you need (if any) will be easily available and very cheap. I did just want to make sure you were aware that you will need another chip, and also to make sure that you didn't get too far in mounting the sensor without attaching the A/D chip. It was starting to sound as though you guys thought that you could just attach the four pins, and then that reading the CO2 level would be just a matter of programming.

    I think you'll be happy with how easy it is to integrate an A/D chip to your system. There'll be some math involved in figuring out what the readings mean, but the wiring and BS2 <--> A/D chip communication should be pretty straightforward.
    =================
    You guys would love this - the Navy Blue Angels have been flying over my house most of the afternoon, practicing for a weekend air show here.
Sign In or Register to comment.