OpenMetBuoy-v2021a
OpenMetBuoy-v2021a copied to clipboard
about the DS18B20
@gauteh to summarize:
-
I think the DS18B20 coated in epoxy are better / more robust, I have heard the ones with a metallic casing always end up rusting / leaking
-
the DS18B20 code: https://github.com/jerabaul29/OpenMetBuoy-v2021a/blob/main/legacy_firmware/firmware/steval_gps_waves_shortthermistors_drifter/thermistors_manager.h + https://github.com/jerabaul29/OpenMetBuoy-v2021a/blob/main/legacy_firmware/firmware/steval_gps_waves_shortthermistors_drifter/thermistors_manager.cpp
-
the AGT pins I am using:
- AGT GND <-> DS18B20 black wire
- AGT D4 <-> 47 Ohm <-> DS18B20 red wire ; this is just a normal digital IO pin to switch on (HIGH) / off (LOW)
- AGT AD35 <-> 47 Ohm <-> DS18B20 white wire; this is just a normal digital IO pin for communication
- pullup 4.7 kOhm between AGT red <-> AGT white
you can see this in code at:
https://github.com/jerabaul29/OpenMetBuoy-v2021a/blob/571732ba2c071cdbb7dc6ea796b76cfc58d61451/legacy_firmware/firmware/steval_gps_waves_shortthermistors_drifter/board_control.h#L32-L36
(note I now use 47 Ohm, but was using around 100 before, this is quite robust)
The 47 Ohm resistors are just here to protect the AGT and the rest of the OMB in case some DS18B20 or its cable gets damaged / leakage / cable cut, so that there is no "hard" short circuit, the 47 Ohm will hopefully be enough to limit the currents to something ok.
-
the DS18B20 are daisy chainable
-
the way the code logics works:
- at the start of a measuring period, get the array of 64 bit unique factory IDs of all sensors answering on the OneWire bus; also generate in the OMB case the "reduced ID" with the 6 LSBs, to be able to save on the packet specification time, but this is an "OMB curiosity" to save bytes over iridium SBD
https://github.com/jerabaul29/OpenMetBuoy-v2021a/blob/571732ba2c071cdbb7dc6ea796b76cfc58d61451/legacy_firmware/firmware/steval_gps_waves_shortthermistors_drifter/thermistors_manager.cpp#L125-L198
- then for each measurement:
- ask all sensors discovered to start conversion
https://github.com/jerabaul29/OpenMetBuoy-v2021a/blob/571732ba2c071cdbb7dc6ea796b76cfc58d61451/legacy_firmware/firmware/steval_gps_waves_shortthermistors_drifter/thermistors_manager.cpp#L200-L220
- wait until 1s has happened since the start of the first conversion
- collect all the result conversions
https://github.com/jerabaul29/OpenMetBuoy-v2021a/blob/571732ba2c071cdbb7dc6ea796b76cfc58d61451/legacy_firmware/firmware/steval_gps_waves_shortthermistors_drifter/thermistors_manager.cpp#L222-L300
In addition I have some bookkeeping, pushing stuff to arrays, averaging, etc, but a lot of it is OMB specific / to fit within iridium SBD budgets.
Let me know if you have any questions :) .
A note: I needed to use a slightly tuned OneWire library (just in case you need to wrap the one I am using), because I had otherwise some issues with some timings that were too slow (all of this is a bit had hoc, I think the protocol has some expectations about some waiting times etc):
https://github.com/jerabaul29/OneWire/tree/feat/Artemis_compatible
(see the last 3 commits that were doing some tuning; may be "artemis core kind specific", and likely you will not have the issue in Rust: https://github.com/jerabaul29/OneWire/commits/feat/Artemis_compatible/ . For more information, see https://github.com/paulvha/apollo3/tree/master/OneWire_on_uart and specifically https://github.com/paulvha/apollo3/blob/master/OneWire_on_uart/1-wire_uart.odt for explanations if hitting timing issues).
Have you ever had a broken wire?
No, never yet, but so far all my uses have been for testing and in the lab, the 35 instruments to come now will be the first large scale field deployment :) .
I'm considering adding this: https://www.analog.com/en/products/ds2482-100.html since getting 1-wire is more troublesome than first thought.