Page 1 of 2

Reading Temperatures?

Posted: Fri Aug 05, 2005 7:40 pm
by hcker2000
I'm trying to figure out how to use a pic16f88 to read a ds1820 temp sensor. In the end I would like to be able to read like 10 of them. Here is a general program over view.

Pic recives command to get temps from pc (over the serial port)
Pic talks to ds1820's
pic sends data back to the pc.

Thats all I need to do. So if some one can help me figure it out that would be great.

I need to know the fallowing.

1. how to hook the max232 level converter ic to the pic16f88
2. how to talk to the ds1820's
3. how to send and recive commands with the max 232.

Posted: Sun Aug 07, 2005 5:58 am
by jayjay
Hi

If your main objective is to be able to read multiple 1820's then you can get the DS9097 1-Wire serial adapter and hook it up to the PC's COM port. You can use the 1-Wire viewer from Dallas or the 1-Wire public domain kit. This option does not require a PIC or any MCU.

If you do need to use the a PIC, then look into 1-Wire protocol example code at the PIC list. Then ckeck out the appnote www.maxim-ic.com/appnotes.cfm/appnote_number/2420 titled 1-Wire Communication with a Microchip PICmicro Microcontroller.

HTH
Jay

Posted: Sun Aug 07, 2005 3:12 pm
by hcker2000
I was thinking of doing that as well. I also have the ds2490 that i beleave are 1-wire to usb chips. I havn't had a chance to test them as I dont have a 12mhz crystal laying around.

Posted: Mon Aug 08, 2005 4:37 am
by jayjay
Here's a simple DS9097 adapter schematic, it just needs a few diodes and a resistor and acts as a RS232 to 1-Wire adapter.

cfa-www.harvard.edu/~thunter/datasheets/PCto1.doc

HTH
Jay

Posted: Mon Aug 08, 2005 10:31 am
by wiml
For that matter, Dallas/Maxim will sell you a pre-built RS232-to-1wire dongle based on the '9097. (They probably sell the USB-to-1wire things as well.) IIRC, the price is competitive with buying the chip and putting the dongle together yourself.

Posted: Mon Aug 08, 2005 8:24 pm
by hcker2000
Well the usb to 1-wire is about $22-$25 + shiping. Not to mention they are hard to come by (especialy the serial ones ). The ic that is used for it can be sourced for free from dallas. Now I just got to see if radio shack has a 12mhz crystal.

Thanks to the link for the serial interface though I will definitly check it out.

Posted: Tue Aug 09, 2005 3:42 am
by jayjay
Hi

I do have code for low level 1-Wire protocol in C originally targeted at a MSP430 processor, it can be ported to other MCUs. I used it to communicate with iButtons/ DS2450 etc. It does not implement the higher layers just the bare basic 1-Wire timing waveform via bit-bang. If yer interested lemme know.

Btw, you may wan to sample the DS2480 from Dallas as well, thats the RS232->1-Wire driver chip, also used in 9097 adapters.

Cheers
Jay

Posted: Tue Aug 09, 2005 4:40 pm
by hcker2000
Sure the code would be great the I'm not sure if I will be able to do the porting to pic asm or not.

The target pic is a 16f88 because it will be easy to use for the serial portion of the project.

If I could get this usb chip going then I guess I dont need the pic. All I need to do is be able to read the temps out on a pc. USB is prefered because I am runing out of serial ports. I can always buy more usb to serial adaptors but that costs me :D

Posted: Wed Aug 10, 2005 1:49 am
by jayjay
Since you are headed the USB way, sometime back I did a 1-Wire to USB converter based on a Freescale HC08JB8, its a USB 1.1 chip. I'll try to consolidate all the file and uplaod it over the weekend.

Cheers
Jay

Posted: Wed Aug 10, 2005 4:59 am
by hcker2000
jayjay wrote:Since you are headed the USB way, sometime back I did a 1-Wire to USB converter based on a Freescale HC08JB8, its a USB 1.1 chip. I'll try to consolidate all the file and uplaod it over the weekend.

Cheers
Jay
Thanks man that would be a great help. Are all the parts you used prity easy to work with? Basicly I'm trying to keep it as simple as posible and make sure I can suport like 30 temp sensors (I dont plan on using that many but I feel that is a good number to be able to handle).

Posted: Mon Aug 15, 2005 10:28 pm
by hcker2000
I was wondering if any one had some more info on what I need to do to get the temps and send them to the pc?

Posted: Tue Aug 23, 2005 10:07 pm
by k6rfm
I have some PIC asm code that reads the temperature from two DS1820s; the DS1820s are on separate i/o ports. If you want to have multiple DS1820s on a single port (and if you want 10 to 30 ds1820s you're going to have to do that!) then you need to read the ROM address codes out of the chips (I do that) and use the address rom command before converting the temp; since I only have one ds1820 per port I just do "skip rom". Note you will want the DS1820 spec sheet and app note 2420 from the Dallas/Maxim website.

I just put my code up at

http://www.pensfa.org/FirstDS1820.asm

Posted: Wed Aug 24, 2005 10:40 am
by jayjay
Sorry guys, had to leave town and was not able to post the 1-Wire code as promised. Now I have got the files ready, anyone got a webspace to host it? Its less than 500KB

Cheers
Jay

Posted: Wed Aug 24, 2005 7:29 pm
by hcker2000
JayJay I can host it. Just email to me hcker2000@gmail.com and I'll post the url for it here.

Posted: Thu Aug 25, 2005 5:28 am
by jayjay
Thanks for taking the effort the host the file. I have email 2 zips to you.

Dallas1_Wire_ For_MSP430.zip - 1-Wire low level driver for MSP430, using timer based delay, includes schematic
Dallas1_Wire_ For_HC08JB8.zip - 1-Wire low level driver for HC08JB8, using dead loop delay, the MCU is clocked by a 6Mhz crystal.

Regds
Jay