Community

One Wire Protocol

I hope 1-wire gets more support since using netduinos to monitor temperature with the DS1820 has been a great application.

1 Like

In the blog post it states:

we’ve cleaned up the Netduino SDK, published everything on Github

so there is nothing stopping anyone from improving or adding to the SDK.

Building the SDK is on the list of things for me to try… So many things on that list :slight_smile:

Regards,
Mark

Tombo, have you done any onewire + netduino projects you’d like to share with the community?

Hi @Nevyn and @bryancostanich ,

I’m looking to write code for DHT22, which also has a 1-wire protocol (although different from DS1820, which I’m also interested in seeing completed). I came across DHT22 solution for the Netduino (I believe authored by you @Nevyn ). I’m attempting to port this to Meadow, but I don’t know how to do this sort of thing with the meadow, specfically the tri-state output.

Would I need to dispose of the output after each use?
The circuit has an external pullup resistor, so open drain output type would work, but how do I disable the output driver which is being done via the “portOut.Active = false”?
Does the output driver turn off if the configuration of the resistor pull up and the output state are the same?

Thanks,
Bill

    private InterruptPort portIn;
    private TristatePort portOut;

      portIn = new InterruptPort(pin2, false, resistorMode, Port.InterruptMode.InterruptEdgeLow);
      portIn.OnInterrupt += new NativeEventHandler(portIn_OnInterrupt);
      portIn.DisableInterrupt();  // Enabled automatically in the previous call

      portOut = new TristatePort(pin1, true, false, resistorMode);

      portOut.Active = true;
      portOut.Write(false);       // Pull bus low
      Thread.Sleep(StartDelay);
      portIn.EnableInterrupt();   // Turn on the receiver
      portOut.Active = false;     // Release bus

Answering my own post from above:

After some more reading the answer and explanation can be found here:

"Another common use for open-drain outputs is having multiple external devices drive a 
single, active-low interrupt pin on a microcontroller."

Feel free to correct me, but I think the correct configuration would be.

PortOut = new DigitalOutputPort(
IDigitalInputController device,
IPin pin,
bool initialState = true,
OutputType outputType = OutputType.OpenDrain)

My Questions from previous post

Would I need to dispose of the output after each use?

NO, not necessary

The circuit has an external pullup resistor, so open drain output type would work, but how do I disable the output driver which is being done via the “portOut.Active = false”?
By not configuring the output as push-pull you are not enabling the driver

Third question doesn’t really make sense anymore.