jmromeo / d6t

Node module to access D6T Thermal Sensors.
MIT License
1 stars 3 forks source link

Bogus data from D6T-44L-06 #2

Closed mKeRix closed 6 years ago

mKeRix commented 6 years ago

Hey there,

hopefully I'm not annoying you too much yet! A part of my testing efforts I also received a D6T-44L-06 sensor and set it up on my Raspberry Pi. I ran the unmodified version of your example script, unfortunately this time around I'm receiving output like this:

Thermal Sensor Temperature: 6553.5
1: 6553.5
2: 6553.5
3: 6553.5
4: 6553.5
5: 6553.5
6: 6553.5
7: 6553.5
8: 6553.5
9: 6553.5
10: 6553.5
11: 6553.5
12: 3276.7
13: 3263.9
14: 3263.9
15: 3263.9
16: 3263.9
pec: 0x7f
Thermal Sensor Temperature: 6553.5
1: 6553.5
2: 6553.5
3: 6553.5
4: 6553.5
5: 6553.5
6: 6553.5
7: 6553.5
8: 6553.5
9: 6553.5
10: 6553.5
11: 6553.5
12: 6553.5
13: 6553.5
14: 6553.5
15: 6553.5
16: 6553.5
pec: 0xff

Do you have any idea what the issue could be?

jmromeo commented 6 years ago

Hey,

My original attempt for this sensor was on a Raspberry Pi. I believe the Omron sensors requires a repeated start (it shows it in their app note, and I was unable to get it working without the repeated start) to properly read the data. After a bit of digging through forums and datasheets, I found that the raspberry pi i2c hardware does not support repeated starts.

Here is a link to one of the forums: https://www.raspberrypi.org/forums/viewtopic.php?t=15840

After struggling for a few days with the Raspberry Pi, I picked up a beaglebone I had laying around, and the same code worked. I looked through a protocol analyzer, and the only difference between the 2 was the repeated start, so it seems like the raspberry pi just isn't the right hardware for interfacing with this device. 2 possibilities I see for getting this working on the RPI:

  1. Bitbang i2c
  2. Read sensor data from MCU like Arduino and pass that data along to the RPI over Serial, SPI, I2C, etc.
mKeRix commented 6 years ago

After toying around with getting the repeated start condition working on RPi I ended up buying a BeagleBone Green Wireless as per your tip. It works perfectly on there, without any modifications required for the sensor! Thank you so much for work you've put into this, you really helped me out a lot. Finally I can start getting these integrated into my home automation. :)

I will test out the code for the D6T-8L-09 on the BeagleBone soon as well and report back!

mKeRix commented 5 years ago

Should anyone stumble upon this issue in the future, I actually found a way to make the d6t sensors work with the Raspberry Pi. I used the i2c-bus library from npm for this. You can find my code as reference here: https://github.com/mKeRix/room-assistant/blob/thesis/services/d6t.service.js

The code in that branch is experimental, so excuse the mess. Generally this seems to be quite reliable, however I do get some wrong data sometimes. To counter this the PEC check should be implemented as well. I based my code on the D6T whitepaper.