C programming (not arduino) to read DS18B20 one wire (thermistor?)

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

KuntzBrewing

Well-Known Member
Joined
Aug 22, 2011
Messages
630
Reaction score
13
Location
Kokomo
I thought that this was a simple a2d conversion. Plug in the wire to the chip and read the voltage. Convert the voltage to a temp. I'm using an ATmega328P chip. I've tried google but if your not using the arduino interface then there seems to be no help.
 
LM35 is like that (simple output voltage) but not DS18B20. Not trying to be funny, but you could learn that from reading the data sheet, and other things besides. Like which pin is which.

If you don't want to use the Arduino IDE try googling "AVR DS18B20".
 
No, it operates on the Dallas Semiconductor/Maxim 1-Wire bus, a serial protocol that can allow for multiple sensors and "switches" to share the same bus. You should look up the OneWire.h file to see how the Arduino handles the bus, as you could likely adapt it for your use. It has the advantage of minimizing the number of analog pins needed for temperature sensors. It can also be used to control SSDs, relays, etc. using one of their 1-Wire switches.
 
I read the manual and wrote code. It seems to read degrees C correctly (close enough) although instead of a 4.7K ohm resistor i used a 330ohm or 3.3kohm (i tested it early in the day i forget which it was) but the dsm18b20 in a ceramic cup of ice cold water read .8ish degrees celsius. That makes sense to me. I mean thats around 33-34 degrees F
 
Luckily ive got a good professor and 8 of us are in a class ( my professor designed every board for Carrier air systems (industrial air conditioners.))
 
Sounds like you're away. Iced water is not necessarily 0°C, to calibrate properly you should fill the glass with ice and test the water in between the cubes or use ice slush.

3.3K would be fine for the pull-up.
 
I've found that with thermistors I need to constantly stir them in the ice slush water to get it all the way down to 32f. The very little power they consume will heat up the water around it if you don't keep stirring it. This is probably the same case for the active temp sensors.
 

Latest posts

Back
Top