Cannot get Cobra II to recognise DS18B20 Onewire device

I am trying to get my Cobra II to detect a DS18B20 temp sensor but am not having much luck. What I am seeing seems to be similar to discussed in the topic listed below but my understanding is that their particular issue was resolved with the release of the current SDK package.

Can someone confirm if I have the correct firmware/software package in regards to the OneWire fix.

I am using the following:

  • Sealed waterproof DS18B20 sensors
  • Cobra II (Firmware
  • NETMF 4.2 (2013-02-14 GHI package)
  • Breakout connector.

Have wired up the sensor to the breakout board, VCC -> 5v, GND -> GND, Data -> pin5 and connecting it to Socket 6 on the mainboard.

For testing I am using the following code:

Debug.Print("Initialising OneWire Port");

// Configure onewire output port to socket 6, pin 5
GT.Socket socket = GT.Socket.GetSocket(6,true,null,null);
OutputPort port = new OutputPort(socket.CpuPins[5], false);      
OneWire ow = new OneWire(port);
ArrayList list;
while (true)
    Debug.Print("Resetting Onewire Bus");
    Debug.Print("  -  TouchReset Result: " + ow.TouchReset());
    Debug.Print("  -  Calling Find All Devices function");

    // Only have one device connected so expect result to be 1
    list = ow.FindAllDevices(); 
    Debug.Print("  -  Device Count: " + list.Count.ToString());

    Debug.Print("  -  Clearing List");

This gives me the following output:

Initialising OneWire Port

Resetting Onewire Bus

  • TouchReset Result: 1
  • Calling Find All Devices function
  • Device Count: 0
  • Clearing List

One thing to note is that the TouchResult is always 1 even if I purposely specify a socket/pin which is not connected to the sensor. What should the TouchResult be for a positive identification of a onewire device?

I have tested the sensor on a Panda II (4.1 using the GHI Onewire implementation) and that works fine.

Any thoughts?

Cheers, Keith.

pull up resistor on data? What value?

Hi Gus,

Have tried two breakout boards - one with no pull-up resistor and one with 4.7K, but have discovered that the “4.7K” resistors I bought are not 4.7K and are actually 4.7 Ohm - should have looked closer.

Also have just realised that on the Panda I was using Di2 with no physical pull-up resistor as it had internal pull-up and when I started trying to talk to it on the Cobra I initially dropped a breakout module into socket 6 in the designer and set the resister mode as below thinking it would have the same effect but had removed this.

breakout.SetupDigitalIO(GT.Socket.Pin.Five, false, GT.Interfaces.GlitchFilterMode.Off, GT.Interfaces.ResistorMode.PullUp);

After doing a bit more reading on the internal pull-up configuration, I’m not sure if this would even have had an effect. Is it possible to set internal pull-up on output ports?

I’ll try and get some 4.7K resistors tomorrow and see if that sorts it.


I don’t know if an internal pullup would be appropriate, but you could try it…

but yes your 4.7ohm will be too strong.

Internal is 100K plus…it will probably not work.