Reading Temperatures?

Have questions about a SparkFun product or board? This is the place to be.
hcker2000
Posts: 58
Joined: Fri Aug 05, 2005 7:31 pm
Location: Central Ohio
Contact:

Reading Temperatures?

Post by hcker2000 » Fri Aug 05, 2005 7:40 pm

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.

jayjay
Posts: 110
Joined: Fri Jul 01, 2005 2:40 am

Post by jayjay » Sun Aug 07, 2005 5:58 am

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

hcker2000
Posts: 58
Joined: Fri Aug 05, 2005 7:31 pm
Location: Central Ohio
Contact:

Post by hcker2000 » Sun Aug 07, 2005 3:12 pm

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.

jayjay
Posts: 110
Joined: Fri Jul 01, 2005 2:40 am

Post by jayjay » Mon Aug 08, 2005 4:37 am

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

wiml
Posts: 473
Joined: Tue Feb 08, 2005 11:45 pm
Location: Seattle, WA, USA
Contact:

Post by wiml » Mon Aug 08, 2005 10:31 am

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.

hcker2000
Posts: 58
Joined: Fri Aug 05, 2005 7:31 pm
Location: Central Ohio
Contact:

Post by hcker2000 » Mon Aug 08, 2005 8:24 pm

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.

jayjay
Posts: 110
Joined: Fri Jul 01, 2005 2:40 am

Post by jayjay » Tue Aug 09, 2005 3:42 am

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

hcker2000
Posts: 58
Joined: Fri Aug 05, 2005 7:31 pm
Location: Central Ohio
Contact:

Post by hcker2000 » Tue Aug 09, 2005 4:40 pm

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

jayjay
Posts: 110
Joined: Fri Jul 01, 2005 2:40 am

Post by jayjay » Wed Aug 10, 2005 1:49 am

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

hcker2000
Posts: 58
Joined: Fri Aug 05, 2005 7:31 pm
Location: Central Ohio
Contact:

Post by hcker2000 » Wed Aug 10, 2005 4:59 am

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).

hcker2000
Posts: 58
Joined: Fri Aug 05, 2005 7:31 pm
Location: Central Ohio
Contact:

Post by hcker2000 » Mon Aug 15, 2005 10:28 pm

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?

k6rfm
Posts: 1
Joined: Sat Apr 16, 2005 10:53 am

Post by k6rfm » Tue Aug 23, 2005 10:07 pm

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

jayjay
Posts: 110
Joined: Fri Jul 01, 2005 2:40 am

Post by jayjay » Wed Aug 24, 2005 10:40 am

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

hcker2000
Posts: 58
Joined: Fri Aug 05, 2005 7:31 pm
Location: Central Ohio
Contact:

Post by hcker2000 » Wed Aug 24, 2005 7:29 pm

JayJay I can host it. Just email to me hcker2000@gmail.com and I'll post the url for it here.

jayjay
Posts: 110
Joined: Fri Jul 01, 2005 2:40 am

Post by jayjay » Thu Aug 25, 2005 5:28 am

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

Locked

Return to “SparkFun Product Questions”