How Can I Understand and Use Serial Clock for Humidity Sensor Communication?

  • Thread starter Thread starter georgeh
  • Start date Start date
AI Thread Summary
Understanding the serial clock (SCK) for humidity sensor communication involves recognizing that the sensor uses a proprietary two-wire interface, distinct from I2C. The process requires controlling the SCK and data lines (SDA) through a microcontroller, which sends and receives signals according to the sensor's specifications. Users can find relevant documentation, including a simplified guide on I2C, to clarify the operation of serial communication. For practical implementation, connecting the sensor to a PC via a data acquisition (DAQ) card and programming in LabVIEW is suggested, with specific examples provided for coding. Overall, familiarity with digital logic and the sensor's datasheet is crucial for successful communication.
georgeh
Messages
67
Reaction score
0
http://www.sensiron.com/images/getFile?id=25
I am reading the following datasheet for a humidity sensor. But what I don't understand is how to "lower the data line while SCK is high, then following a low pulse on SCK and raising DATA again while SCK is still high"
SCK=serial CLock
where can i read how a serial clock works?
I am suppose to write a program for it, but i haven't taken any EE classes yet. :\
any help is appreciated.
 
Last edited by a moderator:
Engineering news on Phys.org
What you're describing is a two-wire interface called "I2C", or Inter-IC Communication. It's a standard, and was developed by Philips. The specification is not long, and is available on Philips' website. The following document is a little shorter than the spec, and will also answer any questions you might have:

http://www.mcc-us.com/i2cHowToUseIt1995.pdf

I can also answer any specific questions you might have about the interface.

- Warren
 
I should add that your assignment sounds like it might be fairly simple: the interface consists of two wires, one called SCK (serial clock) and one called SDA (serial data). To "lower" a wire is to drive it to a voltage near zero. A wire that is "high" is carrying a greater voltage, usually 2.5V, 3.3V, or 5V.

- Warren
 
in page2 of the humidity sensor pdf it states on the bottom:
The serial interface of the SHTxx is optimized for sensor readout and power consumption and is not compatible with I2C interfaces, see FAQ for details.
 
Okay, so it's not I2C, it's something else. It does, however, sound similar. "Lowering SDA while SCK remains high," in fact, is how one starts a transaction on an I2C bus.

I'm still not sure exactly what sort of help you need. Can you clarify?

- Warren
 
Well, the lower of the sck stuff. Is this done physically? meaning, via a breadboard or some electronics? If so, where can i read on this? I apologize for not being clear.
 
You connect two integrated circuits together. Perhaps your sensor will be read by a microcontroller (a small standalone processor). The microcontroller will have output drivers that can drive the SCK wire either high or low, at the request of a program. You write your program to control those output drivers in the proper fashion.

- Warren
 
georgeh said:
I am suppose to write a program for it, but i haven't taken any EE classes yet. .
What language are you writing in, and for what target processor? Are you writing for a particular microcontroller?

From the specs, it looks like you will need to bit-bang two lines with your uC. Your uC code needs to take care of driving the two IO lines to create the waveforms for SCK and DATA, and also take care of tri-stating the DATA line when you are supposed to be reading data back in from the transducer. Your program writes data to the IO port where you've mapped SCK and DATA, in order to make the waveforms shown in Figure 5 of the datasheet.
 
berkeman said:
What language are you writing in, and for what target processor? Are you writing for a particular microcontroller?
From the specs, it looks like you will need to bit-bang two lines with your uC. Your uC code needs to take care of driving the two IO lines to create the waveforms for SCK and DATA, and also take care of tri-stating the DATA line when you are supposed to be reading data back in from the transducer. Your program writes data to the IO port where you've mapped SCK and DATA, in order to make the waveforms shown in Figure 5 of the datasheet.
I plan on testing the humidity sensor using labview code. Platform? regular pc to test it out.
 
  • #10
georgeh,

But you haven't specified how you're going to connect your sensor to your PC. That seems to be the critical piece of the puzzle you're missing.

- Warren
 
  • #11
chroot said:
georgeh,

But you haven't specified how you're going to connect your sensor to your PC. That seems to be the critical piece of the puzzle you're missing.

- Warren
Agreed. Are you going to use a DIO card? Which one? What language are you going to be writing the code in? Labview CVI? I'm pretty sure that you will need to overlay an input with an output to get your bidir DATA signal, and I'm not even sure that you can tri-state a DIO output easily on the fly...
 
  • #12
If I were doing it, I'd use a Cypress EZ-USB microcontroller to connect it via USB to my PC. But that's just me.

- Warren
 
  • #13
For the purposes of this low-speed project, however, you could also use your PC's parallel port, or perhaps, with some clever coding, one of its serial ports.

- Warren
 
  • #14
Allright, so I got the details now. i am using a Ni-DAQ 6033-E card on a pc
hooked up to a connector block. I plan on using labview 8.0 and g code to make to test the sensor out.
 
  • #15
I sure hope you didn't pay for that NI card yourself! I have little experience with LabView though, so I cannot help you with your program. I can help you with the digital logic, however, if you need more help.

- Warren
 
  • #16
I wrote some LabView 8 code to communicate with the SHT15 with an NI USB-6008 DAQ device. I use the digital I/O lines. One line as SCK, two lines for DATA (one for writing, one for reading, both connected to the DATA line of SHTxx)
I used the sample code for microcontroller written in C (found on the website of Sensirion) to write the LabView driver. In the llb-file is a main.vi and main2.vi as a sample program.
The in the SubVi "DAQ_initialize.vi" you must change the "lines" to the lines you use in your DAQ-card (in the block diagram).
You need DAQmx from NI for your DAQ-card, but i think you use it already.
The maximum read-out rate with my DAQ-device is about every 660ms.
I hope i can help you.

*****RENAME the SHTxx_driver.m to SHTxx_driver.rar*******

Tessar :smile:
 

Attachments

Last edited:
Back
Top