HI everybody,
i have a little problem using the OneWire Libary from Maxim / Analog.
Iam using a I2c <-> OneWire Bridge ic because the combination of OneWire and Stm32 made me some unexpacted trouble in my first try.
Iam using this Libary from Maxim GitHub - adi-archives/OneWire: 1-Wire® library for Arduino.
Communication and so on is working so far everything is working well.
Sensor ID`s and temprature readout of the DS18B20 are also working.
Now my problem, somehow my brain is not understanding the libary...
I would like to enumerate the Sensors like Ds18B20[1...n] based one the specific ID and dump the temp for the specific sensor.
Like "Temp1 = Ds18B20[1]."
But right now i have no clue how to do it.
Please always use the newest Arduino IDE, the newest build environments and the newest libraries.
You found a library that I didn't even know existed. It is 7 years old and no long maintained. I only know how to use the ID from the DS18B20 with the normal OneWire library: multiple temp sensors ds18b20 - #6 by Koepel
The normal OneWire library is in the Library Manager. If you want to try that, then you first have to remove the old one.
Where did you buy the DS18B20 ? If you bought it on Ebay/Amazon/AliExpress, then they are counterfeit. Those will not work well with 3.3V or with high and low temperatures or with longer cables.
Which problem are you trying to solve with the I2C <-> 1-Wire bridge ? There might be a better way for your project.
Can you give a link to the module with the bridge that you use ?
This libary is a little bit special because it has the i2c stuff for the ds2484 implemented.
The "regular" dallas libary commuinicates with the the sensors via a digital pin direct, but because i use a onewire master IC witch is doing the whole onewire stuff.
The Sensors are genuine ones from Farnell or Mouser. So everythings fine with them.
Iam using a stm32L4, yeah and thats where the trouble with onewire begins. I havent figured out whats the origin of the Issue is. It seems that its connected with the TIM timers. After startup if i disconnet the sensor and reconnect it works. But from time to time it stops dumping data. Reconnect helps. The easiest way was to using the Bridge ic.
The example in the first post ist working fine without any issues. But in my sketch i need the tempratur of a specific sensor. And somehow i have no clue how to handle it right now....
Can you give a broader view of your project ?
When someone asks a specific question on this forum, then we like to know more about the project. Sometimes there is a XY problem: https://xyproblem.info/
Start with the temperature. For example: Measuring the temperature of 12 bee hives at 2km altitude and the bee hives are ordered in a matrix of 3x4 with 3 meters distance, but one bee hive is at 2 meters.
I think that I'm slowly getting it:
There is no 1-Wire bus connected to your STM32 board.
I have a CAN-bus network with round about 20 nodes, some nodes are for gathering data (e.g. pressure temprature, flow etc.) some nodes control things (valves, relays, pumps etc.). And a few boards do both things. This board is one of them and it is doing booth things.
Every IC is on the PCB and everything is working as expected, also the DS2484.
The libary is doing what it should, my problem is to understand propper how the temprature dump is working because there is no example. The Code what i posted in the first post is a modificated one to read the DS18B20 sensors an that works great.
But i have to implement it into the whole programm.
There are libraries that turn off interrupts to make a timing specific pulse train: OneWire, Neopixel, DHT and other libraries. The tutorials and Youtube videos often show just one thing, and almost never a combination of things. Regardless if you can make the hardware work, you should stay away from a library that turns off the interrupts.
You could add an Arduino board to run the normal/common OneWire and that Arduino board can sent via Serial all the data to the STM32.
I'm going to take a deep dive in that Dallas/outdated OneWire now ... Okay, there are two options:
Option 1: You can use the OWFirst() and the OWNext() and request all the temperatures and sort them yourself. Find the ID in a list and put the right temperature in the right place.
Option 2: Use the ID.
OWverify() checks if that ID is on the bus.
OWMatchRom() to select a DS18B20 by its ID and turns on the "Overdrive" mode. That is a faster mode and only for short distances.
OWOverdriveMatchRom() selects a DS18B20 by its ID while in Overdrive mode.
The are no examples for the "MatchRom" functions, and I assume that you don't want the "Overdrive" mode.
That is all too vague, don't use it.
Can you make it work with Option 1 ?