sain Posted August 17, 2008 Author Share Posted August 17, 2008 Thanks for the input jcamp. I'll definately add the zener and up the voltage rating on the capacitor. I didn't realise the voltages peaked so high - i was thinking more in the mid 20s range. Yeah, i'm thinking some of the occassional "weird" numbers I'm getting on my test rig might be due to the excessive gain from the op amp. If it continues to be problematic i'll aim for an output voltage of 0.5V (or 0.1) for 100C or so and see if that helps, or failing that switch to proper instrumentation amps. I also have a couple of dedicated thermocouple amplifier chips to try out, but i think their top cutoff temp is 150C, which from memory is still within range for a couple of engines (well, at the top of it).. (also not an electronics engineer - i'm just learning this stuff as I go) Link to comment Share on other sites More sharing options...
sain Posted August 27, 2008 Author Share Posted August 27, 2008 I've been working on the program for the PIC on and off for a few weeks now. This has been qutie a frustrating process, as i've been unable to achieve consistant results with anything other than quite simple code. Once the code grew much beyond reading one ADC (analog to digital converter) port and displaying the output on the LEDs I've been having a lot of trouble. To be honest even reading one adc port has been a struggle - if i changed any of the maths from what I had in the diode temp sensor it all went horribly wrong. In theory what I was trying to do is quite easy - you calculate the input voltage by dividing the ADC result by 1024 (the max possible output from the adc) and then multiplying by the reference voltage (in this case 5). I tried 4 different ways of doing this, all without success, before deciding I was a moron. I then tried it with some constants, rather than the ADC input and had the same issues. I then cut and pasted a bunch of examples off the web, and tried those, and got exactly the same problems as I was getting with my own code. At this point I got the XXXXs and gave up on C, and wrote it in assembler. This worked perfectly so I started to have suspisions that the C compiler i was using was borked, or I had screwed up something in the compiler configuration somewhere. I did want to use C though, as I plan on releasing this whole project, and wanted something a bit easier for a lay person to play with. I downloaded the CCS compiler demo to give it a try, but discovered the demo doesn't support the PIC16f887. Fortunately a friend of mine had an unused pic starter kit thats based on the 16f887 and it had a version of the CCS compiler with it. He was willing to part with it for a very reasonable price, so I bought it off him. So last night I built a quick test program, to read from the ADC port, calculate the voltage and throw the output to the LEDs and also to the computer via a RS232 (serial) connection. After a bit of stuffing around (i forgot to tell the compiler to use all 10 bits of the ADC output) this worked, and i was a very happy fellow. Hopefully progress will now be a bit faster. Link to comment Share on other sites More sharing options...
Al B Posted August 28, 2008 Share Posted August 28, 2008 Sain, I'm pretty handy with a C compiler. Do you have MSN or something? Cheers, Al Link to comment Share on other sites More sharing options...
sain Posted August 28, 2008 Author Share Posted August 28, 2008 gday Al, Unfortunately I don't use MSN - I'm pretty much constantly on the net at work (where we arn't allowed to use instant massaging), so by the time I get home I'm generally ready to leave the internet alone for a while... I'm normally pretty handy with a C compiler myself (I program a lot in my day to day work, though normally in C++). A lot of the stuff that was going wrong was too basic really to normally cause any problem. I'm reasonably certain that the compiler was borked. It just took me a while to figure that out. Certainly everything i'm doing with the new compiler (CCS) seems to work fine, and I like its integration with MPLAB better anyway. Thanks for the offer of help though - I may take you up on it if I run into further problems. Link to comment Share on other sites More sharing options...
sain Posted August 28, 2008 Author Share Posted August 28, 2008 Last nights coding and testing went well, though it did turn up an interesting problem with the LM335 temperature sensor. The initial run throughs went fine, with the temperature sensor reading within half a degree of my multimeter+thermocouple, and fairly close to the diode temp sensor as well. However after about 1 hour, i started to see some divergence in temperature between the three sensors which continued to worsen. At the 2 hour mark the LM335 was reading 29.5 degrees, the multimeter 19 and the diode temp sensor 21. Throughout the testing the multimeter and diode sensor remained pretty much in sync with each other, but the lm335 diverged from the other 2 just after the first hour, and the gap slowly widened. I'm not sure if this is due to a dud sensor, or something else. I'll pick up another one today and try that over the weekend. I also hope to get the thermocouples hooked up and running, though I'll use the diode sensor for the cold junction offset on the first tess. Link to comment Share on other sites More sharing options...
sain Posted September 10, 2008 Author Share Posted September 10, 2008 After my problems with the LM335 I decided i might need a stable voltage reference for the ADC to work with. I ordered some sample voltage references from both microchip and maxim. Last night the microchip ones (mcp1541s) arrived, so i hooked one up to see how it would go. This gave a much more stable reading from the LM335, and also from variable voltage (basically a variable resistor) I was applying to another pin. Unfortunately while the variable voltage results were consistent with what I was getting from my multimeters, the LM335 was reading 3 degrees cooler than my multimeter (doh). While this error is easily corrected I'll need to do some more testing to see if its consistent. anyway, the mcp1541 seems to be the go, and at US$0.75 a pop its affordable enough for this project too. Link to comment Share on other sites More sharing options...
sain Posted November 6, 2008 Author Share Posted November 6, 2008 Its been a while since I posted about this project, mostly because I got a tad frustrated with it. As it turns out the TL074 op amp was a bad choice for this project - it just can't handle the small signal levels well, not even when used in stages. I've taken jcamps advice (thanks) and switched to using an amplifier designed for this sort of stuff. Once again i've gone with a microchip device - a MCP619 quad op amp - and i'll be using two op-amps for each thermocouple (i.e i need 2 MCP619s to run the 4 thermocouples). MCP619s run at $1.58 a chip, so thats still a pretty reasonable price. I decided to use the microchip device to ease the ordering process for anybody who wants to build one of these - basically it now uses 4 parts (the microprocessor, the cold junction sensor, the voltage reference and now the op-amps) that arn't that easy to get in Aus. As microchip makes all of these, and has a very easy to use online ordering system and ships fairly quickly I figured its a good bet. Also as a handy guide I came across this application note AN844 - Simplified Thermocouple Interfaces and PICmicro MCUs. AN844 - Simplified Thermocouple Interfaces and PICmicro® MCUs - Application Notes - Details Conveniently enough it has a schematic on page 8 for a Exhaust gas and Cylinder Head Temperature Monitoring Device.... Link to comment Share on other sites More sharing options...
sain Posted November 19, 2008 Author Share Posted November 19, 2008 The MCP619s arrived a couple of days ago (microchip is pretty quick about shipping) and I got around to connecting one up last night, though I've yet to do any testing on it. Hopefully tonight if other projects don't get in the way. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now