DHT Sensor Library


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Oct 2013
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: DHT Sensor Library

    Hi to all,
    I tested this library and works excellent with AM2302 sensor.Is it possible to measure negative temperature with this library.I dont have a FREEZ spray at the moment so I can not tested it.Did someone try measure negative temperature.In code I do not see the variable to show negative sign on screen.
    Best regards

  2. #2
    Join Date
    Jul 2004
    Location
    Madrid-Spain
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Re: DHT Sensor Library

    Hi Tabsoft many thanks for your efforts.

    I have my license for pbp 3.0 yet unused ( for more than one year lol ) but hope that this summer will have some time to experiment with it. Can you suppli the library for the 3.0 versión?

    Thanks in advance
    Carpe Diem

  3. #3
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: DHT Sensor Library

    Sorry for the delayed response.

    Here is the library for PBP3.

    PBP3_DHT_LIB_v004.zip

    Enjoy.
    Regards,
    TABSoft

  4. #4
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: DHT Sensor Library

    How to remove unused sensors?
    I'm using only one, but when I comment out DHT_Sensor2 and others, code won't compile.
    Or I should leave these as is?

  5. #5
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: DHT Sensor Library

    LOL - I've not been on this forum for years, and today received notification of your post... How you doing ?

    Like I said I've not been active on here for some years, and no longer program in PBP so I'm rusty when it comes to the workings

    Comments taken form that library file file suggest

    Code:
    '-- To REMOVE SENSORS perform the following:                              --
    '--   1. Change the "AM2302_MAX_SENSORS" constant to the correct number.  --
    '--   2. Comment out the appropriate "AM2302_Sensor_x" Alias lines.       --
    '--   3. In the "AM2302_Read" subroutine in the library file,             --
    '--      edit the "select case AM2302_Sensor_Num" block, comment out the  --
    '--      "Case x" portion for the sensor number you want to remove.       --
    '--   4. Comment out the entire "AM_Readx" subroutine at the end          --
    '--      of this library file for the sensor you want to remove.          --
    and this needs editing

    Code:
    '****************************************************************************
    '*** EDIT THIS SELECT CASE BLOCK TO ADD/REMOVE SENSORS (see instructions) ***
    '****************************************************************************
        select case AM2302_Sensor_Num
            case 1           'Sensor #1      
                gosub Read_AM1
            case 2           'Sensor #2
                gosub Read_AM2
            case 3           'Sensor #2
                gosub Read_AM3
            case 4           'Sensor #2
                gosub Read_AM4
        end select




    Looking at the code for the version of thermostat that I used as a test platform when Tabsoft was developing the library the main program has this line in the set up area of the code (using include "AM2302_LIB_v024.bas" )

    Code:
    ;----[AM2302 ]------------------------------------------------------------------
    AM2302_MAX_SENSORS con 4                        ' Number of Sensors Used

    I then used a word array for the temp and humidity values

    Code:
    AM2302_H          var word[4]                   ' AM2302 sensors - Humidity values
      AM2302H1        var AM2302_H[0]
      AM2302H2        var AM2302_H[1]
      AM2302H3        var AM2302_H[2]
      AM2302H4        var AM2302_H[3]
      
    AM2302_T          Var Word[4]                   ' AM2302 sensors - temperatures
      AM2303T1        Var AM2302_T[0]
      AM2303T2        Var AM2302_T[1]
      AM2303T3        Var AM2302_T[2]
      AM2303T4        Var AM2302_T[3]
    I guess if using just the one sensor this could be a straight word variable

    I then have a link to a subroutine

    Code:
    for cn=1 to 4  
    Pid_channel=cn-1 
    AM2302_Sensor_Num = cn     
    gosub read_dht
    And the subroutine it links to is

    Code:
    read_dht: 
      
        gosub AM2302_Read   
        AM2302_H[Pid_channel]= AM2302_Hum
        AM2302_T[Pid_channel]= AM2302_Temp
          
        if AM2302_Temp/10=0  then return  
        serout2 portB.0, 84, [$1B,"[H"]
        serout2 portB.0, 84,[$1b, "[", dec cn+1, "B"]  
        serout2 portB.0, 84, [$1B,"[11C"]   
        serout2 portB.0, 84, [dec AM2302_Temp/10,".",dec AM2302_Temp//10]
        
        serout2 portB.0, 84, [$1B,"[H"]
        serout2 portB.0, 84,[$1b, "[", dec cn+1, "B"]
        serout2 portB.0, 84, [$1B,"[17C"]
        serout2 portB.0, 84, [dec AM2302_Hum/10,"%"]    
    
    Return
    Ignore all the serial out commands, I was using a serial to GLCD adapter at the time. The gosub called in the above subroutine is in the library file.

    Hopefully that dissection of my old program helps ? I sold my old EasyPic5 board at the beginning of September this year, and uninstalled PBP years ago, so have no means to test, but the code ran for a few years in the controller before I move to the dark side and ported the code to an Arduino Mega to take advantage of colour TFT screens.

  6. #6
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: DHT Sensor Library

    Scampy, thanks for the visit.Can I get you a cup of coffee? Pertaining to TFTs, I started working with the Nextion touch screens. There is an article series still running in Nuts and Volts Magazine controlling the Nextion with PBP3 that might interest you. Myself, I also moved to bigger challenges with MPLABX & XC8/XC16.

  7. #7
    Join Date
    Feb 2013
    Posts
    1,124


    Did you find this post helpful? Yes | No

    Default Re: DHT Sensor Library

    Thanks!
    Will this library measure negative temperature?
    I'm integrating that AM2302 into my VFD clock, as outdoors sensor...

Similar Threads

  1. Replies: 6
    Last Post: - 14th October 2013, 12:27
  2. DHT 11 Humidity & Temperature Sensor
    By jefrem in forum mel PIC BASIC
    Replies: 2
    Last Post: - 30th July 2013, 19:15
  3. Dht 11 & dht 22
    By DavidK in forum Off Topic
    Replies: 5
    Last Post: - 15th May 2012, 14:57
  4. SD card library?
    By Alexey in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 7th February 2012, 11:28
  5. Library tools? Library Specs?
    By PickyBiker in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 21st May 2010, 02:54

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