Pages: [1]   Go Down
Author Topic: SHT15 ACK error  (Read 1333 times)
0 Members and 1 Guest are viewing this topic.
Earth
Offline Offline
Newbie
*
Karma: 0
Posts: 5
This sentence would have been wittier had it been mathphreak's idea.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to get the temperature from an SHT15 sensor using the sample code at http://wiring.org.co/learning/basics/humiditytemperaturesht15.html (at least I think that's where it came from; I'm collaborating with someone else on this project).  I know the SHT15 is wired correctly, but I'm getting Ack Error 2, which I think signifies that the acknowledgement from the SHT15 was never received.  The temperature that my Arduino is dumping to serial is 0xFFFFFFD8.  I calculated the raw value the SHT15 is returning as 0x8E38E3AF (thanks to Wolfram|Alpha).  I've tried extending the wait period in waitForResultSHT(), but that doesn't seem to help.  Can anybody help this noob?

I sense that full code would be helpful.  Here it is.
Logged

Anybody with a signature is a liar.

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 553
Posts: 46297
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I use this library. Works great for my application.
https://github.com/practicalarduino/SHT1x
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@PaulS I cloned that library and opened up the example but found that my readings were consistently failing, same as @mathphreak, but without it reporting ACK errors.

I posted an issue, but thought that I would reach out in additional places.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12487
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How long are the cables between Arduino and the SHT15?

A quick look at the code triggert the following question:
think some int's should be unsigned int or ..

Code:
int getData16SHT(int dataPin, int clockPin) {
  int val;

  // Get the most significant bits
  pinMode(dataPin, INPUT);
  pinMode(clockPin, OUTPUT);
  val = shiftIn(dataPin, clockPin, 8);
  val *= 256;   << if val = 0xFF there will be a signed overflow!
....

==>

Code:
unsigned int getData16SHT(int dataPin, int clockPin) {
unsigned int val = 0;

  // Get the most significant bits
  pinMode(dataPin, INPUT);
  pinMode(clockPin, OUTPUT);
  val = shiftIn(dataPin, clockPin, 8);
  val *= 256;
....
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: [1]   Go Up
Jump to: