Multiple DS18B20 and Picaxe 08M/08M2

Paix

Senior Member
I would like to operate four DS18B20 with a Picaxe 08M chip, but there are only three i/o ports 1, 2 and 4.

Is it possible to run two DS18B20 from one pin with the readtemp command or is the protocol limited by the implementation in the interpreter?

If it is possible how would I be able to differentiate between the devices?


If I was to use a different chip, then obviously there would be additional i/o pins and so operating more than one sensor on a pin would be less of a requirement.

Proposed application: an intelligent crown board on a bee hive with four sensors to record temperature and sense the position of the cluster during the winter. (08M2)

Reason for doing this, because the bees will let me and I'm sufficiently curious to think it worthwhile. I also think that the 08M2 will make a good basic data logging chip, with data collection once a day and the data merely being a single byte serial number and four bytes of temperature data taken ten times an hour (240 periods x 5bytes = 1200 bytes of data per day) at a granularity of 1 degree. Sample rate, temperature granularity and collection interval can all be reviewed later once the proof of concept is seen to be working OK.
 

inglewoodpete

Senior Member
In order to use more than one DS18B20 device on a 'one wire' bus, you need to use the owout and owin commands.

These commands are only implemented on the X1 and X2 ranges of devices. If chip size is important to you, the 'smallest' of these is the SMD version of the 20x2.
 

westaust55

Moderator
Further to the advice given by IWP,

Each 1-wire device has a unique 8 byte serial number within memory on the device and it is by this each device can specifically be addressed.

To extract the serial number you can connect each 1-wire device one at a time and use the Picaxe command to read the serial number which even non 1 and X2 parts can do with the inbuilt command.

Alternatively use a search program when several devices are connected at one, but then you must still work out which is which if more than of a given type.

Have a read of this thread and the attachments if you are interested in pursuing a 1-wire network:
http://www.picaxeforum.co.uk/showthread.php?t=15306
 
Last edited:

hippy

Technical Support
Staff member
This is one of those cases where the cost of a larger PICAXE chip is almost certainly less than what a solution ( or the thinking about it ) would cost. Use a 14M2 would be my solution.
 

Technical

Technical Support
Staff member
As hippy says, using a 14M2 with 4 sensors on 4 different pins is probably the easiest solution. Certainly much simpler than using a 20X2 with all sensors networked on one input pin.
 

Paix

Senior Member
Thanks gentlemen.
@i'Pete I was aware of the OW protocol but hankered after an 08 sized solution. Size isn't really an issue at all.

@Hippy & Technical, I have an 18M2 so I guess that it is a bit of a no-brainer from this point in. I do appreciate that a lot of the heavy lifting has been done giving us the readtemp/readtemp10 commands and so shouldn't morn the lack of a fourth suitable pin on an 08 device or extended OW support. You might not be surprised how many times I had considered pin 3 as an option and realised that I had visited that one way street in my mind at least twice before and experienced a belated penny dropping moment. I was grasping at straws and the elegance of an 8 pin solution I guess. :)

@West'55, I appreciate and value your explanation and will certainly follow up the link with attachments for the enlightenment that it is likely to bring. I am after all hacking on your various temperature and Morse generating bits of code, so your thoughts and reasoning are stock items in my personal bag of Picaxe tools.

Three DS18B20 with 08M/08M2 to start be followed by four and 18M2. Thanks RevEd for the new M2 chips.
 

premelec

Senior Member
It's likely that the 14M2 is your solution - however I've seen instances described where many OW sense units were paralleled on one lead cable saving a great deal of wire and complication in wire stringing... this can be a useful feature of the OW units...
 
Top