Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Innovator
1,258 Views

Multiple DS18B20 sensors with Intel Edison

Has anyone successfully used multiple DS18B20 temperature sensors with the Intel Edison? In my setup, single sensor works fine, but with 2 or more sensors, I'm seeing a strange issue, detailed below:

I'm using Intel Edison with latest firmware, and the Intel XDK for a Node.js project on the board. I'm using the upm module "jsupm_ds18b20" to communicate with the sensors, with mraa v1.5.1 and upm v1.0.1 installed. It works fine for a single sensor. But once I add a second sensor, it detects both, but is unable to read temperature from either sensor. i.e, the "ds18b20.devicesFound()" method returns "2", and I can read the ID's using "ds18b20.getId(0)" and "ds18b20.getId(1)". However, trying to update temperature readings using "ds18b20.update()" results in the following errors:

ERROR: readSingleTemp: crc check failed for device 0, returning previously measured temperature

ERROR: readSingleTemp: crc check failed for device 1, returning previously measured temperature

Connections are as detailed in : http://iotdk.intel.com/docs/master/upm/node/classes/ds18b20.html http://iotdk.intel.com/docs/master/upm/node/classes/ds18b20.html . "Data" pin of second sensor is connected directly to the data pin of the first. We're using only a single 1n4148 diode on the Tx line, which is common to both sensors, if that matters (though we tried it with separate circuits for each individual sensor too).

What am I missing here?

0 Kudos
3 Replies
Highlighted
Community Manager
7 Views

Hi Benjamin Abraham,

 

 

Thank you for contacting us.

 

 

Well, that's weird. Did you check the example in the UPM repository? https://github.com/intel-iot-devkit/upm/blob/master/examples/javascript/ds18b20.js

 

 

I recommend you to try to adapt two sensors in the example, if you are getting issues with the function ds18b20.update(), try to use it for each sensor (0 and 1) or try to use -1 for all the devices according to the document that you shared: http://iotdk.intel.com/docs/master/upm/node/classes/ds18b20.html

 

 

I hope you find this information useful.

 

 

Regards,

 

-Leonardo
0 Kudos
Highlighted
Innovator
7 Views

It *is* weird!

I started from the GitHub example. The code is quite straightforward...

I tried everything else you suggested, except running the original example code, and that was because I already tried running the basic commands and functions from the node shell directly on the Edison, with no other code running. Saw the same situation there. Works perfectly fine with one sensor, doesn't work with two sensors. Do you think I should still try running the example code?

Individual "update()" calls for each sensor, will return an individual crc error for each sensor..

The confusing part is that "devicesFound()" detects 2 devices connected, and "getId(0)" and "getId(1)" return the ID's of both sensors with no errors, albeit in a weird format...

Could this be a bug in the library/module?

0 Kudos
Highlighted
Community Manager
7 Views

Hi Benjamin Abraham,

 

 

It could be a bug, but I'm not sure. I don't have the sensor to test it, but you can try to contact the author of the code (top of the code), maybe he can help you more.

 

 

Personally, I recommend you to run the example first for the uart 0, then uart 1, and then using both. Remember that you have to instantiate and initialize them.

 

 

Have a nice day.

 

 

Regards,

 

-Leonardo
0 Kudos