Announcement

Collapse
No announcement yet.

SOS, DS18B20

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • SOS, DS18B20

    hi!!!!!!
    I need to get temperature with DS18B20. I have read all topic in the forum but I don't find solution. I connect pin1 -> GND, pin2 ->IO2 and pin3->5V. Here, http://www.4dsystems.com.au/downloads/Semiconductors/GOLDELOX-GFX2/Docs/GOLDELOX-GFX2-DS-rev2.0.pdf in page 9 indicate that pin3 must connect to 3.3V. Unfortunately, either it worked. What can I do and what is the correct code.
    Please help!!!


    [hr]DEVBOARD-G1 with µOLED-160-G1(GFX)

  • #2


    Sounds like you have already tried some code and cant get a reading.

    How about you show us the code you are using, then we might be able to help ?

    There is a reference here http://4d.websitetoolbox.com/post/One-Wire-DS18B20-bit-shift-problem-4551224?highlight=ds1820

    I'm fairly sure the latest PmmC fixed this problem so hopefully it will help.

    Theres also a progam in the workshop examples that shows how to program/read an 1821 which I think is very similar
    Regards,
    Dave

    Comment


    • #3
      #platform "GOLDELOX-GFX2"#inherit "4DGL_16bitColours.fnc"
      var ldr;var temp_LSB, temp_MSB;func main()
      pin_Set(ONEWIRE, IO2);
      gfx_Cls();
      repeat
      ldr := pin_Read(1); if(OW_Reset())print("Δεν βρέθηκε συσκευή");while(1);
      elserepeat
      txt_MoveCursor(2, 0);
      OW_Reset();OW_Write(0xCC);OW_Write(0x44);OW_Reset();
      OW_Write(0xCC);OW_Write(0xBE);
      temp_LSB := OW_Read();
      pin_HI(1);temp_MSB := OW_Read();pin_LO(1);
      txt_MoveCursor(0,0);print("Η θερμοκρασία είναι:\n", [HEX2] temp_LSB, " ", [HEX2] temp_MSB,"*C"); print ([DEC3Z] ldr,"\n"); pause(500); gfx_Cls();
      //forever//until (joystick() == FIRE);
      foreverendifforever
      endfunc

      Comment


      • #4


        Are you getting past the "Could not find device" message?
        Regards,
        Dave

        Comment


        • #5


          Always I get 0 as result, even when the sensor is not connected

          Comment


          • #6


            yes, but now it shows to find the device

            Comment


            • #7


              Do you have a pullup resistor as per schematic on page 9 of doc?
              Regards,
              Dave

              Comment


              • #8


                Yes, I use 4.7K resistor

                Attached files

                Comment


                • #9


                  looks like you have it connectrd wrong to me - looking from the top as you have it - is GND not to the right - if you have (as I found to my cost) you may have damaged the sensor

                  Comment


                  • #10


                    Picture is blurry, but if I squint it looks fairly correct and I'm sure you know what you are doing.

                    Do you have access to an oscilloscope?

                    If so probe the device while it is being polled and look for anomolies. Check silly things like bad connections - make sure power connections correct first etc etc


                    From what I see code looks correct, although I have not used DS18B20, only DS1821 - but if demo code at http://4d.websitetoolbox.com/post/One-Wire-DS18B20-bit-shift-problem-4551224?highlight=ds1820 actually works
                    it looks like you should be getting something.

                    You said "yes, but now it shows to find the device",
                    If you get that far it is most likely giving correct timing for the RESET condition so dont know why you dont get further.

                    Please try and work it out, will help more tomorrow if I can - way past bedtime here now
                    Regards,
                    Dave

                    Comment


                    • #11


                      oh dear - thanks for the input kaddrison - will wait for the post mortem
                      Regards,
                      Dave

                      Comment


                      • #12


                        ok!! thanks!!!!

                        Comment


                        • #13


                          I connect the sensor to IO1 and I change "pin_Set(ONEWIRE,IO1)" and it works.... but I need it to IO2. What's wrong?

                          Comment


                          • #14


                            The last question to complete my project.....I get FF 07 as result. In my room the temperature is 22 degrees Celsius. Also when I go to balconi the temperature is 17 degrees Celsius but I get the same result (FF 07).Can anybody help???

                            Comment


                            • #15


                              do you have another sensor?
                              Did you connect the wrong way ?
                              Also may have noticed the problem with IO2

                              pin_HI(1);temp_MSB := OW_Read();pin_LO(1);
                              should these be (2) ?

                              Comment

                              Working...
                              X