![]() |
Forum Index : Microcontroller and PC projects : Temp LM335 voltage fluctuations
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
pcaffalldavis![]() Senior Member ![]() Joined: 17/10/2011 Location: United StatesPosts: 187 |
So then R always = E/I ? We're all here 'cause we're not all there. |
||||
pcaffalldavis![]() Senior Member ![]() Joined: 17/10/2011 Location: United StatesPosts: 187 |
I'm at a loss to understand the why of Local variables. There is no shortage of possible different names for variables, so what would be a reason for reusing a variable name again as a Local variable as opposed to a variable with a different name? We're all here 'cause we're not all there. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
You can certainly manage with using LOCAL variables. Until: I have written an all-singing-dancing FUNCTION to read the new bear detector module. You decide to use it in your program but your main program has a variable called bears. So does my FUNCTION. Suddenly we have stray bears running everywhere and your cat gets eaten by a bear. If I had done the right thing and used LOCAL for my bears variable in my FUNCTION, there would be no conflict with your 'bears' Using LOCAL makes reusable code easier to manage. Jim I should add that I ran a CGMMstick with LM335s for many years until lightning destroyed most of my gear. The LM335s were on leads up to 25 meters long and there were no strange readings on any of them. Somewhere in the collection I have another one and when I find it, I will do some testing. VK7JH MMedit |
||||
pcaffalldavis![]() Senior Member ![]() Joined: 17/10/2011 Location: United StatesPosts: 187 |
Ah, I never thought about reusing code, or using code from others. Good point! I really like the Sort Variables button, Thank you so much. No need to dig out an old CGMMStick1. I'll mail you one that is exhibiting the phenomenon if you'd like. Just email me your mailing address. But only if you want one. Life is short, so if you'd rather not I'm fine with that too. I wouldn't need it back. Lightening huh? Wow. That is something we almost never get here. We're all here 'cause we're not all there. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
I would like to play with one that has an issue. I will PM my details. Jim VK7JH MMedit |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5091 |
@TassyJim, Put one of those IR temp meters at the MCP1700. I bet it is extremely hot, which was never noticed because the small plastic package. It may cause the drift. But until it burns out, there will be little impact on the digital behavior. pcaffalldavis will most likely be able to use the CGMMSTICK's with the DS1820' without any problems. Volhout P.S. since the MCP1700 has such a low dropout voltage, you may improve the CGMMSTICK by inserting a SI diode between 5V from the USB and the MCP1700. That will almost half the dissipation in the MCP1700. Make sure the ceramic caps remain connected to the MCP1700 when you make the cut in the PCB wiring. PicomiteVGA PETSCII ROBOTS |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
Yep, you've got it. Starting with the basic form of Ohn's law, I = E / R To solve for R you can multiply both sides by R like this R * I = (E / R) * R On the right side the R / R part equals one and disappears like this R * I = E Then you divide both sides by I like this (R * I) / I = E / I On the left side the I/I part equals one and disappears like this R = E / I Which is what you're after. There are about two dozen weird rules (like cross multiplying and stuff cancelling itself out) which are confusing and really don't mean anything. Just do the same thing on both sides of the equation and you won't get messed up. When you divide something by itself you always get the dimensionless number one, as in house/house=1 or polack/polack=1. (Does that mean that two polacks in the same space cancel each other out?) You won't need weird sepcial rules until you try to solve multiple equations with multiple unknowns using determinants. If you want to try to wrap your brain around the next step beyond Ohm's law then read about Kirchoff's law, <click here>, then come back here and we'll try to un-confuse you again. Paul in NY |
||||
pcaffalldavis![]() Senior Member ![]() Joined: 17/10/2011 Location: United StatesPosts: 187 |
I'm rather thinking I should drill down until I have Ohms law clearly recognizable to my perhaps feeble mind using the various nomenclature: Volts is E, Amps is I and Ohms is Resistance, until I have memorized the formula(s) correctly. Then Next I want to refresh and drill down on the Watts/Volts/Amps formula. I always have to start in my mind with one for which I remember the truth: A 1500 watt heater, at 120 volts (I use 100 in my mind as close enough) is about 15 Amps. So, Watts/Volts=Amps. Therefore Volts*Amps=Watts and Watts/Amps=Volts. It sounds suspiciously similar to Ohms Law, but until I can do Ohm's law using either I or Amps, E or Volts, and Ohms or Resistance I may continue to get the two mixed up. I wonder what the Watts/Volts/Amps formula is called? You all might be surprised to learn that I have the kind of mind that has an uncanny natural ability to index vast numbers of details very quickly. And I can often spot a needle in the proverbial haystack of information, but coming to understand and spot two similar yet different formulas for some reason is difficult for my mind and God given skill set. It is done in a different part of the brain I guess. I shall keep plugging away on this Paul. I'm not sure if I've been bad or not, but TBS has stopped emailing me when new posts are added to this discussion. I'l still check it every day for a while though. Thanks all! We're all here 'cause we're not all there. |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
Actually both I=E/R and P=EI are both part of Ohm's law. Just to confuse you further they can wind up combining. P=E*I substituting E/R for I gives P=E*E/R = (E^2)/R I=E/R becomes I*R=R*E/R so E=I*R then P=E*I substituting I*R for E gives P=I*R*I = (I^2)*R so P = EI = (E^2)/R = (I^2)*R Are we having fun yet? Paul in NY |
||||
pcaffalldavis![]() Senior Member ![]() Joined: 17/10/2011 Location: United StatesPosts: 187 |
Argh...thank you Paul. Studying such things is exactly why I usually get up early, from 1 AM TO 6 AM. Nice, quiet, peaceful, spouse asleep. I'm going to have to cut and paste these wonderful equations, then use edit/replace to see them with their different interchangeable variable names, like volts for E and so forth. Maybe after a bit of that in a document with both naming conventions in view some spark of light will shine through. I do appreciate learning that the P=EI is part of Ohms law. I've often suspected there was an uncanny resemblance there. We're all here 'cause we're not all there. |
||||
Boppa Guru ![]() Joined: 08/11/2016 Location: AustraliaPosts: 814 |
Thats why the triangle system works so well, it was used back when I got my tradepapers, when to be a sparky all you needed as a minimum education was the year 10 school certificate- and not even that if you had an employer sponsor you for a apprenticeship, we had one guy who was an absolute genius in the workshop, did beautiful work, but regularly got under 10% in theory, he once got a sympathy mark from our teacher for getting his name right, that way he got at least one mark.... There were two of us that had actually gotten to yr12/hsc, doing physics, chem and 2u advanced maths, we were glad we had prac in the mornings and theory in the arvos, as we would do our prac workshop, get s..tfaced at the pub at lunch and sleep the afternoon theory classes away at the back... The good old days when as long as your marks were up to scratch, you could do that sort of thing... ![]() |
||||
pcaffalldavis![]() Senior Member ![]() Joined: 17/10/2011 Location: United StatesPosts: 187 |
Okay Ladies and Gentlemen, and those who might answer to other titles; I got some DS18B20 sensors yesterday! Tried one on the pegboard today with a 10 meter wire to the sensor and an absolutely simple loop program with a 500 ms pause in each loop. The sensor is just outside where right now the temp is 6 C. I LOVE its precision, it is rock steady. BUT! It reads 85 C instead of 6 C. What is that about? When I tell it OUTDOORCENT = DS18B20(1)-79 It is spot on reading 6 C. Then I make a second variable ((outdoorcent/5*9)+32) to get a F temp. I can leave this loop running on screen and it never seems to vary, certainly no more than the actual outdoor temp might fluctuate. YAHOO! But anyone have any ideas why it reads 79 degrees C high? Thank you all! We're all here 'cause we're not all there. |
||||
pcaffalldavis![]() Senior Member ![]() Joined: 17/10/2011 Location: United StatesPosts: 187 |
Actually I just realized it does not change when I pinch the sensor between my fingers so something is not right. I soldered ground to the legs on both sides, and Positive 5 Volts after the 4.7K resistor to the middle leg and pin 1 jumper. Hum.. I'll go check the ohms on that resistor again. We're all here 'cause we're not all there. |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2944 |
Can I recommend you start by removing the 10m lead! Connect it 'locally' to your MM. Also try the other method of connection AFTER first of all trying a 'short' lead i.e. +V, 0V, and data (via a Pull-Up) WW |
||||
pcaffalldavis![]() Senior Member ![]() Joined: 17/10/2011 Location: United StatesPosts: 187 |
The universe is whacko. I checked the resistor, 4.65 K, okay. Changed the power from the 5 Volt leg to the 3.3 volt leg. It gave me different numbers, all 79 too low. Fixed the program so no 79 offset. Then worked. Changed back to the 5 volt leg, still works. Now when I pinch the sensor is does what it should. Now I'l watch to se if it settles back down and becomes fairly steady. I have no idea what just happened but it appears to be working now. We're all here 'cause we're not all there. |
||||
pcaffalldavis![]() Senior Member ![]() Joined: 17/10/2011 Location: United StatesPosts: 187 |
It has settled back down and is working flawlessly. I'l keep it looping on screen for a day checking it against a known temp sensors. If I don't see any of those pesky wild fluctuations I may be almost home. I like your suggestion white wizard. I'll do that for the next two sensors. Spec sheet reports each reading takes about 200 ms. Does that also take time away from the onboard MM Timer? If I space my go get temp sensor data routine to perhaps every 30 seconds for the three sensors will that be infrequently enough to avoid possible problems with interrupts and keep any effect on the Timer to a minimum? We're all here 'cause we're not all there. |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2944 |
I presume your DS18B20 'test code' is reasonably short? If so - can you post it? The 200mS as far as I am aware is just the time required by the DS18B20 to get a reading after the initial 'request'. It should not have any impact on the MM Timer but I await to be corrected ![]() |
||||
mikeb![]() Senior Member ![]() Joined: 10/04/2016 Location: AustraliaPosts: 174 |
2018-03-18_092537_DS18B20.pdf Check the datasheet. 200msecs will be for 9 bit resolution. This should be sufficient. I'm not sure what default resolution Geoff's driver employs but read the manual. At full 12 bit resolution it takes up to 750 msecs to complete a conversion. There are many ways to manipulate this device in the MM environment. @Geoff / Matherp Does the driver handle negative Temps ? There are 10 kinds of people in the world. Those that understand binary and those that don't. |
||||
pcaffalldavis![]() Senior Member ![]() Joined: 17/10/2011 Location: United StatesPosts: 187 |
' EBOIL03.bas Mar 17, 2018 by PCD ' TEST FOR DS18B20 TEMP SENSOR ' ' Do x=x+1 If x=>17 Then GoSub clearscreen tempcent=DS18B20(1) Pause 500 odtemp=((tempcent/5*9)+32) Print tempcent Print odtemp Loop clearscreen: Cls x=0 Return I've never posted code so it appears in a nice text box of its own. Maybe this will work? Peter in Hyder We're all here 'cause we're not all there. |
||||
pcaffalldavis![]() Senior Member ![]() Joined: 17/10/2011 Location: United StatesPosts: 187 |
I'll be able to tell you tomorrow if it can handle negative temps. We go below 0 C these last few nights again. I'm not sure what 9 bit or 12 bit resolution means to or for me in this case. I'm running this on a CGMMSTick1 running firmware 4.5. We're all here 'cause we're not all there. |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |