··· A quick update (*since it's the last day of school and things are "busy", though other words apply!)
Your program fix, fixed the program! Justin and Dylan downlaoded it and added it into the main program·this morning. The 1's appear as 1's when the CO2 sensor is in "Alarm" status, and the·0's appear as 0's when CO2 is below threshold. They're learning how to calibrate the sensor nicely.
Now they're diagramming where all the wires from the AD converter go by interpreting your, and Sylvie's, instructions and then making a diagram on graph paper. We're scratching our collective heads about a few things but I'll wait until they finish the diagram before they ask questions so you can see a scanned copy of the diagram. Tonight is 8th grade "celebration" and tomorrow we take the kids to the lake. The ASP will probably go along (though I hope it doesn't try to swim...!)
Sorry, there was a glitch with the display in my previous post, corrected now.
Ah, so now you can see the 0 and 1 of the alarm status in the program, that's great! Have you also looked to see if that 0 and 1 appears in the USB datalogger file?
Define: "resolution 12 bits" as it applies to the MCP3202 and the CO2 sensor.
This means that the analog to digital converter divides up the range between 0 and 5 Volts into 4096 steps. Each step will be 5000 mV / 4096 steps = 1.2207 mV per step. Check my math! To put it another way, if the output from the TP1 on the CO2 sensor is 0.65 Volt, then the digital reading returned by the MCP3202 will be,
650 mV / 1.2207 mV = 532 or 533.
Homework question:
The number returned by the MCP3202 is 328. What is the voltage output from the CO2 sensor?
Dr. Allen, Sylvie, and ARLISS team members, ·· This is Chris Kibler. I think Dr. Allen wants us to use math to figure out the answer. But checking the answer by looking at the "mV-CO2 concentration" graph·was a good idea. Here's what I got for an answer, and the calculations to·support·my answer. Andrew, Dylan, Justin, and Sean, you might want to double check the math just to be sure.
(x)/(1.2207) = 328 . Multiply both sides by 1.2207 to isolate x
so
(x) = 328(1.2207)·which is the same as·328 x 1.2207·
so
x = 400.3896 = 400.4
Looking at·the graph isn't precise enough. I·think Dr. Allen and Sylvie would like a more precise answer. They're also teaching you how to use and apply math like my·Dad does in your Science class. I'm sure he asks you to "Show your work" ('cause he always tells me to do the same thing.)·You need to be able to·calculate what any given value in the equation is by working the equation both ways. You guys are doing really well with this year's project. I wish I could go to Nevada with you.
That's right. 328 * 1.2207 = 400.3896, which rounds off to 400. That's milliVolts. On the Stamp, you will need to multiply the result returned from the MCP3202 times 1.2207 to find the mV that is being sent by the CO2 sensor. Are all rocketeers with us so far?
The BASIC Stamp has to pull a trick to multiply times a fraction. I know you have this trick lurking in the ASP program already, because it is used for the SHT11 temperature/humidity sensor. The secret is the Stamp's ** operator. Here is a demo calculator program that multiplies any number that you enter at the keyboard (within limits) times 1.2207:
' {$STAMP BS2}
' {$PBASIC 2.5}
wx VAR WORD
wy VAR WORD
top:
DEBUG CR,CR,"Enter a number from 0 to 53687> "
DEBUGIN DEC wx
wy = wx ** 14464 + wx
DEBUG CR,"..... ", DEC wx, " * 1.2207 = ",DEC wy
IF wx>53687 THEN DEBUG BELL," =!overflow error!=",BELL
GOTO top
Try to run this program and see what you get when you enter the following numbers, and others if you want:
1000
10000
4096
40960
53687
53688 huh?
100000 huh?!
Does it give the correct answer that you expect? We will have to do more tricks like this to go from milliVolts to the ppm or partial pressure of CO2, which is what you want to see in your data file.
Each step will be 5000 mV / 4096 steps = 1.2207 mV per step. Check my math!
Homework question:
The number returned by the MCP3202 is 328. What is the voltage output from the CO2 sensor?
Dr. Allen,
·· I was on the rocketry team four years ago when·you started·teaching us·how to program our home-made robot for the NASA-SLI project. I just graduated from high school and I'll be attending·George Washington University in the fall. I'll be studying International Relations. The fact that I was on the rocketry and robotics teams helped me get admitted. Thank you so much for all your help.
I checked your calculations like you asked and they are accurate:
Your math is correct. After I saw your answers, I checked them over 3 times with the same formula (as Mr. Kibler suggests) and the answer remained consistant throughout. Both the graph and the formula get the same answers, the formula gives you a more accurate and precise answer (as Chris previously says).
Question to everyone:
Today at the lake Mr. Kibler, Dylan and I were trying to figure out what capacitors to use. Though this isn't the most important thing to think about right now (Mr. Kibler says to keep it in the back of your head sometimes until later) we were wondering how do you read capacitors? Do they have a color scheme like resistors do and a table to read them? What do the numbers mean on them? Because I remember the one I was holding had 104 and the one Dylan had was a mix of several numbers and words scrambled together.
We will have to do more tricks like this to go from milliVolts to the ppm or partial pressure of CO2, which is what you want to
see in your data file.
' {$STAMP BS2}
' {$PBASIC 2.5}
wx VAR WORD
wy VAR WORD
top:
DEBUG CR,CR,"Enter a number from 0 to 53687> "
DEBUGIN DEC wx
wy = wx ** 14464 + wx
DEBUG CR,"..... ", DEC wx, " * 1.2207 = ",DEC wy
IF wx>53687 THEN DEBUG BELL," =!overflow error!=",BELL
GOTO top
ROCKETEERS,
··This (above) is tonight's homework. You will each need to use the Parallax BOE you were given in order to complete it. Remember when we discussed how the program will need to use an algorithm? The program that Dr. Allen wrote for you (above) contains an algorithm, one of many the program uses. It multiplies whatever number you enter by the constant "1.2207" and then shows you the answer. Start by using the numbers below, then try your own numbers. Please be sure to post your answers. Andrew, guide your team in this direction.
I'll be at school the next two days wrapping things up for the year. Even though "school's out for the summer" you're welcome to come in and work on wiring the CO2 sensor, the ASP-2 and deciphering program code. Please let me know ahead of time·if you will be coming and always come with a teammate.· You know the lab safety rules: "No one works in the lab alone"... even when I'm in the lab. It's the wise and prudent thing to do.
Remember that we have an "all-team" practice on SATURDAY··· from 1:00 - 4:30 PM, NOT Sunday (which is Father's Day.) Chris and Mrs. K are taking me out to breakfast and then he and I fly to Washington for his college orientation.
Our goal is to have the CO2 sensor all wired and connected to the ASP-2 before Saturday. You'll need to figure out whether the "104" capacitor in your bag of parts is the right capacitance, and where all the wires go. The diagram you made in class in a really good start.
So, using the STAMP's logic and my very basic understanding of what is going on in the STAMP's "mind", those answers seem to make sense up to 100,000, where it defaults to 34464 as a value, at which point I'm rather confused. To other team members: what did you get for results, and what do YOU think?
Yes, it's curious that the program gives an "overflow error" for 53688 but not for a larger number (100,000). Hmmm.... I also wonder why. It seems that the maximum number it will accept without "overflowing" is 53687.
So how do you think this homework assignment relates to what we're wokring on right now? How is it relevant? HINT: It's not an abstract assignment just to fill our idle time!
Today I was able to talk to the Captain for John Stark Regional High School robotics team that one the First Robotics tournament not to long a ago. I asked him about reading capacitors and he replied, "They can be confusing at first sight. Usually they are labeled with the basic understanding of the amount of capacitance , (like color strips on a resistor). But they are always off on the correct number."
If anyone is interested they are free to join as a freshmen. They run through out almost the entire year. But this project comes first.
P.S. Mr. Kibler: My mom might be able to get a donation from the company that is building plasma engines for future "mars" space shuttles for NASA. I forget the name though.
• µF a unit of capacitance, microFarad. micro=10-6, nano=10-9, pico=10-12, femto=10-15
abbreviated µF, nF, pF, fF.
micro-micro is the same as pico.
The range of capacitance found in electronics for different purposes spans over 15 orders of magnitude.
• The 0.1 µF value is very common on electronic circuit boards.
You will see it marked "104" which is its value in units of pF.
That means,
. . . 10 * 104 pF
. . . = 105 pF
. . . = 10-1 µF ' note the change of units, where 1 µF = 1000000 pF.
. . . = 0.1 µF.
The capacitor you use with the MCP3202 analog to digital converter should say "104". It is a 0.1 µF capacitor.
There may be other letters or words printed on the capacitor. Those are the type of material that is used to construct it, the temperature characteristics, or things like the manufacturer logo or date.
The value is often printed in units of pF, but you will see other units too, for example, a large capacitor in a can might have the value printed, for example, 100 µF. Or a very small capacitor might have the value printed directly in pF, for example, "33" for 33 pF. Some old old capacitors do have color bands, but those are very rare now. Surface mount capacitors usually don't have anything at all written on them! You have to have a meter or a diagram to figure out what they are.
The BASIC Stamp works with numbers (WORD variables) of 16 bits. That covers numbers from 0 to 65535. When the Stamp encounters a number that would be larger than that on your calculator, well, it just wraps around, and that may count as an error. (Not always though!)
The value wy = 53687 ** 14464 + 53687 works, because it equals 65535 (having dropped the remainder) and that fits in a Word.
The value wy = 53688 ** 14464 + 53688 on the other hand would equal 65537 (if it could) but it wraps around by dropping the overflow bit 17 and fits it into 16 bits, which comes out as 1. Error!!
...%10000000000000001 <--- 17 bits, value 65537
...%0000000000000001 <--- 16 bits, Stamp drops the 17th, value 1
When you enter 100000 at the keyboard, the internal conversion routines can't fit that into a WORD, and it ends up dropping the highest bit. 34464 is equal to 100000 - 65536. That is how it fits it into the WORD variable. Error!
...%11000011010100000 <--- 17 bits, value 100000
%1000011010100000 <--- 16 bits, Stamp drops the 17th, value 34464
Math on the BASIC Stamp has to keep within the limits that the Stamp brain can handle!
Your ASP-2 will collect readings in the range of 0 to 4095 from the MCP3202 analog to digital converter. Those numbers are well within bounds of one WORD. However, we will have to be careful when multiplying and adding values.
...When the Stamp encounters a number that would be larger than that on your calculator, well, it just wraps around, and that may count as an error. (Not always though!
Tracy,
· Thanks for·your excellent explanation about how and why we get an "overflow error" with some, but not all, the numbers we enter. Dylan asked this exact question when he completed your homework exercise·in class today. I understood what was happening theoretically but I couldn't explain it as eloquently as you did.
Yes, we when entered "53687" it·showed that the·sum of 53687 * 1.2207 = 65535. And when we entered "53688" it gave the "overflow error" as you and Andrew showed. While I knew that numbers were "wrapping around", I couldn't explain why, when we entered 100,000 (a number larger than 53687) it gave a sum LOWER than the sum of 53687 * 1.2207 (4096 or thereabouts as I recall.)·Your explanation, explains it·clearly.·Thanks!
Dylan (Justin, Sean, Mike, Andrew,·Chris)·please go ahead and ask Dr. Allen the questions you asked in class today,and by e-mail. You should be able to answer some of·them by reading his explanation. But I want you to engage in professional dialogue with experts so that you learn how to articulate questions and answers. "Articulate" is what I mean in class when I ask you to write answers that are "clear, simple, and precise."
You are also learning about "networking". Networking is communicating and working with real experts and professionals in "the real world", not just one teacher inside a classroom (or at the dining room table on a Sunday afternoon as the case might be.)·Networking, communication, and collaboration are valuable skills that transcend designing and building the ASP-2. They are·genuine (and valuable) life skills. Keep up the good work. Then read my next post to Dr. Allen.
·· Thanks so much for your patience in working wth and guiding the Rocketeers. They're such good kids... stereotypic teenagers in many ways, pulled in so many directions by so many different things. Today (their last day of school) there was a mountain bike ride down through a state forest and I could see that some of the Rocketeers wanted to be in·two places at once: at the computer, and on the seat of mountain bike!
We (and we truly are a team, you, Sylvie, I and others) do well to keep these kids' interest and focus when there are so many idle and dangerous·distractions "out there." The Rocketeers·may not realize that they're accomplishing·so much·all at once (getting a high-end education them, guiding their own futures, and·staying out of harm's way) but we do. The ASP-2 is simply the vehicle for the learning.·Thank you for inspiring the next generation of engineers and scientists! Thank you for being one of the most excellent teachers I have ever known. Your dedication and commitment inspires me to do even more.
OK, so here's where we are currently with the hardware end of the ASP-2:
1) We·fabricated a Y-shaped 2-wire to 1-wire lead. It has a 1 k-ohm resistor at the 1-wire end. The two wires go into the breadboard holes next to Din and Dout. The 1-wire end goes to either p6 or p14. Does this sound right so far?
2) We fabricated a 1-wire lead with a "104" capacitor in the middle. According to Sylvie "...one lead of the capacitor [noparse][[/noparse]the wire we made] goes to your A/D chip's Vdd pin, and the other to ground. If you're like me, that'll sound nuts - like you're shorting things out - but it's correct." Is the "ground" he's referring to the Vss on the BOE? Sylvie, help!
3) The next (and last?) wire goes to p6 or p14 (whichever we didn't use in step #1 above.) I forget which AD pin it comes from... don't have the diagram right in front of me. Should this wire also have a resistor in-line? A capacitor? (or a "flux-capacitor" so we can go "Back to the Future?!")
4) What can we do to hekp with programming?
Mrs. K says "dinner's on!"
Ciao! (a double entendre),
Mark
from the AD converters Vdd pin to ground (Vss??)·(Thanks too, for the explanation about how the capacitance is shown on the capacitor. It·prompted a dialogue aout the same with our IT guy. The conversation ended with an explanation about why it might not be such a good idea to put a capacitor on your tongue... until you know what the numbers mean!)
PS - Forgot to mention that we'll post a scanned copy of the diagram showing where (we understand) the wires should go, and JPEG's of the wires with resistors, etc. Then, for clarity, we'll upload JPEG's showing the stand-alone breadboard wired to the ASP. You should see them posted before Saturday's practice.
Attached is a picture of two of the (three?) wires that come from the analog-to-digital·(AD) conveter to the BOE (ASP-2.) It also shows which 'pin' they connect to on the BOE. Does this look right so far? Does the·2-into-1 wire for the "shared·pin" look right? The two wires are simply spliced together.
Mark
PS - Sylvie, is your ready rocket to launch this weekend? Are your electronics all ready? How high will it go? You mentioned a "low,slow" flight before. Be sure that your ISP > 9.8 m/sec/sec!
·· Thanks so much for your patience in working wth and guiding the Rocketeers. They're such good kids... stereotypic teenagers in many ways, pulled in so many directions by so many different things. Today (their last day of school) there was a mountain bike ride down through a state forest and I could see that some of the Rocketeers wanted to be in·two places at once: at the computer, and on the seat of mountain bike!
(snip)
2) We fabricated a 1-wire lead with a "104" capacitor in the middle. According to Sylvie "...one lead of the capacitor [noparse][[/noparse]the wire we made] goes to your A/D chip's Vdd pin, and the other to ground. If you're like me, that'll sound nuts - like you're shorting things out - but it's correct." Is the "ground" he's referring to the Vss on the BOE? Sylvie, help!
(snip)
Mrs. K says "dinner's on!"
Ciao! (a double entendre),
Nice (on the double entendre).
As for connecting the capacitor, one lead goes to the Vdd pin on the 3202, and the other goes to the Vss pin on the 3202. Those are diagonally opposite pins, which is a bit inconvenient, but you could have a ground rail closer to pin 8 (which is Vdd). These are Vdd and Vss on the _3202_, not on the BoE: you want the capacitor connected close to the 3202's Vdd pin, and not too far from its Vss pin. Distance matters here.
I took most of the day off to be on my bike, on a trail running from a town in southern Wisconsin into northern Illinois. Great ride, but I made a big mistake. I drove two hours to the trailhead, got my bike out, and rode right up a hill. I didn't think much of it at the time, but I wound up getting the mother of all leg cramps, and I'm so sore I can barely stumble around right now. It'll be better in the morning. Let that be a lesson to the students: don't get old.
PS - Sylvie, is your ready rocket to launch this weekend? Are your electronics all ready? How high will it go? You mentioned a "low,slow" flight before. Be sure that your ISP > 9.8 m/sec/sec!
I'm ready to fly the older GPS device this weekend, probably on a J500 (Aerotech Mojave Green) to about 2600 feet. But I also volunteered to supervise two L1 certification flights, and those have to come first. And of course weather makes all the difference.
I'd been flying the rocket with just a standard altimeter on smaller I motors, but with all the gizmos and batteries in there, I have to bump up to larger motors just to fly safely.
The boards for my fancy newer GPS transmitter came a few days ago. I put one together - but it doesn't work right. It seems to be having a serious problem getting satellite lock. Eventually it does, after many many minutes, but even then loses lock again. I don't know what the problem is, but I suspect inadequate power supply. I'll take out the XBee radio and connect wires to send the GPS data directly to a serial port, and see if it works that way. The XBee transmits more-or-less constantly, which takes a lot of current. Maybe I can substitute a higher-current voltage regulator.
It's incredible that some of the·Rocketeers are here at school today since yesterday was the "last" day of school... I guess learning never end, huh?!
OK, attached are two pictures·showing where we understand the wires are supposed to go:
A) The two (orange) wires from the "Din and Dout" pins on the AD converter are spliced into one wire ("pin sharing".) The one wire has an in-line 1 K-ohm resistor.·This single wire then·goes to p6 or p 14 (or any available pins) on the BOE. Yes?
The yellow wire comes from the Vdd/ V-REF pin on the AD converter. It has a #104 capacitor in-line. It goes to "ground" on the BOE. We interpret this to mean that it goes to Vss (ground) on the BOE. Is this correct?
C) The single yellow wire has no resistor or capacitor on it. It geos from the AD converter's CS-bar/ SHDN pin to p6 or p14 (or any available pin ) on the BOE. So far so good?
Assuming the wires and wiring scheme ARE correct, we hypothesize that if·we were to connect the wires to the BOE as shown above, nothing should happen since p6 and p14 are not in the program yet. Should we put them into the program, or wait...
As for connecting the capacitor, one lead goes to the Vdd pin on the 3202, and the other goes to the Vss pin on the 3202. Those are diagonally opposite pins, which is a bit inconvenient, but you could have a ground rail closer to pin 8 (which is Vdd). These are Vdd and Vss on the _3202_, not on the BoE: you want the capacitor connected close to the 3202's Vdd pin, and not too far from its Vss pin. Distance matters here.
Let that be a lesson to the students: don't get old.
Sylvie,
· We read your post after we uploaded the photos. Sorry. We'll connect the wire from the Vdd pin on the 3202 AD converter to the Vss pin on the 3202 AD converter right now. Then we'll post updated pictures.
"Let that be a lesson to the students: don't get old."
Mr. Kibler said to tell you that he's working on an anti-aging device that both of you can use (he needs it for sure and it sounds like you might want to borrow it.) We're not sure if·Dr. Allen·needs it but you can try it out when it's done!
Attached are the new pictures with the yellow wire running from the 3202 AD converter's Vdd pin to its Vss pin, not to the BOE. The capacitor is close the the Vdd pin like you said. When we solder·the capacitor·to the perfboard there won't be a wire from the capacitor. The capacitor's "leg" will get soldered directly·to the perfboard beside the AD 3202 Vdd pin. Does·it look OK now? What happens if we connect it to the ASP-2 now? We don't think anything will happen. What happens if you put a capacitor on your tongue like a 9-volt battery?
Okay, I got my 3202s in the mail yesterday, and I just hooked one up with a couple of potentiometers on a breadboard to make sure I understand them. They work just fine.
Your photos suggest a couple of changes. First of all, the capacitor IS hooked up correctly, but you should shorten the wires on both sides considerably. Make it so that it is sitting just above the chip, with leads that reach to the appropriate holes, but without all of that slack. Now that being said,·I used a disk capacitor with 3/4" leads, and it worked fine. But you're not going to want all of that flopping around in the rocket anyway.
You have an orange wire going from your 3202 pin 1 to (eventually) a BoE pin that will be your chip select. Good.
You have an orange wire going from your 3202 pins 5 and 6, through a resistor, to (eventually) a BoE pin that will share Din and Dout responsibilities. Good.
** You still need another wire going from your 3202 pin 7 to a BoE pin. Pin 7 is the clk (clock) pin, and you will not be able to communicate with the 3202 without that wire.
Eventually you will also need to connect the TP1 test point on the CO2 sensor to one of the 3202's inputs channels on pins 2 and 3. You should expect to use pin 2, which is Ch 0. You could, for testing purposes, leave that off for now, and connect a variable voltage there like I did, with a potentiometer. By the way, the sensor, 3202, and BoE will all need to have their grounds connected together somehow.
My advice would be that you connect a 10K potentiometer (a little variable resistor - you can get 'em at Radio Shack, and you probably have one laying around from the Parallax kits you bought) so that you have a test voltage that you can control. You're going to want to know for sure that your A/D converter circuit is working, and that's a good way. An alternative would be to use a photoresistor, so that you can change the incoming voltage on that Ch 0 pin by moving your hand between the circuit and the light.
Then you can run the sample program on the 3202's product page, with the appropriate changes made to the pins you're using (it uses pins 0, 1, 2, and 3, and you're using different pins on your board), and make sure that everything reads okay.
======================
If you put a charged capacitor on your tongue, probably nothing will happen at all. If it's a larger capacitor with a bigger charge, you might feel it like a 9V battery. If it's larger than that, you might hurt yourself. If·the capacitor is·large enough, in fact, you might kill yourself, and there are capacitors large enough that you are recommended not to wear any jewelry while handling them - rumor has it that at least one person has lost a finger that way:
I prefer to put dry, red wine on my tongue, along with a meal prepared by a knowledgable chef who takes pride in his work. That can be electrifying as well, but in a safe way. The only thing you lose is your ability to eat McDonald's food.
That big capacitor I linked to is 400 Farads. Think about that - the one you're using is .1 uF, or 1/10th of 1/millionth of one Farad. That means (if I'm doing the math correctly) that the big capacitor is equivalent to 4 billion of the ones you're using. Yours is a very normal-sized one: the 400 Farad one is gigantic.
Post Edited (sylvie369) : 6/17/2010 5:03:31 PM GMT
Comments
··· A quick update (*since it's the last day of school and things are "busy", though other words apply!)
Your program fix, fixed the program! Justin and Dylan downlaoded it and added it into the main program·this morning. The 1's appear as 1's when the CO2 sensor is in "Alarm" status, and the·0's appear as 0's when CO2 is below threshold. They're learning how to calibrate the sensor nicely.
Now they're diagramming where all the wires from the AD converter go by interpreting your, and Sylvie's, instructions and then making a diagram on graph paper. We're scratching our collective heads about a few things but I'll wait until they finish the diagram before they ask questions so you can see a scanned copy of the diagram. Tonight is 8th grade "celebration" and tomorrow we take the kids to the lake. The ASP will probably go along (though I hope it doesn't try to swim...!)
Best,
Mark
Ah, so now you can see the 0 and 1 of the alarm status in the program, that's great! Have you also looked to see if that 0 and 1 appears in the USB datalogger file?
Define: "resolution 12 bits" as it applies to the MCP3202 and the CO2 sensor.
This means that the analog to digital converter divides up the range between 0 and 5 Volts into 4096 steps. Each step will be 5000 mV / 4096 steps = 1.2207 mV per step. Check my math! To put it another way, if the output from the TP1 on the CO2 sensor is 0.65 Volt, then the digital reading returned by the MCP3202 will be,
650 mV / 1.2207 mV = 532 or 533.
Homework question:
The number returned by the MCP3202 is 328. What is the voltage output from the CO2 sensor?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
If the MCP3202 returns a value of 328, then the voltage output from the CO2 sensor should, in theory, be 0.4V, or 400 mV. Is this correct?
Andrew
from the CO2 sensor?
A.) I believe, looking back at the graph is exactly 400 mV.
Dylan Landry
·· This is Chris Kibler. I think Dr. Allen wants us to use math to figure out the answer. But checking the answer by looking at the "mV-CO2 concentration" graph·was a good idea. Here's what I got for an answer, and the calculations to·support·my answer. Andrew, Dylan, Justin, and Sean, you might want to double check the math just to be sure.
(x)/(1.2207) = 328 . Multiply both sides by 1.2207 to isolate x
so
(x) = 328(1.2207)·which is the same as·328 x 1.2207·
so
x = 400.3896 = 400.4
Looking at·the graph isn't precise enough. I·think Dr. Allen and Sylvie would like a more precise answer. They're also teaching you how to use and apply math like my·Dad does in your Science class. I'm sure he asks you to "Show your work" ('cause he always tells me to do the same thing.)·You need to be able to·calculate what any given value in the equation is by working the equation both ways. You guys are doing really well with this year's project. I wish I could go to Nevada with you.
Chris Kibler
The BASIC Stamp has to pull a trick to multiply times a fraction. I know you have this trick lurking in the ASP program already, because it is used for the SHT11 temperature/humidity sensor. The secret is the Stamp's ** operator. Here is a demo calculator program that multiplies any number that you enter at the keyboard (within limits) times 1.2207:
Try to run this program and see what you get when you enter the following numbers, and others if you want:
1000
10000
4096
40960
53687
53688 huh?
100000 huh?!
Does it give the correct answer that you expect? We will have to do more tricks like this to go from milliVolts to the ppm or partial pressure of CO2, which is what you want to see in your data file.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Post Edited (Tracy Allen) : 6/15/2010 2:54:05 AM GMT
·· I was on the rocketry team four years ago when·you started·teaching us·how to program our home-made robot for the NASA-SLI project. I just graduated from high school and I'll be attending·George Washington University in the fall. I'll be studying International Relations. The fact that I was on the rocketry and robotics teams helped me get admitted. Thank you so much for all your help.
I checked your calculations like you asked and they are accurate:
5000 mV / 4096 steps = 1.2207 mV per step
5000/ 4096 = 1.220703015 = 1.2207
Chris Kibler
That is how I got my answer, you just happened to beat me to it.
Thank you all for your time and help,
Sean
Your math is correct. After I saw your answers, I checked them over 3 times with the same formula (as Mr. Kibler suggests) and the answer remained consistant throughout. Both the graph and the formula get the same answers, the formula gives you a more accurate and precise answer (as Chris previously says).
Question to everyone:
Today at the lake Mr. Kibler, Dylan and I were trying to figure out what capacitors to use. Though this isn't the most important thing to think about right now (Mr. Kibler says to keep it in the back of your head sometimes until later) we were wondering how do you read capacitors? Do they have a color scheme like resistors do and a table to read them? What do the numbers mean on them? Because I remember the one I was holding had 104 and the one Dylan had was a mix of several numbers and words scrambled together.
Thanks for the help,
Justin
·· This (above) is tonight's homework. You will each need to use the Parallax BOE you were given in order to complete it. Remember when we discussed how the program will need to use an algorithm? The program that Dr. Allen wrote for you (above) contains an algorithm, one of many the program uses. It multiplies whatever number you enter by the constant "1.2207" and then shows you the answer. Start by using the numbers below, then try your own numbers. Please be sure to post your answers. Andrew, guide your team in this direction.
I'll be at school the next two days wrapping things up for the year. Even though "school's out for the summer" you're welcome to come in and work on wiring the CO2 sensor, the ASP-2 and deciphering program code. Please let me know ahead of time·if you will be coming and always come with a teammate.· You know the lab safety rules: "No one works in the lab alone"... even when I'm in the lab. It's the wise and prudent thing to do.
Remember that we have an "all-team" practice on SATURDAY··· from 1:00 - 4:30 PM, NOT Sunday (which is Father's Day.) Chris and Mrs. K are taking me out to breakfast and then he and I fly to Washington for his college orientation.
Our goal is to have the CO2 sensor all wired and connected to the ASP-2 before Saturday. You'll need to figure out whether the "104" capacitor in your bag of parts is the right capacitance, and where all the wires go. The diagram you made in class in a really good start.
I'll look for your answers a·bit later.
Aim high,
Mr. Kibler
·
The almighty STAMP says...
1000 -1000 * 1.2207 = 1220
10000 -10000 * 1.2207 = 12207
4096 -4096 * 1.2207 = 5000
40960 -40960 * 1.2207 = 50000
53687 -53687 * 1.2207 = 65535
53688 -53688 * 1.2207 = 1 =!overflow error!=
100000 -34464 * 1.2207 = 42070 (defaults to 34464 for '100000'??)
A "real" calculator says...
1000 -1000 * 1.2207 = 1220.7
10000 -10000 * 1.2207 = 12207
4096 -4096 * 1.2207 = 4999.9872
40960 -40960 * 1.2207 = 49999.872
53687 -53687 * 1.2207 = 65535.7209
53688 -53688 * 1.2207 = 65536.9416
100000 -100000 * 1.2207 = 122070
So, using the STAMP's logic and my very basic understanding of what is going on in the STAMP's "mind", those answers seem to make sense up to 100,000, where it defaults to 34464 as a value, at which point I'm rather confused. To other team members: what did you get for results, and what do YOU think?
Andrew
Yes, it's curious that the program gives an "overflow error" for 53688 but not for a larger number (100,000). Hmmm.... I also wonder why. It seems that the maximum number it will accept without "overflowing" is 53687.
So how do you think this homework assignment relates to what we're wokring on right now? How is it relevant? HINT: It's not an abstract assignment just to fill our idle time!
What do you think we should do next, Captain...?·
Thanks for your lightning-fast answer.
Mr. Kibler
Today I was able to talk to the Captain for John Stark Regional High School robotics team that one the First Robotics tournament not to long a ago. I asked him about reading capacitors and he replied, "They can be confusing at first sight. Usually they are labeled with the basic understanding of the amount of capacitance , (like color strips on a resistor). But they are always off on the correct number."
If anyone is interested they are free to join as a freshmen. They run through out almost the entire year. But this project comes first.
P.S. Mr. Kibler: My mom might be able to get a donation from the company that is building plasma engines for future "mars" space shuttles for NASA. I forget the name though.
Dylan Landry
• µF a unit of capacitance, microFarad. micro=10-6, nano=10-9, pico=10-12, femto=10-15
abbreviated µF, nF, pF, fF.
micro-micro is the same as pico.
The range of capacitance found in electronics for different purposes spans over 15 orders of magnitude.
• The 0.1 µF value is very common on electronic circuit boards.
You will see it marked "104" which is its value in units of pF.
That means,
. . . 10 * 104 pF
. . . = 105 pF
. . . = 10-1 µF ' note the change of units, where 1 µF = 1000000 pF.
. . . = 0.1 µF.
The capacitor you use with the MCP3202 analog to digital converter should say "104". It is a 0.1 µF capacitor.
There may be other letters or words printed on the capacitor. Those are the type of material that is used to construct it, the temperature characteristics, or things like the manufacturer logo or date.
The value is often printed in units of pF, but you will see other units too, for example, a large capacitor in a can might have the value printed, for example, 100 µF. Or a very small capacitor might have the value printed directly in pF, for example, "33" for 33 pF. Some old old capacitors do have color bands, but those are very rare now. Surface mount capacitors usually don't have anything at all written on them! You have to have a meter or a diagram to figure out what they are.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
The BASIC Stamp works with numbers (WORD variables) of 16 bits. That covers numbers from 0 to 65535. When the Stamp encounters a number that would be larger than that on your calculator, well, it just wraps around, and that may count as an error. (Not always though!)
The value wy = 53687 ** 14464 + 53687 works, because it equals 65535 (having dropped the remainder) and that fits in a Word.
The value wy = 53688 ** 14464 + 53688 on the other hand would equal 65537 (if it could) but it wraps around by dropping the overflow bit 17 and fits it into 16 bits, which comes out as 1. Error!!
...%10000000000000001 <--- 17 bits, value 65537
...%0000000000000001 <--- 16 bits, Stamp drops the 17th, value 1
When you enter 100000 at the keyboard, the internal conversion routines can't fit that into a WORD, and it ends up dropping the highest bit. 34464 is equal to 100000 - 65536. That is how it fits it into the WORD variable. Error!
...%11000011010100000 <--- 17 bits, value 100000
%1000011010100000 <--- 16 bits, Stamp drops the 17th, value 34464
Math on the BASIC Stamp has to keep within the limits that the Stamp brain can handle!
Your ASP-2 will collect readings in the range of 0 to 4095 from the MCP3202 analog to digital converter. Those numbers are well within bounds of one WORD. However, we will have to be careful when multiplying and adding values.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
How high does a WORD go? What is the highest number in other words?
Sean
· Thanks for·your excellent explanation about how and why we get an "overflow error" with some, but not all, the numbers we enter. Dylan asked this exact question when he completed your homework exercise·in class today. I understood what was happening theoretically but I couldn't explain it as eloquently as you did.
Yes, we when entered "53687" it·showed that the·sum of 53687 * 1.2207 = 65535. And when we entered "53688" it gave the "overflow error" as you and Andrew showed. While I knew that numbers were "wrapping around", I couldn't explain why, when we entered 100,000 (a number larger than 53687) it gave a sum LOWER than the sum of 53687 * 1.2207 (4096 or thereabouts as I recall.)·Your explanation, explains it·clearly.·Thanks!
Dylan (Justin, Sean, Mike, Andrew,·Chris)·please go ahead and ask Dr. Allen the questions you asked in class today,and by e-mail. You should be able to answer some of·them by reading his explanation. But I want you to engage in professional dialogue with experts so that you learn how to articulate questions and answers. "Articulate" is what I mean in class when I ask you to write answers that are "clear, simple, and precise."
You are also learning about "networking". Networking is communicating and working with real experts and professionals in "the real world", not just one teacher inside a classroom (or at the dining room table on a Sunday afternoon as the case might be.)·Networking, communication, and collaboration are valuable skills that transcend designing and building the ASP-2. They are·genuine (and valuable) life skills. Keep up the good work. Then read my next post to Dr. Allen.
53687·*·1.2207·=·65535· = Mr. Kibler
·· Thanks so much for your patience in working wth and guiding the Rocketeers. They're such good kids... stereotypic teenagers in many ways, pulled in so many directions by so many different things. Today (their last day of school) there was a mountain bike ride down through a state forest and I could see that some of the Rocketeers wanted to be in·two places at once: at the computer, and on the seat of mountain bike!
We (and we truly are a team, you, Sylvie, I and others) do well to keep these kids' interest and focus when there are so many idle and dangerous·distractions "out there." The Rocketeers·may not realize that they're accomplishing·so much·all at once (getting a high-end education them, guiding their own futures, and·staying out of harm's way) but we do. The ASP-2 is simply the vehicle for the learning.·Thank you for inspiring the next generation of engineers and scientists! Thank you for being one of the most excellent teachers I have ever known. Your dedication and commitment inspires me to do even more.
OK, so here's where we are currently with the hardware end of the ASP-2:
1) We·fabricated a Y-shaped 2-wire to 1-wire lead. It has a 1 k-ohm resistor at the 1-wire end. The two wires go into the breadboard holes next to Din and Dout. The 1-wire end goes to either p6 or p14. Does this sound right so far?
2) We fabricated a 1-wire lead with a "104" capacitor in the middle. According to Sylvie "...one lead of the capacitor [noparse][[/noparse]the wire we made] goes to your A/D chip's Vdd pin, and the other to ground. If you're like me, that'll sound nuts - like you're shorting things out - but it's correct." Is the "ground" he's referring to the Vss on the BOE? Sylvie, help!
3) The next (and last?) wire goes to p6 or p14 (whichever we didn't use in step #1 above.) I forget which AD pin it comes from... don't have the diagram right in front of me. Should this wire also have a resistor in-line? A capacitor? (or a "flux-capacitor" so we can go "Back to the Future?!")
4) What can we do to hekp with programming?
Mrs. K says "dinner's on!"
Ciao! (a double entendre),
Mark
from the AD converters Vdd pin to ground (Vss??)·(Thanks too, for the explanation about how the capacitance is shown on the capacitor. It·prompted a dialogue aout the same with our IT guy. The conversation ended with an explanation about why it might not be such a good idea to put a capacitor on your tongue... until you know what the numbers mean!)
Mark
Attached is a picture of two of the (three?) wires that come from the analog-to-digital·(AD) conveter to the BOE (ASP-2.) It also shows which 'pin' they connect to on the BOE. Does this look right so far? Does the·2-into-1 wire for the "shared·pin" look right? The two wires are simply spliced together.
Mark
PS - Sylvie, is your ready rocket to launch this weekend? Are your electronics all ready? How high will it go? You mentioned a "low,slow" flight before. Be sure that your ISP > 9.8 m/sec/sec!
Attached? I cannot find the attachment...
Dylan Landry
Mr. Kibler
As for connecting the capacitor, one lead goes to the Vdd pin on the 3202, and the other goes to the Vss pin on the 3202. Those are diagonally opposite pins, which is a bit inconvenient, but you could have a ground rail closer to pin 8 (which is Vdd). These are Vdd and Vss on the _3202_, not on the BoE: you want the capacitor connected close to the 3202's Vdd pin, and not too far from its Vss pin. Distance matters here.
I took most of the day off to be on my bike, on a trail running from a town in southern Wisconsin into northern Illinois. Great ride, but I made a big mistake. I drove two hours to the trailhead, got my bike out, and rode right up a hill. I didn't think much of it at the time, but I wound up getting the mother of all leg cramps, and I'm so sore I can barely stumble around right now. It'll be better in the morning. Let that be a lesson to the students: don't get old.
I'd been flying the rocket with just a standard altimeter on smaller I motors, but with all the gizmos and batteries in there, I have to bump up to larger motors just to fly safely.
The boards for my fancy newer GPS transmitter came a few days ago. I put one together - but it doesn't work right. It seems to be having a serious problem getting satellite lock. Eventually it does, after many many minutes, but even then loses lock again. I don't know what the problem is, but I suspect inadequate power supply. I'll take out the XBee radio and connect wires to send the GPS data directly to a serial port, and see if it works that way. The XBee transmits more-or-less constantly, which takes a lot of current. Maybe I can substitute a higher-current voltage regulator.
OK, attached are two pictures·showing where we understand the wires are supposed to go:
A) The two (orange) wires from the "Din and Dout" pins on the AD converter are spliced into one wire ("pin sharing".) The one wire has an in-line 1 K-ohm resistor.·This single wire then·goes to p6 or p 14 (or any available pins) on the BOE. Yes?
The yellow wire comes from the Vdd/ V-REF pin on the AD converter. It has a #104 capacitor in-line. It goes to "ground" on the BOE. We interpret this to mean that it goes to Vss (ground) on the BOE. Is this correct?
C) The single yellow wire has no resistor or capacitor on it. It geos from the AD converter's CS-bar/ SHDN pin to p6 or p14 (or any available pin ) on the BOE. So far so good?
Assuming the wires and wiring scheme ARE correct, we hypothesize that if·we were to connect the wires to the BOE as shown above, nothing should happen since p6 and p14 are not in the program yet. Should we put them into the program, or wait...
Standing by,
The Rocketeers and Mr. Kibler
(see attached pictures)
· We read your post after we uploaded the photos. Sorry. We'll connect the wire from the Vdd pin on the 3202 AD converter to the Vss pin on the 3202 AD converter right now. Then we'll post updated pictures.
"Let that be a lesson to the students: don't get old."
Mr. Kibler said to tell you that he's working on an anti-aging device that both of you can use (he needs it for sure and it sounds like you might want to borrow it.) We're not sure if·Dr. Allen·needs it but you can try it out when it's done!
Thanks,
Rocketeers··
Attached are the new pictures with the yellow wire running from the 3202 AD converter's Vdd pin to its Vss pin, not to the BOE. The capacitor is close the the Vdd pin like you said. When we solder·the capacitor·to the perfboard there won't be a wire from the capacitor. The capacitor's "leg" will get soldered directly·to the perfboard beside the AD 3202 Vdd pin. Does·it look OK now? What happens if we connect it to the ASP-2 now? We don't think anything will happen. What happens if you put a capacitor on your tongue like a 9-volt battery?
What do you mean when you say the capacitor's leg?
Sean
Sean,
I believe he is referring to the wiring coming out of the capacitor. See the picture attached.
Andrew
Your photos suggest a couple of changes. First of all, the capacitor IS hooked up correctly, but you should shorten the wires on both sides considerably. Make it so that it is sitting just above the chip, with leads that reach to the appropriate holes, but without all of that slack. Now that being said,·I used a disk capacitor with 3/4" leads, and it worked fine. But you're not going to want all of that flopping around in the rocket anyway.
You have an orange wire going from your 3202 pin 1 to (eventually) a BoE pin that will be your chip select. Good.
You have an orange wire going from your 3202 pins 5 and 6, through a resistor, to (eventually) a BoE pin that will share Din and Dout responsibilities. Good.
** You still need another wire going from your 3202 pin 7 to a BoE pin. Pin 7 is the clk (clock) pin, and you will not be able to communicate with the 3202 without that wire.
Eventually you will also need to connect the TP1 test point on the CO2 sensor to one of the 3202's inputs channels on pins 2 and 3. You should expect to use pin 2, which is Ch 0. You could, for testing purposes, leave that off for now, and connect a variable voltage there like I did, with a potentiometer. By the way, the sensor, 3202, and BoE will all need to have their grounds connected together somehow.
My advice would be that you connect a 10K potentiometer (a little variable resistor - you can get 'em at Radio Shack, and you probably have one laying around from the Parallax kits you bought) so that you have a test voltage that you can control. You're going to want to know for sure that your A/D converter circuit is working, and that's a good way. An alternative would be to use a photoresistor, so that you can change the incoming voltage on that Ch 0 pin by moving your hand between the circuit and the light.
Then you can run the sample program on the 3202's product page, with the appropriate changes made to the pins you're using (it uses pins 0, 1, 2, and 3, and you're using different pins on your board), and make sure that everything reads okay.
======================
If you put a charged capacitor on your tongue, probably nothing will happen at all. If it's a larger capacitor with a bigger charge, you might feel it like a 9V battery. If it's larger than that, you might hurt yourself. If·the capacitor is·large enough, in fact, you might kill yourself, and there are capacitors large enough that you are recommended not to wear any jewelry while handling them - rumor has it that at least one person has lost a finger that way:
http://forums.parallax.com/showthread.php?p=914619
I prefer to put dry, red wine on my tongue, along with a meal prepared by a knowledgable chef who takes pride in his work. That can be electrifying as well, but in a safe way. The only thing you lose is your ability to eat McDonald's food.
That big capacitor I linked to is 400 Farads. Think about that - the one you're using is .1 uF, or 1/10th of 1/millionth of one Farad. That means (if I'm doing the math correctly) that the big capacitor is equivalent to 4 billion of the ones you're using. Yours is a very normal-sized one: the 400 Farad one is gigantic.
Post Edited (sylvie369) : 6/17/2010 5:03:31 PM GMT