Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Water param sensors circuit for use with LPC

Status
Not open for further replies.

pearlyred

New Member
Hi folks,

I'm fairly new to the electronics scene, having just dabbled with a few basic things in previous years.

What I'm looking at doing as a home project is creating a 'box' which can accept various sensors (temp, ph etc) for measuring water parameters. I want this to connect to a controlling pc where the data will be displayed etc.

Since theres so much I need to learn, I figured I would do this a bit at a time, starting with temp.

So.. any ideas on how I could create some sort of waterproof temp sensor which I could use to send data to a pc? Probably using the LPT port? If I can learn how the circuit will work I can create some software for it. I'm a little more comfortable with this part. It'll use a mix of VB and C++.

Parts of this are probably already available, but i'd really like to learn and do my own from scratch if i can, just need a helping hand to get started.

Cheers
Lee
 
pearlyred said:
Hi folks,

I'm fairly new to the electronics scene, having just dabbled with a few basic things in previous years.

What I'm looking at doing as a home project is creating a 'box' which can accept various sensors (temp, ph etc) for measuring water parameters. I want this to connect to a controlling pc where the data will be displayed etc.

Since theres so much I need to learn, I figured I would do this a bit at a time, starting with temp.

So.. any ideas on how I could create some sort of waterproof temp sensor which I could use to send data to a pc? Probably using the LPT port? If I can learn how the circuit will work I can create some software for it. I'm a little more comfortable with this part. It'll use a mix of VB and C++.

Parts of this are probably already available, but i'd really like to learn and do my own from scratch if i can, just need a helping hand to get started.

Cheers
Lee

You're correct in asserting that these kinds of things are commercially available but what fun is that? Starting with temperature is a good idea in my opinion because I think it is the easiest one to measure (from your list). Someone probably makes waterproof temp sensors all ready to go for enough $$$.

For very little cost, you can build your own waterproof temp sensor and interface electronics so your VB program can get readings. There have been numerous parallel port interface circuits shown here on this forum (search for them). Just make sure to pick one that is isolated for an easier time with debugging.

Some food for though about measuring temperature:

1) Temperature is an analog quantity and as such if your sensor provides and analog voltage, this will be much more complicated to get into a computer. An analog to digital conversion must take place and that really complicates the design(relatively speaking).

2) You can find digital output temperature sensors but the ones I have seen are serial output. I've never come across a parallel "flash" type of temperature converter although, that would be neat. So you will have a serial temperature stream. You will need to do a serial to parallel conversion to get it in the right format for an LPT port. Maybe this is not a big deal, but maybe using the serial port gives you an advantage in this regard. I think it really depends on how much design work you want to do.

3) You did not specify how accurate you need to measure the temperature. If you desire very good accuracy (< 0.5 degree Celsius) or better, it drastically changes the game. For you will likely need to use cold junction compensated thermocouples as your sensor. And the math needed to compute a reading gets ugly with ITS-90 curve fitting 9th order polynomials.
 
Optikon said:
For very little cost, you can build your own waterproof temp sensor and interface electronics so your VB program can get readings.
Where would I start if I wanted to make my own sensor, any ideas?

Optikon said:
There have been numerous parallel port interface circuits shown here on this forum (search for them). Just make sure to pick one that is isolated for an easier time with debugging.
Sorry to be stupid, but could you explain that a little. Isolated from what?

Optikon said:
1) Temperature is an analog quantity and as such if your sensor provides and analog voltage, this will be much more complicated to get into a computer. An analog to digital conversion must take place and that really complicates the design(relatively speaking).

2) You can find digital output temperature sensors but the ones I have seen are serial output. I've never come across a parallel "flash" type of temperature converter although, that would be neat. So you will have a serial temperature stream. You will need to do a serial to parallel conversion to get it in the right format for an LPT port. Maybe this is not a big deal, but maybe using the serial port gives you an advantage in this regard. I think it really depends on how much design work you want to do.
Sounds like it is easier to go with an analog output and use a ADC with LPT, than it would be to find a digital output sensor? I figured LPT would be better as its faster, but in your opinion which offers the best control of devices, bearing in mind I eventually want several sensors etc in the device?

Optikon said:
3) You did not specify how accurate you need to measure the temperature. If you desire very good accuracy (< 0.5 degree Celsius) or better, it drastically changes the game. For you will likely need to use cold junction compensated thermocouples as your sensor. And the math needed to compute a reading gets ugly with ITS-90 curve fitting 9th order polynomials.
Yes, this needs to be accurate, at least 0.5 degrees C. You lost me after that bit I'm afraid. Just how much does it complicate things, in terms of cost and design difficulty?

Really appreciate your answer, you've given me lots to think of.

Lee
 
pearlyred said:
Sounds like it is easier to go with an analog output and use a ADC with LPT, than it would be to find a digital output sensor? I figured LPT would be better as its faster, but in your opinion which offers the best control of devices, bearing in mind I eventually want several sensors etc in the device?

Speed isn't likely to be an issue, a serial port will operate many thousands of times faster than you require, and inputs using a parallel port aren't likely to be much (if any?) faster than a serial port, depending on port type and how you write the software.

Probably one of the best ways is to do it using a PIC, this can interface directly to your sensors, and send standard ASCII data back to the PC via a serial link. As already suggested, sensors may not be linear or accurate, but you can get digital temperature sensors which output the temperature directly (avoiding any measurement or linearity problems), this would seem the way to go?.
 
As suggested by Nigel, the PIC(which has A/D and USART built-in) and the analogue temperature sensor in the form of a TO-92 transistor is a good combination. The Pic would convert the linear voltage into a data value and sent to the PC via rs232 communication. Your PC software then record it, plot it or whatever.

The temperature sensor outputs a linear voltage proportional to ambient temperature and it is easily sealed to be water tight at the end of a probe.

Details here for a very cheap and accurate sensor:

**broken link removed**
 
Ok, well I've been looking around at whats available locally and I can source a LM335Z 3 Pin TO 92 Temp sensor and as far as PIC's go, I know nothing about them but can get either a PIC16F84A-20P or a PIC16F628A-20P or for a little more $$ a PIC16F88. Dont know how far I need to go with these, are any of them easier to program etc than others, or are they designed for different things?

Assuming I go with these, can anyone think of any other special components I may need for the circuits, or any major problems I might come across?

If serial is the easier way to go then I'll do that. At least for now anyway. USB in the future maybe?

Thanks for all the help so far!

LS
 
pearlyred said:
Assuming I go with these, can anyone think of any other special components I may need for the circuits, or any major problems I might come across?

You'll also need a 20MHz crystal for the PIC and a MAX232A IC for interfacing the PIC with the RS232 port on your PC.

Don't buy the 16F84A as it is usually more expensive and less functional than either the 16F628A or 16F88. I would recommend the 16F88 as it has the biggest bang for your buck. They are about 90% identical, some with extra features and bigger memory size for both your codes and data.

You needs to learn the PIC programming language and get the program code into the PIC chip which you will also need a hardware programmer of some sort. All the software you needed for developing the PIC is freely available for download.

I would suggest you go to the Microchip website and download the 16F88 datasheet to see what it has inside and be amazed.

pearlyred said:
If serial is the easier way to go then I'll do that. At least for now anyway. USB in the future maybe?

It is easier because of the hardware USART built in the PIC. If your programming skill gets better, there are PICs with built-in USB port so you can interface the PIC with a PC USB port.
 
Blimey! These PIC's are seriously involved man.

Looked at the data sheet, may well go with the 16F88, only a couple of dollars more expensive so may aswell.

Programmers and software, there are millions! How do you ever pick one? Is it viable to make one myself from someones design or will I have to buy one ready made? I'd quite like to keep costs minimal.

I dont mind having a go, I just seriously don't know which one to start with. Any good ones you can recommend for that PIC that have readily available designs or retailers?
 
pearlyred said:
Blimey! These PIC's are seriously involved man.

Looked at the data sheet, may well go with the 16F88, only a couple of dollars more expensive so may aswell.

Programmers and software, there are millions! How do you ever pick one? Is it viable to make one myself from someones design or will I have to buy one ready made? I'd quite like to keep costs minimal.

I dont mind having a go, I just seriously don't know which one to start with. Any good ones you can recommend for that PIC that have readily available designs or retailers?

There are plenty of suitable designs around, the 'sticky' at the top of the Micro Controller forum may be helpful to you. For a programmer, I would suggest the P16PRO40 or other parallel port design, or a 'proper' serial/USB port programmer, NOT a JDM type programmer.

From your choice of PIC's the 16F88 is the best for your needs, the 16F84 shouldn't be considered, it's essentially been obselete for years, it was replaced by the 16F628 which is better spec and cheaper.
 
Hi pearlyred,

There are two issues here. Choosing a programmer and a programming software running on the PC to control the programmer.

There are several free programming software that you can use but they all differs with the ranges of PICs they can work with. The most flexible software design is WinPicProg by Nigel Goodwin(yes, the one who just answered your post) which allow user to configure the signals to the programmer so it will work with pretty much any standard design. But as yet it does not cover the programming of the 16F88.

The next suitable software is IC-Prog which covers the 16F88 but only allow user to select one of the programmers on its approved list. I can't find P16PRO40 on their approved list.

Any suggestions, guys?
 
eblc1388 said:
But as yet it does not cover the programming of the 16F88.

The latest working version supports the 16F88, it's not been released yet because I'm still working on 18F support, but I'm happy to email to anyone who wants to use the 16F88.

(just don't expect the 18F series to be fully working though :D )
The next suitable software is IC-Prog which covers the 16F88 but only allow user to select one of the programmers on its approved list. I can't find P16PRO40 on their approved list.

Any suggestions, guys?

You need to select another option, I'll check what it is when I get home later, but I suspect someone will post the details before then?. It's been mentioned previously in these forums, but might take some finding?.
 
Nigel Goodwin said:
The latest working version supports the 16F88, it's not been released yet because I'm still working on 18F support, but I'm happy to email to anyone who wants to use the 16F88.
That's very good news for pearlyred indeed.

Pearlyred, please visits the first link in Nigel's Signature and obtains the schematic of the P16PRO40 programmer. It uses one TTL IC, a few PNP transistors and two voltage regulators. Very easy to build. I even did one in a couples of minutes in the past. See image. There are also ready made one up for sale in EBay.
 

Attachments

  • pic_prog.jpg
    pic_prog.jpg
    58.1 KB · Views: 638
Nigel Goodwin said:
You need to select another option, I'll check what it is when I get home later, but I suspect someone will post the details before then?.

Oh! - so nobody mentioned it then?, you select ProPic 2' in IC-Prog.
 
Ok, I'll go with the 16F88 and P16PRO40 programmer, minus the ziff as Im not rich at the moment. I'll take a look at the schematic (need to get better with these) and make up a parts list. I cant get the parts until a couple days time, but when I do i'll have a go and see where I get. This should be fun.

Nigel I've PM'd you about the software.

Cheers guys
Lee
 
pearlyred said:
Ok, well I've been looking around at whats available locally and I can source a LM335Z 3 Pin TO 92 Temp sensor and as far as PIC's go, I know nothing about them but can get either a PIC16F84A-20P or a PIC16F628A-20P or for a little more $$ a PIC16F88. Dont know how far I need to go with these, are any of them easier to program etc than others, or are they designed for different things?

Assuming I go with these, can anyone think of any other special components I may need for the circuits, or any major problems I might come across?

If serial is the easier way to go then I'll do that. At least for now anyway. USB in the future maybe?

Thanks for all the help so far!

LS

Just so you know, LM335 accuracy will NOT achieve what yo mentioned earlier (you said at least 0.5 deg C)

LM335A Uncalibrated can be as high as 3 degrees error.
LM335A Calibrated can be as high as 1 degrees initial error.

LM335 Uncalibrated can be as high as 6 degrees error.
LM335 Calibrated can be as high as 1 degrees initial error.

SO you MUST calibrate your system if you expect to achieve 1 degree error. To calibrate, you will also need another way of measuring temperature that is better than 1 degree in error.

Also, with other things in the system, your temp error will get worse once you account for other offsets (if you dont calibrate) like A/D and any opamps you use. Also, if you run your system in a significantly hotter than 25 deg ambient environment, all these errors have temp coefficients of their own which you can only account for to a certain degree.

Also take care to choose an A/D that has enough resolution depending on your needs. I mention all of this because if you are not careful, < 1 degree temperature error is a pipe dream with these kinds of parts. I dont want you to be disappointed if you really need the temp accuracy which, you said you did. (<0.5 error)
 
Optikon said:
Just so you know, LM335 accuracy will NOT achieve what yo mentioned earlier (you said at least 0.5 deg C)

The typical error at the two ends of temperature range is only 0.5 degree and that means from -40 degree to +100 degree, when the LM335 is calibrated at 25 degree. When the temperature to be measured is closer to 25 degree, the error is even smaller.

Optikon said:
I dont want you to be disappointed if you really need the temp accuracy which, you said you did. (<0.5 error)

So, please suggests a better solution for pearlyred and the approximate cost to achieve that.
 
Damn, someone threw a spanner :p

Typical temperature range this thing will measure is around 23 to 30 degrees C. Obviously it may go outside that range, but accuracy isnt as important if it does.

So, I'm definately going to have to find a way to calibrate it too, to get it even remotely accurate?

I'll also look for an alternative to the 335 if i can.
 
Well, I can't seem to find an alternative temp sensor. I'm kind of suprised, but 0.5 C is the best I can find so I'll have to go with that.

Just another thought, does the wire length between either the device and sensor, or the device and pc make any difference to overall result?

With regards to the A/D what does the resolution mean? The PIC16F88 has 7 channels of 10-bit Analog-to-Digital (A/D) converter. Is this the same thing or something else?

Cheers
 
pearlyred said:
Just another thought, does the wire length between either the device and sensor, or the device and pc make any difference to overall result?

Not if kept to reasonable lengths, although using screened leads would probably be a good idea?.

With regards to the A/D what does the resolution mean? The PIC16F88 has 7 channels of 10-bit Analog-to-Digital (A/D) converter. Is this the same thing or something else?

It means that the analogue voltage can be converted into a possible 1024 values, giving roughly 0.1% resolution (this doesn't mean it's 0.1% accurate!).

But why not use something like the Dallas DS1820, this gives a direct digital output and has 0.5C resolution, so requires no calibration!.
 
eblc1388 said:
Optikon said:
Just so you know, LM335 accuracy will NOT achieve what yo mentioned earlier (you said at least 0.5 deg C)

The typical error at the two ends of temperature range is only 0.5 degree and that means from -40 degree to +100 degree, when the LM335 is calibrated at 25 degree. When the temperature to be measured is closer to 25 degree, the error is even smaller.

Optikon said:
I dont want you to be disappointed if you really need the temp accuracy which, you said you did. (<0.5 error)

So, please suggests a better solution for pearlyred and the approximate cost to achieve that.

I didn't see him specify a temp range to measure so the full range of the sensor he picked is assumed.

A more accurate solution (but much more complex) is to use thermocouples or precision platinum RTD's. Thermocouples are very low cost but to calculate an accurate temperature, the voltage measurement needs to be run through a polynomial equation which is standardized by the ITS-90 specification that characterizes the thermocouple wire itself. So its more involved but <0.1 deg C accuracies are achievable.

Precision RTD is easier to design with but it's cost is high. Also <0.1 deg C accuracies are achievable.

But all of the systems described so far (including the lowly '335) will need to be calibrated to remove offsets & gain errors across the temp range especially if thermocouples/RTD are used for higher accuracy.

For calibration you will need a precision temperature reference and there are such things as simulated ice baths but they are expensive. My gut feeling is that this kind of accuracy is not at all needed for the application.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top