Code ideas for reading two 20818 Sensirion SHT11 sensors?
I am trying to make a simple circuit to read two of Parallax's 20818 SHT11, but keep running into all sorts of problems. I am looking for any ideas for running the sample program from Parallax to two separate sensors. (one indoor at the board and one outdoor on a 30 foot long phone cord)I tried to convert the data and clock to a variable and just run the main program twice with a for-next loop. I couldn't get things to work right after working on it for a few hours. I tried to go back to it today only to find out I cannot find my USB memory stick where my code was. ![cry.gif](http://forums.parallax.com/images/smilies/cry.gif)
Anybody have any ideas before I start over at square one?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
~~ dRu ~~
![cry.gif](http://forums.parallax.com/images/smilies/cry.gif)
Anybody have any ideas before I start over at square one?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
~~ dRu ~~
Comments
I would start by using the sample programs provided by Parallax on their web site, and work from there. Here are some additional application notes provided by Dr. Tracy Allen on his web site: http://www.emesystems.com/OL2sht1x.htm
I hope that gets you going again.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There is no pleasure in having nothing to do;
the fun is in having lots to do, and not doing it!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
~~ dRu ~~
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
1, Uses 14 I/O pins)
Connect all devices to same IO for SCK/DATA and to GND. Use individual I/O pins to power (VDD) each device, one at a time. BS2P40 can source 30mA, SHT11 needs 0.55mA for a reading. Unsure about this as a trustworthy option even though all specs say it should.
2, Uses 13 pins)
Connect all devices to same IO for DATA and to VDD/GND. Use individual I/O pins to clock (SCK) each device, one at a time.
3, Uses 3 I/O pins)
Use an I2C addressable switch (IE: Analog ADG715, but less channels)? The SHT11 clock can sit on an I2C bus without interfering, so I can use the I2C switch to power on the SHT11, use the SHT11 protocol to do the reading, then use I2C to turn off the SHT11. The SHT11 still needs its own data line.
4, Uses 6 pins)
Use multiplexers, 74AC251, etc., and just control which device is clocked. 4 I/O for the addressing of 12 sensors.
5) Play around with the "reserved" bits of the status register or the NoConnect pins to see if addressability exists on the devices already even though it's listed as a future concept. Unlikely...
6, uses 2 I/O pins)
Add a small MCU at the sensor end to communicate with the SHT11 and BS2P40. Use I2C, SPI, or ? and program the sensor MCU with an address. Use an ATTiny, PSoC, PIC16, or other very inexpensive MCU (~$1) This MCU could also be setup to just send the readings as a text string (IE: 085046 = 85F, 46% ??)
on a side note with multiplexing, I think I only need to separate them for the reading. I should be able to "broadcast" a "take a reading" command to all devices at the same time since they store the reading and wait in idle mode for the read request. That should work, but I need to doublecheck the effect of ignoring ACKs. (?)
ps. see my code for two sensors here: http://forums.parallax.com/showthread.php?p=690671
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
IT / Web / PCB / Audio