jerabaul29 / OpenMetBuoy-v2021a

An easy to build, affordable, customizable, open source instrument for oceanographic measurements - with global Iridium coverage
MIT License
43 stars 7 forks source link

about the DS18B20 #93

Open jerabaul29 opened 8 months ago

jerabaul29 commented 8 months ago

@gauteh to summarize:

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.

https://github.com/jerabaul29/OpenMetBuoy-v2021a/blob/571732ba2c071cdbb7dc6ea796b76cfc58d61451/legacy_firmware/firmware/steval_gps_waves_shortthermistors_drifter/thermistors_manager.cpp#L125-L198

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).

gauteh commented 8 months ago

Have you ever had a broken wire?

jerabaul29 commented 8 months ago

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 :) .

gauteh commented 7 months ago

I'm considering adding this: https://www.analog.com/en/products/ds2482-100.html since getting 1-wire is more troublesome than first thought.