-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Dear @cybergibbons,
1st of all many thanks for providing this repo public.
My problem is that the device Address from DS18B20 is wrong and because of this no device is found by DallasTemperatur Library
Why do I know this? Because of my HW setup One SPI, two DS2482 with one DS18B20 each:
ESP32 <-I2C-> DS2482[0] <-OneWire-> DS18B20[0]
ESP32 <-I2C-> DS2482[1] <-OneWire-> DS18B20[1]
If I change the DS18B20 the addresses are correct
Good:
{ 0x28, 0x86, 0xD3, 0x77, 0x91, 0x16, 0x02, 0x01 }
{ 0x28, 0x28, 0xD1, 0x79, 0x97, 0x14, 0x03, 0xC6 }
Bad:
{ 0x28, 0x86, 0xD3, 0x77, 0x91, 0x16, 0x02, 0x01 }
{ 0x8C, 0xD1, 0x08, 0x03, 0x9A, 0x00, 0xA5, 0x9D }
Honestly many hours I lost here. I would be really great if you could help me out here.
Thanks in advance,
Here is my test code:
#include <Wire.h>
#include <OneWire.h>
OneWire oneWires[2] = {0x18, 0x1B};
void printAddress(uint8_t deviceAddress[8])
{
Serial.print("{ ");
for (uint8_t i = 0; i < 8; i++)
{
// zero pad the address if necessary
Serial.print("0x");
if (deviceAddress[i] < 16) Serial.print("0");
Serial.print(deviceAddress[i], HEX);
if (i<7) Serial.print(", ");
}
Serial.print(" }");
}
void setup()
{
Serial.begin(SERIAL_SPEED);
}
void loop()
{
Serial.println("Checking for I2C devices...:");
for(int i = 0; i < NUM_OF_DS2482; i++)
{
if (oneWires[i].checkPresence())
{
Serial.println("DS2482-100 present");
oneWires[i].deviceReset();
Serial.println("\tChecking for 1-Wire devices...");
if (oneWires[i].wireReset())
{
Serial.println("\tDevices present on 1-Wire bus");
uint8_t currAddress[8];
Serial.println("\t\tSearching 1-Wire bus...");
while (oneWires[i].wireSearch(currAddress))
{
Serial.print("\t\t\tFound device: ");
printAddress(currAddress);
Serial.println();
}
oneWires[i].wireResetSearch();
}
else
Serial.println("No devices on 1-Wire bus");
}
else
Serial.println("No DS2482-100 present");
delay(5000);
}
}