Is I2C & 2 wire communication for sensirion temperature/humidity sensor
Cree
Posts: 132
I was looking around the internet and found out that 2 wire is the same as I2C, but I2C is a trade mark from Philips.
as mentioned in this forum link from AVR Freaks (correct me if i'm wrong)
So with a PCF8574P IO expander , I'm going to hook up 2 of the sensors mentioned above. Ill add more later if it works.
I'm using the basic stamp sx micro-controller module.
I found this on parallax from the nuts & volts I2C example
If the are other examples can you direct me to them? or have any recommendations?
as mentioned in this forum link from AVR Freaks (correct me if i'm wrong)
So with a PCF8574P IO expander , I'm going to hook up 2 of the sensors mentioned above. Ill add more later if it works.
I'm using the basic stamp sx micro-controller module.
I found this on parallax from the nuts & volts I2C example
If the are other examples can you direct me to them? or have any recommendations?
Comments
For the first point, you could probably still use the sensiron sensor in an unmodified I2C setup. You'd just have to pretend that it was 6x as many devices (one for each command).
The second point is more of a problem. I2C assumes that each 8 bits comes with an ACK/NACK from the receiver. From page 7 of the datasheet, you can see that it transmits up to 16 bits without an ACK/NACK. I think this could be a problem in some hardware based I2C drivers.
Of course, the best thing you could do would be to test and see what happens. Electrically, the signals are compatible so it should be safe for the chips.
Edit: I should have been more careful: I see the ACK/NACK now. Yes, I think you can use it on an I2C bus. You'll have to do some experimentation to get command sequence working, and you'll have to make sure that you don't accidentally reset the device with the RESET command, but it looks like it (more or less) compatible.
I2C does not use address pins. All I2C has is CLK and DATA.
(error: no ACK from PCF85754)
This is just one PCF8574P conected to see if it would work properly.
It has a 2 wire serial communication. is it possible to send and receive data through the pcf8574p?
2.2
Serial Interface (Bidirectional 2-wire) 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.
I don't know where you're getting that from. This is what I see in the datasheet:
You'll need to make sure that what you send (from your microcontroller) falls within the specs given in the datasheet. If you use an I2C object/command, then you'll need to study up on the I2C protocol so you can figure out how to hack it to fit into the protocol required by the Sensiron sensor. I don't know if what you're using is amenable to that. At the very least you could bitbang the two signals (CLK and DATA) and have a slow but functional interface.
I am trying to use multiple sensirion temp/humidity sensors (2 wire serial communication). But my issue is that they do no have addresses and is not I2C. I have gotten a single to work and now i am trying to use multiple. I'm sure if I had multiple sensors in an I2c set up I would be able to get data from them, but I wouldn't be able to tell which one is which.
Another way I've used 8 on one Stamp: each has its own data pin, the clock line is shared, so 9 pins for 8 sensirions.
Sensirion also offers the SHT21 with true i2c, but it has only one address possibility, no solution to your problem.
Ya had looked at the SHT21, the only solution to my problem would be to get a temp sensor with addresses.
I figured a way arround it to use switches, but that would end up having more wires, which is not what I wanted.
The SHT21 has both temperature and humidity in the same device: http://www.sensirion.com/en/products/humidity-temperature/humidity-sensor-sht21/
That is not the issue, its that I need to use multiple sensors and that they do not have addresses to tell which sensor is which.
If these sensors had addresses it would solve my problem.
My issue is that I am getting an error that symbol is already defined and my first if function is highlighted.
this what I have in a subroutine:
I learned to make a counter in C, but it seems to have to be done differently in basic stamp.
Please look at the description of the PIN directive. This declares the name starting in column 1 as an I/O pin and you're re-defining "clock" over and over again. What are you trying to do with that?
It was supposed to be a total of four lines; 1 voltage, 1 GND, 1 Data and 1 CLK.
But because the Sht 11 is both temperature, humidity and has a heater in the sensor, it would be a full package in terms of a sensor.
Currently I'm trying to send the clock to different sensors every time I press a button. I am doing this because the sht11 temperature/ humidity sensor is 2 wire serial comm and does not have any address pins. I have 6 of theses sensors, the original plan was to have only two wires for data and the clock, but without address pins or I2C communication I was forced to change the design to having one data lines and one clock line per sensor. That makes 6 clock lines.
Sry I forgot to check "what is a micro controller?". I'm going to look for examples.
The product page in Parallax's webstore for the SHT11 has links to the documentation and sample code and links to Nuts & Volts Column #91 which discusses the SHT11
Note that the HIGH and LOW statements, also used in the Nuts & Volts examples, allow the use of a variable for the pin number.
Thx for the links, I already have a set up for one Sht11 with LCD working displaying temperature and humidity. The current set up I am working on is with multiple sensors is basically what you explained in the first sentence. I am currently working on the subroutine for selecting which which sensor I want, which is the push button thing i am working on now.
I have looked
I have tried a few ways, was not able to get it to work.
How do I ensure it only counts every time the pin goes on/off (to count every push)? Because with the code below it will keep counting until 255 (a byte) until i release the button.
The counter variable here is called clk, and in another subroutine to read the SHT sensor, that would specify the pin to use for the clock.
Thx, I would have never thought of doing it like this. I'm going to look at it more closely to understand it.
This version uses program modes; the program code itself waits for the state of the switch to change. The previous program uses bit variables to store the states of the switch. I generally prefer the state variable approach over the modal approach, especially when a developing program has several tasks that will need to be executed quasi-simultaneously.
ok, thx for the suggestion.