Controlled simulation of temperature with DS18B20 + PWMed resistor

lbenson

Senior Member
I am considering simulation of temperature returns to a picaxe from multiple DS18B20s with the temperature set by PWMing through a resistor potted to the top of the DS18B20.

The module, with 6 or more DS18B20s would be placed in a freezer, so I could, in theory, get temperatures from -18C to 35C.

With good thermal isolation between the DS18B20s, what sort of R would I need when running off of 4 or 6 or 8 AA batteries?

With a 20M2 can I get 6 PWMs with the same rate (say 1kHz) but different duty cycles?
 

BeanieBots

Moderator
That's a tricky one to answer without knowing exactly what the thermal losses are.
In theory, if your insulation is perfect, the resistor need only be 10's of k to overcome black body radiation which is extremely low below temperatures of around cherry red which is about 600'C.
You will need to experiment. I would start with about 0.25W to 1W dissipation depending on how quickly you want to get to temperature.
So, for simplicity, use the PICAXE supply of 5v with a resistor value of 10R as starting point.
Be aware, that will drain AA batteries quite quickly.
 

lbenson

Senior Member
Thanks.

I realized that I can do this without putting it in the freezer (and with running it from a wall wart instead of batteries) if I just take ambient temperature (say 20C) as -18C, so for the range -18C to 35C I would be talking about heating the DS18B20s to from 20C to 73C. 73C is quite hot to touch but is approximately the peak for my hot water boiler supply pipe. I think heating to (virtual) 30 will suffice.

Then the temperatures could be adjusted back down in code by subtracting 53 (taking into account the picaxe's absence of knowledge of negative numbers). I know the entire simulation could be done in code, but I want to use actual DS18B20s.
 

AllyCat

Senior Member
Hi,

With a 20M2 can I get 6 PWMs with the same rate (say 1kHz) but different duty cycles?
I believe it's only four, even by combining PWM and HPWM modes. But as many as you want, at a lower frequency, using a software loop or perhaps interrupts.

10R seems rather drastic, that's 2.5 watts at 5 volts. With decent insulation (some mm of expanded polystyrene?) I'd start at about 200 mW, say 100 ohms from 4 x AA rechargeables (4.8v).

Cheers, Alan.
 

BeanieBots

Moderator
OOps. I was a factor of 10 out and did actually mean to say 100R. (0.25W @ 5v as per the text)
I think that would be a good starting point.
I once accidentally used 330R instead of 3k3 for a DS18B20 and it pulled the temperature up by several degrees in free air due to self heating on a 1Hz read loop.
I also agree that you can only get 4 PWMs from any single PICAXE unless doing it the hard way in code.
 

PhilHornby

Senior Member
DS18B20 info

I am considering simulation of temperature returns to a picaxe from multiple DS18B20s with the temperature set by PWMing through a resistor potted to the top of the DS18B20.
Completely by coincidence, I read something today on the Maxim Integrated web site, that might be pertinent...

One of the DS18B20 FAQs, is: "Where physically on the device does the temperature measurement take place?"

Answer :-

The DS18B20 does not sense temperature directly through the package. For all package types, the DS18B20 senses temperature primarily through the GND pin. Ensuring a good thermal connection between the GND pin of the device and the heat source you wish to measure will provide the best results.
Updated

So would something like this work (with the resistor soldered directly to the GND leg of the DS18B20) :-
DS18B20.png

Presumably, power would have to be removed from "Heat" for the 750mS it takes to perform the temperature reading.
 
Last edited:

lbenson

Senior Member
Since I would be driving the heating with pwm through the resistor to 0V, wouldn't I need to pot the resistor body to the 0V pin to use this feature? So it wouldn't be in series, but parallel.
 

PhilHornby

Senior Member
Rather than 'potting' the DS18B20 leg to the body of the resistor, I was thinking along the lines of soldering the DS18B20 GND pin as close as possible to the resistor body - and rather than cutting off the excess resistor lead, bending it at 90°, as an attachment point for your PWM connection.

Your method has the advantage of not having to pause the PWM while taking a reading.
 
Last edited:

lbenson

Senior Member
Works, but needs refinement to get the range of temperatures I want.

Of course, PWM is not needed--just turn the mosfet full on (and off if desired temperature achieved--adjusting for over/undershoot). With a 100 ohm resistor soldered to the 0V pin and next to the DS18B20 body, full on from a 4.2V 3-AA battery pack, the DS18B20 went from 26C to 39C in about 4 minutes. With a higher voltage and heat sink compound and insulation a higher temperature should be achievable. 12V should not over-stress my 1/4W resistor.
 

darb1972

Senior Member
Just spit balling, but could you consider using another sensor to achieve the desired temperature range? What about this http://www.datanab.com/sensors/1wire-%20thermocouple-sensor-thrmcpl_k.php

Has a temperature range of -30c to 85c.

Even if you didn't want to spend that much, you could use the MAX31850 to make your own version of a sensor. That way it's one wire with the necessary range.

I haven't looked at any datasheets so I don't know if this will work but thought it's worth consideration.

Regards
Brad
 

lbenson

Senior Member
Has a temperature range of -30c to 85c.
That appears to be a temperature sensor, not a heat source. And yes, you're right, it's pricy compared to a resistor. The DS18B20 will measure the temperature range I was interested in--I just wondered about how to generate that temperature.
 
Top