EnviroDIY / Arduino-SDI-12

An Arduino library for SDI-12 communication with a wide variety of environmental sensors. This library provides a general software solution, without requiring any additional hardware.
https://github.com/EnviroDIY/Arduino-SDI-12/wiki
BSD 3-Clause "New" or "Revised" License
159 stars 100 forks source link

Make some changes for slave side use #13

Closed jrzondagh closed 7 years ago

jrzondagh commented 8 years ago

Hi there,

I'm keen to make a few small changes to the lib to allow for slave side use.

E.g. slaves should not pull the line high for 12ms before sending command, but they should wait the min of 8.3ms before replying

Would you be able to make the changes, or shall I attempt it?

Regards, Justin

Kevin-M-Smith commented 8 years ago

Hi @jrzondagh - Great to hear from you!

I see your sensor-side SDI-12 repository and would be interested in contributing to it.

I think that this repository should only implement SDI-12 data logging functionality and keep all the sensor-side functionality in your repository.

Eventually we could change the name of this repository to help users distinguish between the two.

What do you think?

jrzondagh commented 8 years ago

Yeah sure, I figured that we can quite easily add the slave logic into your lib. You can see it in the fork I created.

I see the current lib being "Layer 2" and then the sketches I'm busy with as Layer 3/4/5 which interprets the protocol itself.

Essentially I just did the following to your lib:

Still busy testing, will keep you posted and perhaps we can merge back and keep it backwards compatible.

dwasielewski commented 7 years ago

I wish I had seen this conversation months ago! I have been working on the same thing independently. My solution was slightly different. It is backward compatible as I did not modify anything, only added two functions:

I've also created a generalized example sketch of how to implement an SDI-12 slave device. The modified lib and the example are publicly available in my fork off of this repository.

jrzondagh commented 7 years ago

Great news. I actually ended up doing a big refactor of the lib to no longer use interrupts. Going to fork it and share back soon

Kevin-M-Smith commented 7 years ago

Exciting stuff! Can't wait to see it. Doing it without interrupts may mean we can support ARM processors (e.g. Arduino Due).

On Aug 9, 2016, at 11:25 AM, Justin Zondagh notifications@github.com wrote:

Great news. I actually ended up doing a big refactor of the lib to no longer use interrupts. Going to fork it and share back soon

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

dwasielewski commented 7 years ago

Wow! That sounds like a massive change; I'm curious to see how you implemented it. I suppose that would also resolve the SoftwareSerial incompatibility issue.

jrzondagh commented 7 years ago

Yeah. I'm using it on an Atmel SAMD21 / ARM Cortex M0 chip with great success. Will share in the next week or so.

Kevin-M-Smith commented 7 years ago

Hey @jrzondagh, how is this coming along? Any outstanding tasks we might be able to help with?

ChrisInSingapore commented 7 years ago

Coincidentally this has come at the perfect time for an arduino Zero project. I'm following and able to do a bunch of testing on M0 with a bunch of SDI-12 sensors if you need any of this done

adnanoner commented 7 years ago

@jrzondagh Hi Justin, how is this coming along? Is there anything I could help with?

SRGDamia1 commented 7 years ago

I'm going to close this issue because the slave-side (d25b299db8fc781548dfc15d1143d678afd5ea2d) and M0 support (#33) have both been added.

The library is still interrupt based, and @jrzondagh if you have a solution for that I would LOVE to see it, but I'll leave that discussion to continue on #8 which is all about that.