24 channel temp logger

hax

New Member
Hi all,

It's been a while since I posted last! Still see many of the "old guys" here....

I'll get straight into it: I have a project where I have to log 24 separate temperature points every 5 seconds or so.....

So I am thinking 24 x DS18B20 and a 40X2 would work.... with serout to a serial capture recording program such as RealTerm.

I tried a small scale test with 4 x DS18B20's and the following code:




main:
owout b.4,%1001,($CC,$44)
owout b.3,%1001,($CC,$44)
owout b.2,%1001,($CC,$44)
owout b.1,%1001,($CC,$44)
pause 750
owout b.4,%0001,($CC,$BE)
owin b.4,%0000,(b0,b1)
owout b.3,%0001,($CC,$BE)
owin b.3,%0000,(b2,b3)
owout b.2,%0001,($CC,$BE)
owin b.2,%0000,(b4,b5)
owout b.1,%0001,($CC,$BE)
owin b.1,%0000,(b6,b7)
sertxd (#w0,",",#w1,",",#w2,",",#w3,13,10)
goto main




Seems to work well with 4 temperature sensors, but can anyone see any issues at all as to why it wouldn't work with 24 or even 30 separate temp sensors? ie. hardware limitations, pin limitations, speed of execution, etc?
I'd hate to purchase all the bits only to find out that there is some sort of problem interfacing so many sensors?

FYI This is for monitoring the fluid flow of thermal currents inside a large cylinder.

I have checked the documentation, and it appears that the readtemp12 and the owout and owin commands all work on any i/o pin of the 40X2. Any other thoughts where this could go horribly wrong?

Cheers, Haxby.
 

premelec

Senior Member
This reminded me of the solar temperature logger and program with an 'arbiter' at anotherurl.com... however also what time constant do you need on the temperature changes? The DS18B20 is a bit slow and you might want to use some other devices - if your temperature range is not large thermistors could work well. Or AD590s with a multiplexer etc... How about some more specs as to range and how fast the units have to react to changes etc?
 

hax

New Member
Ah this is quite similar to that project. It's using solar power to heat the water also, so a slow update rate is fine. The AD590 looks OK but it doesn't have a nice digital direct output, so it would need a little more circuitry to get going, though it would be slightly cheaper to use with a multiplexer. But I'd prefer the 40X2 with individual pins per sensor, as it's a neater single chip solution. The board layout would be super easy.

I am more after any technical reasons why a 40X setup with 24 x 18B20 would fail, ie. a preemptive look at any hardware issues I may bump in to. Come to think of it, I should make sure that a long serial string with many variables won't cause the picaxe or software to hang... will have to check that.
 

JimPerry

Senior Member
Come to think of it, I should make sure that a long serial string with many variables won't cause the picaxe or software to hang... will have to check that.
You might want to consider a "Star" wiring layout - with the Picaxe near the middle. ;)
 

BeanieBots

Moderator
It is possible to have all the DS18B20's on the same 3 wire bus and hence only using one I/O pin.
There is a full write-up in the projects section explaining how to use the device serial numbers to address them individually. (sorry, can't remember where but I recall it was written by rmeldo)
 

Peter Graat

New Member
If you want to record data of all 24 temperature sensors within 5 seconds the conversion time of the 18B20 could be to long. One conversion takes 750 msec. So all 24 18B20's take 18 seconds. At this moment I don't know a sollution or maybe you could use parallel tasks??
 

BeanieBots

Moderator
If you want to record data of all 24 temperature sensors within 5 seconds the conversion time of the 18B20 could be to long. One conversion takes 750 msec. So all 24 18B20's take 18 seconds. At this moment I don't know a sollution or maybe you could use parallel tasks??
Using the one-wire commands you can start all the conversions at the same time and then wait 750mS before reading.
It should be possible to start and read all the sensors in about 1 second. Haxby's code already does this.
Not sure if it's possible to do a general broadcast to start conversion on a bus system but I would expect so.
 

MFB

Senior Member
One consideration that I don't think you have mentioned is the length of wiring and the electrical environment. A digital sensor output would be more sensitive to noise and cable loading than the AD590 current output. Interfacing the AD590 to an ADC input can be as simple as adding a pull-down resistor to ground and if you multiplex you will only need one.
 

SAborn

Senior Member
If you can work with SMD chips then the Texas Instrument TMP-175 chip is a excellent option, as its I2C and up to 27 devices can be on the bus.
A 08m2 could then handle all the sensors.

I have used these to monitor individual solar panel temps, in relation to ambient and inverter temps, with a picaxe and good results.
Although mounting the sensors was arkward.

View attachment TMP175 - 75.pdf
 

g6ejd

Senior Member
I wonder if the original requirement is realistic, because the thermal inertia of the measuring devices, let alone the object being measured can be slow/long and what environment would need to be monitored that quickly, sounds like lots (24) of low mass objects?
 

g6ejd

Senior Member
If you can work with SMD chips then the Texas Instrument TMP-175 chip is a excellent option, as its I2C and up to 27 devices can be on the bus.
A 08m2 could then handle all the sensors.

I have used these to monitor individual solar panel temps, in relation to ambient and inverter temps, with a picaxe and good results.
Although mounting the sensors was arkward.

View attachment 12323
The time budget is 208mS per-reading, these can range up to 300mS per conversion... it's hard spec. to meet IMO
 

JimPerry

Senior Member
How about splitting the sensors into "zones" and reading each zone every minute or so - removes the conversion time restraints - and if a couple of minutes makes no difference (latency) then all "Cushty" [as DelBoy would say] :rolleyes: -- might even do it all on an 8M2!
 

SAborn

Senior Member
The time budget is 208mS per-reading, these can range up to 300mS per conversion... it's hard spec. to meet IMO
Its really a trade off to resolution, 200-300 ms for 12 bit and 55-75 ms for 10 bit, still a lot better than 750 ms the DS18b20 can take.
 

fernando_g

Senior Member
Every circuit design is a tradeoff between 3 conflicting requirements:

1- Performance...and there are MANY parameters which define performance: Speed, accuracy, current consumption, etc.

2- Cost and/or complexity...usually you can exchange one for another.

3- Time and effort to design, build and debug it. Debugging usually takes the longest.

So. Personally I would go for an I2C solution, if you feel confortable with its protocol.
 

MFB

Senior Member
Lots of discussion here about conversion times but apart from the original comment "This is for monitoring the fluid flow of thermal currents inside a LARGE cylinder" not much thought seems to have been spent on the implications of cable lengths. Is I2C really the best choice or would an analog alternative like the AD590 (that was designed for driving long cables in an industrial environment) be more suitable?
 

hax

New Member
Lots of discussion here about conversion times but apart from the original comment "This is for monitoring the fluid flow of thermal currents inside a LARGE cylinder" not much thought seems to have been spent on the implications of cable lengths. Is I2C really the best choice or would an analog alternative like the AD590 (that was designed for driving long cables in an industrial environment) be more suitable?
It will be in an outdoor environment. The distance from picaxe to the longest sensor will not be more than 3m. I doubt that cable length will be an issue. I'm getting some DS18B20's that have already been waterproofed.... search ebay for item number 200816082241. Can't beat the price at $2 each. I wonder if they are real Dallas semi devices.

The communication from picaxe to PC however will be quite a distance, perhaps 20m or more. So I am thinking of using 2 x item 120911660363 (again on ebay). It's an RS232 to RS485 converter. One at each end should make the comms quite robust.
 

Paix

Senior Member
You only really need two RS485 transceiver chips, as they translate from TTL to RS485 levels across the interface. Picaxe at one end with DS18B20's and at the other end a small board with the second transceiver and a socket for the AXE027 serial (TTL) to USB cable. Oh and one, or two (failing memory), 100 ohm bus termination resistor/s. Normally the chips cost around £0.90 to £2.50 depending on what you buy.

Almost all fail with correctly biased bus receivers these days, in the absence of any active tx signals on the bus. What that means is that the receivers will hold Mark high and not run open (float).

Pick your supplier VCC voltage and package type. 5V 8pin Dip is still available although 3.3V far outnumber them. it seems that although not every stockist carries them, that every man and his brother makes a range of RS485 tranceiver chips. Almost any vending machine worth it's salt will use a pair. They are almost as common as condoms if you know where to look, but rarely seen otherwise. :)

RS485 and RS232 use the same signalling protocol, it's just that RS485 uses push/pull transmitters and differential receivers to operate faster and further.

Have a look at this page :
http://www.rapidonline.com/Electronic-Components/RS485-Line-driver-receivers-34440/?sid=44b03852-3d32-46aa-8cfd-7e19fc4be568

Datasheet: Rapid part no 82-0866 £1.13 ex VAT each.
http://www.rapidonline.com/pdf/82-0866e.pdf
 
Last edited:

westaust55

Moderator
I have previously done quite a bit of work using the 1-Wire network and a PICAXE 40X1.
Have a read through this long-ish thread: http://www.picaxeforum.co.uk/showthread.php?15306-One-Wire-Devices-Networks

While a max of about 5 DS18B20's were involved in my network, I had a total of around 21 1-Wire components plus the ability to connect up to 4 iButtons.
Most of the work was done with short overall network length but I did some trials with around 15 metres of (non optimal) 2 core screened stereo audio cable and on 100 metres of Cat 5e cable.

Note that you can send the Temp convert command as a broadcast to all DS18B20 chips simultaneously and then individually read the temp data back from them.
You can also select from 9 to 12 bit resolution (ie from 0.5 to 0.0625 deg increments) which also requires a proportionately longer time to do the temp conversion (from around 96 up to 750 msec).
Some of my DS18B20 1-Wire PICAXE code went through the various resolutions and duration changes.
 
Last edited:
Top