Shop OBEX P1 Docs P2 Docs Learn Events
Connecting Datalogger to Sensirion Temp/Humidity Sensor — Parallax Forums

Connecting Datalogger to Sensirion Temp/Humidity Sensor

Andrew (ARLISS)Andrew (ARLISS) Posts: 213
edited 2008-01-29 00:41 in Learn with BlocklyProp
Hey everybody,
I was wondering how to connect my USB datalogger to my Sensirion SHT11 Temp/Humidity sensor. I am able to get the demo program for the usb datalogger to write random numbers to my flash drive sucessfully. I am also able to get the seperate SHT11 demo program to read the live temp/humidity values. I've read through all the documentation for both components but I can't get a straight answer to get the temp/humidity values to write to the·USB flash drive. Is there a program or diagram someone can give me to get this up and running. Thanks in advance!
Andrew

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-01-25 23:27
    Hi Andrew, putting the two pieces together is a matter of using the SHT11 values collected by the Stamp and putting them in a serial instruction to write to the logger. Before you can format the serial to logger data you will need to know how many bytes you are sending per transmission including any seperators such as commas and periods.

    What data do you·want to log and how many bytes does it contain and how do you want to format the log file.

    Jeff T.
  • Andrew (ARLISS)Andrew (ARLISS) Posts: 213
    edited 2008-01-25 23:33
    Thanks for the reply. I'm kind of new to this and I'm interested of just logging the temperature and humidity values (in celsius) about every 4 seconds to my USB drive. As for the file format, I'm okay with a plain text file. Just something I can easily open on my laptop and transfer the data to Excel or Word.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-01-26 00:06
    If you begin by logging only temperature to begin with and when you get that worked out add in the humidity.

    The serial out to your logger is going to be virtually the same as when you used the example program with random numbers.

    The important thing to remember with the VDAP write file instruction is to make sure you write exactly the number of bytes that you tell it your going to write.

    something like this might work SEROUT tx,baud,("wrf",$20,0,0,0,$04,$0D,DEC2 (tC/10),".",DEC1 tC,$0D)

    the decimal 2 , period and decimal 1 add up to 4 bytes, your final string may be much longer than that it's only a rough example.

    I'm not sure how far you have got with this Andrew I hope this is helpful

    Jeff T.
  • Andrew (ARLISS)Andrew (ARLISS) Posts: 213
    edited 2008-01-26 00:13
    Thanks a lot. I'm really new to this and I needed the help so much. By the way, do you have any example programs that might speed things up? Sorry to be such a pain.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-01-26 00:19
    I have a couple of examples that cover quite a lot of different possible data formats and lengths. I don't have access to them at this moment but will post them later this evening.

    Can you tell me which Stamp you are using and which pins you have assigned to what on the logger.

    Jeff T.
  • Andrew (ARLISS)Andrew (ARLISS) Posts: 213
    edited 2008-01-26 00:27
    I am using the BOE Rev. c with the BS2 stamp. I have not assigned any pins to the logger back to the SHT11 sensor. Any suggestions are helpful though.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-01-26 01:45
    Just to clarify Andrew, the logger does not connect to the SHT11. The logger connects to the BOE and the SHT11 connects to the BOE. Both the logger and the Sensiron sensor use the Stamp on the BOE as an interface to each other. Your final program will basically have the Sensiron demo code and the logger demo code combined into one program, likewise the hardware will be connected in a similar way as to when you ran each of the demos.

    Jeff T.
  • Andrew (ARLISS)Andrew (ARLISS) Posts: 213
    edited 2008-01-26 12:15
    Jeff,
    Thanks for your time. I'll have to try that out.
    Andrew
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-01-26 16:59
    Hi Andrew, the code for the SHT11 and for the Datalogger are both complex especially for the beginner. The examples and demos provided by Parallax for their different products are excellent but usually need some modification to suit your own particular application. To modify the code means that you have to have an understanding of how it all works which takes time to learn.

    For your application where you want to bring the Sensiron and Datalogger together then you can leave the Sensiron code ·as it is. When you add the datalogger code to your Sensiron code you will need a minimum of four of the datalogger functions Initialize, Open for write, Write file and Close file. The data that you will want to write/log is all contained in the SHT11's debug instructions, take a close look at those debug instructions and pick out what you want to log.

    If you want to learn a little more about the Datalogger grab the VDAP firmware instruction set and take a look at the attached code and document. The PDL BS2 code contains the most commonly used logger functions split into subroutines. The advantage of the subroutines is that you can look at each one individually knowing what it is supposed to do and try and better understand it. The PDL code is intended to run as a datalogger demo and does not include the SHT11.

    Jeff T.

    Edit: There is a typo in the first two files which has been corrected here

    Post Edited (Unsoundcode) : 1/29/2008 3:23:35 PM GMT
  • Mark in NHMark in NH Posts: 447
    edited 2008-01-28 01:32
    Jeff,

    · Thanks for your helpful replies to Andrew. I'm his teacher. We tried the program you attached but it locks up on the first line of the program, where it says, "Remove memory and press enter." When we remove the flash drive from the USB DataLogger and press 'enter' on the computer, it cycles us back to the program.

    Our·stamp is a BS2. For what it's worth, we're running 2.0, not 2.5. Could this be part of·the problem? Thanks for your help! We look forward to more replies (and ultimately, to a solution!)

    From New Hampshire,

    Mark Kibler
    ·
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-01-28 01:54
    Hi Mark, the program contains DEBUGIN instructions for the menu which is not supported in the Pbasic Version 2.0. It would be a good thing to upgrade your software as 2.5 contains other enhancements you might want to use.

    Jeff T.
  • Mark in NHMark in NH Posts: 447
    edited 2008-01-28 02:06
    Jeff,

    · Thanks for your help! Is installing PBASIC 2.5 as simple as downloading it, then running programs in that format? Does 2.5 work with the BS2 stamp?

    Regards,

    Mark
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-01-28 02:20
    Yes Mark, downloads available at this link http://www.parallax.com/ProductInfo/Microcontrollers/BASICStampSoftware/tabid/441/Default.aspx

    Like I said earlier the Sensirion code can be left·as it is. You will have to decide what information you require to log which you should be able to get from the variables used in the Sensirions debug instructions. Instead of or as well as displaying the variables you will also·write them to the logger.·To use the logger in conjunction with the Sensirion code you will need to Initialize the logger open a file for writing , write your data then close the file on completion.

    hope this helps


    Jeff T.
  • Mark in NHMark in NH Posts: 447
    edited 2008-01-28 03:19
    Jeffm

    Is Basic Stamp Editor 2.4 the same as PBASIC 2.5? I've just dowloaded BSE 2.4...

    Mark
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-01-28 03:31
    Hi Mark,the·Editor is V 2.4 which contains the Pbasic language version 2.5. You have the latest release.

    Jeff T.·
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-01-28 17:13
    Hi Mark and Andrew, you guys have two threads covering the exact same questions. Most of the people that can help you on this forum read all the threads and it's rare for anything to get missed. As the other thread has more detail on what you want to accomplish it would be easier for everyone if you directed any further questions to that thread. Be sure to study Mike Greens attachment RocketRobotProgram that has to be so close to what you want.

    Jeff T.
  • Mark in NHMark in NH Posts: 447
    edited 2008-01-29 00:41
    Andrew,

    · It's Mr. Kibler. Jump over to my thread on this same forum if you would so we don't have two discussions going on the same topic at the same time, like Jeff T. suggested. Mike Green (and Tracy Allen) have posted some REALLY helpful information and program 'fixes' to·the thread.It's called 'Students and Teacher need help...') I think we're getting close to doenloading the data from the sensor to the USB DataLogger (though I don't quite understand all the program commands yet.) Someone suggested we contact Parallax support, but they simply sent us to this forum.

    You did an OUTSTANDING job with our video teleconference with NASA today. Keep up the excellent work; we'll get this figured out!·Stick with·it until you understand it. That's what real learning is.

    Mr.Kibler
Sign In or Register to comment.