My first time using a 1-Wire network. Project end goal includes reading multiple 1-Wire devices (quantity 4), specifically the model MAX31888 temperature sensor from Maxim Integrated (part of Analog Devices).
The sensor specifications: datasheet MAX31888.pdf
The 1-Wire network will be very small, "low radius" and "low weight", with longest wire less than 1 m and using a linear topology. My prototype is even smaller, using 150 mm jumper wires on a breadboard.
Per the MAX31888 datasheet I have a 0.1 µF capacitor for each sensor's parasitic power (C_PP) connected to pin 4 (CEXT) and pin 5 (GND), as described and depicted on pages 10-12 and 22 of the spec sheet (and my project schematic below). Makes sense to me, this small (2 mm × 2 mm) surface mount component does not have an internal capacitor like the widely used Dallas DS18B20 temperature sensor.
I am still in a trial and error process to determine how to correctly select the pull up resistance (R_PUP). The spec sheet shows a range of 300~1000 Ω, however notes 2 & 3 make it clear that the required resistance may vary based on the pull up device (controller), the network configuration, etc. Also, the table title/header states that specification values apply when the data line DQ is 1.8 V, but in my case as explained below I will be at 3.3 V (within the allowable spec range of 1.7~3.6V per the datasheet).
For comparison, the Dallas DS18B20 uses 5.0 V (spec range 3.0~5.5 V) and the resistor is 4700 Ω.
My micro-controller is an Arduino MKR1000 (the master in the 1-wire network). It operates at 3.3 V and I'm assuming that I should be able to directly use a digital pin for the data interface. While my initial project could use a pin for each 1-Wire device, longer term I'd prefer to have all devices on one pin to free up I/O for other things, so I have started with one pin only.
Wiring & connection schematic:
I'm working in Arduino IDE v1.8.19. My code is copy/paste(edit) from several of the OneWire examples (e.g. for using a Dallas DS18B20), so everything seems simple and straight forward. I have the Arduino OneWire v2.3.6 library installed. I also have the DallasTemperature v3.9.0 library installed (by Miles Burton), which is also known as the Arduino-Temperature-Control-Library (v3.9.1 is available in Github). While I included the DallasTemperature library in one of my initial sketches, I am not using it my current sketch as I systematically attempt to troubleshoot and have stripped the sketch down to the bare minimum.
My problem is that I have not yet successfully communicated with any of the sensors. I have tried just one sensor at a time (and picked different sensor samples to test), and I have tried four sensors at the same time. I am starting with the simple stuff, like a sensor search to retrieve the 64-bit ROM address of each device. A few attempts have returned an address, however it always fails a CRC-8 test. I have noted 5 unique addresses (on a given try the same address repeats, but I suspect that I am looking at gibberish data since I have seen different addresses on different attempts). Most attempts have resulted in "no more addresses".
Given my uncertainty over what resistance value to use, I have tried: 430, 750, 1180, 1500, 2250 Ω. But with no clear difference in results.
Here is my current simple sketch:
//find all sensors, for each report the ROM address and perform CRC check on the address
#include <OneWire.h>
// sketch developed based on use of OneWire library v2.3.6
// OneWire documentation at https://www.pjrc.com/teensy/td_libs_OneWire.html
OneWire sensors(3);
// create a OneWire object named "sensors" that is connected on digital pin "3"
void setup(void) {
// put setup code here, to run once:
Serial.begin(9600);
// sensors.reset(); //reset the 1-wire bus, not necessary but just in case
// delay(1000); //milliseconds to wait
}
void loop(void) {
// put main code here, to run repeatedly:
byte i;
byte addr[8];
if ( !sensors.search(addr)) {
Serial.println(" No more addresses.");
sensors.reset_search();
delay(500);
return;
}
Serial.print("ROM address=");
for ( i = 0; i < 8; i++) {
Serial.print(addr[i], HEX);
Serial.print(" ");
}
if ( OneWire::crc8( addr, 7) != addr[7]) {
Serial.println("CRC is not valid!");
return;
}
}
I have checked and double checked wiring and connections (completely re-started once). I have continuity in wires. I have 3.28 V from the Arduino.
I have no means to check whether or not the surface mount solder connections are okay or not. I had a company called Proto Advantage solder each of the ICs onto an adapter board so that I can plug and unplug each temperature sensor.
Any ideas on what I should check next?
I also tried to use the "oneWireSearch.ino" that comes in the examples with the DallasTemperature library. It tries all digital pins and searches for any 1-Wire devices and returns the addresses. Not sure why, but I could never get that sketch to print to the serial monitor (even after revising baud rate to be the same in the sketch and the monitor, and after trying other baud rates). Perhaps that points to some root cause in my setup. Or perhaps it is just another rabbit hole.