Trying to read LM34 value in F with ADC0831 without any luck
PeteStarks
Posts: 7
I have not touched my BS2 parts in many years which has made me more than a bit rusty. I normally use the Propeller for most of my tinkering, but seeing as I need a very simple device to monitor analog sensors such as the LM34 I felt it was overkill. I would also like to make use of all the parts I currently have in my bin which include the LM34, ADC0831 and the BS2.
I have checked the object exchange and see there is an object to do exactly what I need and would work in a matter of seconds if I were using a Prop, but I am attempting to go forward with the BS2. I have complete information overload on this very simple problem and have been skimming through the Process Control book, Stamp Works, the Pbasic references and Tracy Allens fine website. Between all these different bits of information and code I have somehow missed a working example that will output the LM34 data to DEBUG in F format.
Could someone please take mercy on my poor brain and either post or link me to some working code that will do what I need? I personally learn much faster by reverse engineering something that works rather than reading 500 pages of theory about changing a light bulb.
I would post my code, but it has changed so many times and with so many dead ends I would just like to start fresh at this point. Any help is more than appreciated
I have checked the object exchange and see there is an object to do exactly what I need and would work in a matter of seconds if I were using a Prop, but I am attempting to go forward with the BS2. I have complete information overload on this very simple problem and have been skimming through the Process Control book, Stamp Works, the Pbasic references and Tracy Allens fine website. Between all these different bits of information and code I have somehow missed a working example that will output the LM34 data to DEBUG in F format.
Could someone please take mercy on my poor brain and either post or link me to some working code that will do what I need? I personally learn much faster by reverse engineering something that works rather than reading 500 pages of theory about changing a light bulb.
I would post my code, but it has changed so many times and with so many dead ends I would just like to start fresh at this point. Any help is more than appreciated
Comments
If your Vref is 5.0v then the scaling factor will be $1F4 (nearly 1.93) to account for the larger span. For improved accuracy keep Vref as low as possible. The LM34 outputs an analog voltage of 10mV per degree F.
Thank you very much for allowing me to stop drowning in google searches, only to find code that ALMOST fit my situation. I am running with a Vref of 5v as provided by the BS2 BOE, which is still pretty close compared to my laser thermometer. It seems the magic scaling factor is what was hanging me up. I'll spend a little time dialing in the accuracy, but your post has set me straight.
Edit: Correction, 10 mV/Degree, but the math would still be much easier/simpler.
Here is one http://www.ti.com/lit/ds/symlink/ref3112.pdf
Why are you scaling by a 1/2 factor?
Also what is the clock and chip select exactly doing?
Thanks