SMALL - espritmodel.com SMALL - Telemetry SMALL - Radio
Reply
Thread Tools
Old Aug 29, 2010, 02:27 PM
Registered User
xtal's Avatar
McDonough, Georgia USA
Joined Feb 2005
304 Posts
Mini-HowTo
1-wire Temperature sensing

I got some samples from maxim DS18B20-PAR temperature sensors
wired up a PARASITIC circuit ss025 ,, however added 100 ohm as in
ss026 ....
I put 4 sensors on my outside AC unit connected with about 50 feet
of cat 5 ,, fired up LogTemp [Mr Soft] works like a champ....
Sensor display is ss024
Red = Suction Line
Purple = Liquid Line
Dark Green = Ambient Air In
Lime Greem = Exhaust Air

No just what does this tell me ? Nothing except its running ....
I'm assuming there is good info there , I just don't under stand it all.

I was impressed by how easy it was to get this going.....
I initially tried Digitemp v17, which worked until I installed LogTemp..
Since LogTemp worked so well I didn't pursue the issue.

Now I need to use some 12f683 and try to get some slaves working to enable
various toys ,, that is if I can find some code,,I really don't want
to reinvent the wheel....

PC.----adapter----------outside --resister ----------sensor1
--resister ----------sensor2
--resister ----------sensor3
--resister ----------sensor4
xtal is offline Find More Posts by xtal
Reply With Quote
Sign up now
to remove ads between posts
Old Aug 30, 2010, 12:27 AM
Inventor&Genius Extraordinary
tune by tito's Avatar
USA, CA, Riverside
Joined May 2006
491 Posts
Atmel made a application note for this kind of bus system, here is the link:
AVR318: Dallas 1-Wire® master , I think Microchip have one application note about Dallas 1-wire protocol.
Best Regards Tito
tune by tito is offline Find More Posts by tune by tito
Reply With Quote
Old Aug 30, 2010, 05:38 AM
Registered User
UK
Joined Oct 2003
3,822 Posts
I can't quite work out your schematics. The DS18B20 sensors require +5v and GND on their supply pins with a resistor of around 4.7K between the data line and +ve.




Check out the data sheet http://datasheets.maxim-ic.com/en/ds/DS18B20.pdf for more info
Malc C is offline Find More Posts by Malc C
Reply With Quote
Old Aug 30, 2010, 07:48 AM
Registered User
xtal's Avatar
McDonough, Georgia USA
Joined Feb 2005
304 Posts
when in parasitic mode +5volt not required [totally magic]
and you tie +5 pin to the ground pin....
note 18b20+PAR the pins are internally tied togather
xtal is offline Find More Posts by xtal
Reply With Quote
Old Aug 30, 2010, 07:54 AM
"MAYONNAISE"
Acetronics's Avatar
Le Treport, France
Joined Jun 2004
1,408 Posts
Quote:
Originally Posted by Malc C View Post
I can't quite work out your schematics. The DS18B20 sensors require +5v and GND on their supply pins with a resistor of around 4.7K between the data line and +ve.
Eeeeee, Malc

Those used ar PAR devices ...

see RELEVANT Datasheet ...

Alain
Acetronics is offline Find More Posts by Acetronics
Reply With Quote
Old Aug 30, 2010, 11:20 AM
Registered User
UK
Joined Oct 2003
3,822 Posts
stand corrected
Malc C is offline Find More Posts by Malc C
Reply With Quote
Old Aug 30, 2010, 10:36 PM
Inventor&Genius Extraordinary
tune by tito's Avatar
USA, CA, Riverside
Joined May 2006
491 Posts
Quote:
Originally Posted by xtal View Post
when in parasitic mode +5volt not required [totally magic]
and you tie +5 pin to the ground pin.... you are wrong!!!!!!!!!!!!!
note 18b20+PAR the pins are internally tied togather
POWERING THE DS18B20

The DS18B20 can be powered by an external supply on the V
DD pin, or it can operate in “parasite power” mode, which allows the DS18B20 to function without a local external supply. Parasite power is very useful for applications that require remote temperature sensing or that are very space constrained.


Figure 1 shows the DS18B20’s parasite-power control circuitry, which “steals” power from the 1-Wire bus via the DQ pin when the bus is high. The stolen charge powers the DS18B20 while the bus is high,

and some of the charge is stored on the parasite power capacitor (CPP) to provide power when the bus is low. When the DS18B20 is used in parasite power mode, the VDD pin must be connected to ground.
In parasite power mode, the 1-Wire bus and CPP can provide sufficient current to the DS18B20 for most operations as long as the specified timing and voltage requirements are met (see the DC Electrical
Characteristics and AC Electrical Characteristics). However, when the DS18B20 is performing temperature conversions or copying data from the scratchpad memory to EEPROM, the operating current can be as high as 1.5mA. This current can cause an unacceptable voltage drop across the weak 1-Wire pullup resistor and is more current than can be supplied by CPP. To assure that the DS18B20 has sufficient supply current, it is necessary to provide a strong pullup on the 1-Wire bus whenever temperature conversions are taking place or data is being copied from the scratchpad to EEPROM. This can be accomplished by using a MOSFET to pull the bus directly to the rail as shown in Figure 4. The 1-Wire
bus must be switched to the strong pullup within 10μs (max) after a Convert T [44h] or Copy Scratchpad [48h] command is issued, and the bus must be held high by the pullup for the duration of the conversion
(tCONV) or data transfer (tWR = 10ms). No other activity can take place on the 1-Wire bus while the pullup is enabled.
The DS18B20 can also be powered by the conventional method of connecting an external power supply to the VDD pin, as shown in Figure 5. The advantage of this method is that the MOSFET pullup is not
required, and the 1-Wire bus is free to carry other traffic during the temperature conversion time. The use of parasite power is not recommended for temperatures above +100°C since the DS18B20 may
not be able to sustain communications due to the higher leakage currents that can exist at these temperatures. For applications in which such temperatures are likely, it is strongly recommended that the
DS18B20 be powered by an external power supply.
In some situations the bus master may not know whether the DS18B20s on the bus are parasite powered or powered by external supplies. The master needs this information to determine if the strong bus pullup
should be used during temperature conversions. To get this information, the master can issue a Skip ROM [CCh] command followed by a Read Power Supply [B4h] command followed by a “read time slot”.
During the read time slot, parasite powered DS18B20s will pull the bus low, and externally powered






DS18B20s will let the bus remain high. If the bus is pulled low, the master knows that it must supply the
strong pullup on the 1-Wire bus during temperature conversions.
tune by tito is offline Find More Posts by tune by tito
Reply With Quote
Old Aug 31, 2010, 03:58 AM
"MAYONNAISE"
Acetronics's Avatar
Le Treport, France
Joined Jun 2004
1,408 Posts
Hi, XTAL

If you are looking for some code ... have a look to MiKroBasic Forum ... BUT remember you won't be able to use the Genuine libs with PAR devices.
Use some custom libraries you will find on the site ... ( from Marcio Nassori , in the projects section )

Alain

BTW: if you use a display ... 2K might be a bit short with MkE compilers ...
Acetronics is offline Find More Posts by Acetronics
Reply With Quote
Old Sep 07, 2010, 05:18 PM
Registered User
xtal's Avatar
McDonough, Georgia USA
Joined Feb 2005
304 Posts
thx , I'll have a look....

I'm having a tough time figuring the slave timing

too many senior moments
xtal is offline Find More Posts by xtal
Reply With Quote
Old Sep 08, 2010, 01:56 AM
Registered User
Oregon, USA
Joined May 2010
33 Posts
Quote:
Originally Posted by xtal View Post
thx , I'll have a look....

I'm having a tough time figuring the slave timing

too many senior moments
The following is a rough outline on all the steps required to readout a single 1-wire device, ported to GCBasic. Let us know which part is the problem.

Code:
function ReadTemp
  MasterRST
  PPulse
  OWout SkipRom
  OWout ConvertT
  #IFDEF Bus PARasitic
   Set Pullup On
  #ENDIF
  wait 1 s     'Need at least 750 ms for conversion?
  #IFDEF Bus PARasitic
    Set Pullup Off
  #ENDIF
  MasterRST
  PPulse
  OWout SkipRom
  OWout ReadScratch
  #IFDEF OWDevice ds18b20
   OWin12
    ReadTemp = RxData  ;whole no. with sign bit
  #ENDIF
  #IFDEF OWDevice ds18s20
   OWin
   ReadTemp = RxData/2  ;whole no. with NO sign bit
  #ENDIF
end function
nickelflipper is offline Find More Posts by nickelflipper
Reply With Quote
Old Sep 08, 2010, 11:32 AM
Registered User
xtal's Avatar
McDonough, Georgia USA
Joined Feb 2005
304 Posts
I'm not trying to read from a slave ....not yet any way
I want to program a 12f683 to act like a slave...
Looks like I may just need to reinvent the wheel and
write my code using mikrobasic and some inline asm
I would like to get clearer timing values to use...
xtal is offline Find More Posts by xtal
Reply With Quote
Old Sep 08, 2010, 12:55 PM
Registered User
Oregon, USA
Joined May 2010
33 Posts
Timing values for what specifically? Sounds like you are looking for a particular member to answer?, relating to a PM or something, in which case I will butt out. Otherwise..... read on.

Use a software Usart routine. Poll for incoming start bit from master and read into an array, or set of variables, as they come in. Or am I still not getting it Surely mikrobasic has a software Usart library, if not then here is a RS232 tutorial.

When the 8 pin PIC16f1822 finally comes around, you could use a hardware Usart, or even the MSSP if the data is local in nature, and an interrupt routine.
nickelflipper is offline Find More Posts by nickelflipper
Reply With Quote
Old Sep 08, 2010, 02:22 PM
"MAYONNAISE"
Acetronics's Avatar
Le Treport, France
Joined Jun 2004
1,408 Posts
Hi, Xtal

I think " soft UART " could do it easily : your pic will respond on receiving a " Key string " and send back your value.

Those two links should help a lot ...

http://www.mikroe.com/download/projects/soft_uart.rar
http://www.mikroe.com/download/projects/onewirelib.zip

an eye here too :
http://www.maxim-ic.com/app-notes/index.mvp/id/3358


Alain
Acetronics is offline Find More Posts by Acetronics
Last edited by Acetronics; Sep 09, 2010 at 03:38 AM.
Reply With Quote
Old Sep 10, 2010, 03:55 PM
Registered User
xtal's Avatar
McDonough, Georgia USA
Joined Feb 2005
304 Posts
As far as I know no compiler has a library that supports SLAVE functions

As I understand the timing......

1> master pulls wire low for 480-960 us then releases wire which goes high thru pullup
1a> this was [reset sequence]
2> after ~ 20us slave pulls line low for 60-240 us then releases
2a> this is [presense pulse]
3> slave waits for high then low the waits ~35us samples line , put bit in byte [8 times]
3a> just recieved the command byte
4> master releases line, goes high thru pullup
5> some cmds are readrom skiprom searchrom matchrom and other possibilities
6> readrom=>
6a> slave waits for hi then waits for lo
6b> if tx1 releases line [waits~35us implied]
6c> if tx0 pulls line lo waits ~35us releases line
6d> repeat [6a] till 8 bits transmitted
6e> repeat [6] till 8 bytes transmitted
6f> ?? then go [wait for reset]

7> matchrom=>
7a> recieve 1st byte from master [as in #3]
7b> compare byte
71> 1st byte family code
72> 2nd-7th byte SN
73> 8th byte crc
74 if any mismatch [wait for reset]
7c> repeat till 8 bytes rcv'd last byte = crc
7d> next rcv Funct cmd byte to do whatever

8> skiprom=>
8a> rcv Funct cmd byte to do whatever

9> searchrom=>
9a> slave will eventually xmit 64 bits [8 byte sn]
91> xmit bit actual
92> xmit actual complemented
93> rcv bit from master
94> if bit from master is same as last actual xmitted continue
with next bit [1-64] else [wait for reset]


9b> not sure ??? wait for Funct_cmd or [wait for reset]

9c> keep in mind that all slaves are responding and eventually [wait for reset]

9d> master performs magic and eventually logs all devices



I would like to get the timing vales set for the sweetpoint [ie] that will work with
most master drivers.....I don't want to tweak and retweak....

There is a overdrive mode that really speeds things up,,,I'll be happy to get the
low speed working reliably....
xtal is offline Find More Posts by xtal
Reply With Quote
Old Sep 12, 2010, 11:24 AM
Registered User
Oregon, USA
Joined May 2010
33 Posts
Oh, you want to make 12f683 a 1-wire device.....hehe.

My take on basic timing, warts and all, and no effort to optimize in any way.
nickelflipper is offline Find More Posts by nickelflipper
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Where to temperature test an outrunner? ibange Power Systems 7 Aug 15, 2010 08:42 PM
Wanted WTB: Temperature-controlled soldering iron or 2-in-1 solder/rework station. Cheesehead Aircraft - General - Miscellaneous (FS/W) 1 Dec 25, 2009 05:06 PM
Question How to control the temperature of a hot wire bow? Barry P Foamies (Scratchbuilt) 20 Sep 18, 2006 09:35 PM
Discussion 401 gyro sensing wire Crewdogg998 Mini Helis 6 Jun 02, 2006 08:57 PM
temperature rise in wire due to power absorption? astroboy Modeling Science 6 Nov 08, 2002 04:58 PM