Please help with code for DS18B20


Closed Thread
Results 1 to 40 of 110

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Hi, Malc

    Do you understand the "why" of the Parallax document, now ... ???

    You'll have to place your Button Key INSIDE the vivarium ( hé,hé ... WITH the snakes !!! ) if you want a true image of your temp.

    The graphs you've shown can't be used to finely trim a regulator ... but are a good example.

    Temp measurement and moreover probes placing is a real art ... to get a nice temp regulation.

    But let's begin by the beginning :

    ALL you have to do already is in ZE Book ... with relevant code.

    We'll see details later ...

    Till then, I'll implement the PID Regulator on my existing " 84 " Thermostat ( not the one shown here, but a nicer one which is pin for pin compatible !! )

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2
    Join Date
    May 2008
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    Alain

    You were right as always. I hadn't the board configured properly.

    I totally forgot about the row of jumpers to set the pins pull-up or pull-down, I had it set wrong.

    Thank you

  3. #3
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi, Malc

    You'll have to place your Button Key INSIDE the vivarium ( hé,hé ... WITH the snakes !!! ) if you want a true image of your temp.

    Alain
    Agreed,

    I've just taken a further reading with the probes 2" from the heater, so its sampling the air temperature. Here's the result (the button logger still on the shelf as shown)



    If you ignore the fluctuations in between 10pm and 3am when the snake was out and obviously laying on the sensor, and look at the period 4am to 4pm you'll see it a lot more stable and only has a 0.2C deviation.

    DT, could you elaborate on a PID loop.

    Alain, could you provide a link to that file... I'm frantically searching for a DS1820 so I can start developing this project, but as my PBP programming is so rusty (and basic) may need you guys to offer some assistance if I get stuck (or should that be when I get stuck )

  4. #4
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by malc-c View Post
    DT, could you elaborate on a PID loop.

    OK - google was my friend

    http://en.wikipedia.org/wiki/PID_controller

  5. #5
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default



    Err.... yeah...

    previous_error = 0
    integral = 0
    start:
    error = setpoint - actual_position
    integral = integral + (error*dt)
    derivative = (error - previous_error)/dt
    output = (Kp*error) + (Ki*integral) + (Kd*derivative)
    previous_error = error
    wait(dt)
    goto start
    LOL - £34 for a commercial thermostat looks more promising !

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by malc-c


    Err.... yeah...



    LOL - £34 for a commercial thermostat looks more promising !
    What ? That's as clear as mud! I thought they taught you that in primary school.
    34 pounds for a thermostat? Must be the VAT ! Damn Globalists, want to federalize the world !
    http://www.prothermostats.com/produc...product=100934
    $40 US 24.42 GBP
    Last edited by Archangel; - 16th December 2009 at 16:56.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  7. #7
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Please help with code for DS18B20

    hi all,

    i would like to make the circuit for the thermostat. could you please upload the circuit schematic? thanks a lot for your help.

  8. #8
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Please help with code for DS18B20

    Dear all,

    sorry for asking you for the schematic, i did it from the code but i need your advice according to the second sensor please.

    could you please help me out to finish the schematic?

    thanks.
    Attached Images Attached Images  

  9. #9
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    You've got better friends than that.
    HenrikOlsson for instance ...

    PID-filter routine (2nd try).
    http://www.picbasic.co.uk/forum/showthread.php?t=5874

    I've used it. It works great.
    It's a little tricky to find the correct constants. But trial and error usually works.
    Although there is a purposeful method to tune the loop.
    <br>
    DT

  10. #10
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    You've got better friends than that.
    HenrikOlsson for instance ...

    PID-filter routine (2nd try).
    http://www.picbasic.co.uk/forum/showthread.php?t=5874

    I've used it. It works great.
    It's a little tricky to find the correct constants. But trial and error usually works.
    Although there is a purposeful method to tune the loop.
    <br>
    Sorry Darrel.... it's been a long day......!

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Re-Writing IF-THEN-AND-ENDIF code?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th August 2006, 17:23

Members who have read this thread : 3

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts