Git Product home page Git Product logo

Comments (12)

avaranovich avatar avaranovich commented on August 18, 2024

I am having a similar issue:

Exception thrown: 'System.IO.FileNotFoundException' in Rinsen.IoT.OneWire.dll
WinRT information: Slave address was not acknowledged.

Even though this line succeeds

 _ds2482_100 = new DS2482_100(new I2cDeviceLocator().GetI2cDevice(address).Result);

so it finds the controller, but fails to communicate with the sensor.

fails on this line

_i2cDevice.Write(new byte[] { FunctionCommand.ONEWIRE_RESET });

The connection is pretty straitforward

from onewire.

Rinsen avatar Rinsen commented on August 18, 2024

Where do you have the DS2482-100 I2C to OneWire bridge in that connection?

It is required for this library to work as there is no hardware OneWire support in the Raspberry Pi.

I use this one, http://www.modmypi.com/raspberry-pi/breakout-boards/owfs-1-wire/r-pi-i2c-1-wire-owfs-expansion-module-

from onewire.

avaranovich avatar avaranovich commented on August 18, 2024

I overlooked that. Thought the library does something like https://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing/ds18b20 So to make it work on Windows IoT I need a bridge you referes to.

from onewire.

Rinsen avatar Rinsen commented on August 18, 2024

For, at least, this code to work you need a bride like the one I linked there unfortunately.

One way to do it if you don´t want to buy a bridge like that is to use a Arduino as a bridge instead but my code here will not help you with that.

from onewire.

fabianandres avatar fabianandres commented on August 18, 2024

I tried to connect a DS18B20 sensor with my r-pi3. I'm using the same i2c-1-wire expansion module from modmypi.com.
But it doesn't work as expected.
It gets some data only one time. If I stopp application and start it again, programm fails at position:
_ds2482_100 = new DS2482_100(new I2cDeviceLocator().GetI2cDevice(address).Result);
I never get a response from this line of code.

Sensor is connected like this:
5v to red cable (vcc)
black one to power gnd
blue one to DQ

My questions: is the wiring correct?
What can cause this issue?

Thank you for any hint.

from onewire.

Rinsen avatar Rinsen commented on August 18, 2024

Hi @fabianandres!

Have you made sure that you are disposing the OneWireDeviceHandler in a using block? Or reuse the same instance over and over again. The I2C bus that is used to communicate with DS2482-100 is a very limited resource that needs to be disposed every time if you let go of the instance.

using(var oneWireDeviceHandler = new OneWireDeviceHandler())
{
    foreach (var device in oneWireDeviceHandler.GetDevices<DS18B20>())
    {
        var result = device.GetTemperature();
        // Insert code to log result in some way
    }
}

I have been running a device for months without any issues.

from onewire.

fabianandres avatar fabianandres commented on August 18, 2024

Hi,

Thank you for your fast response.

Yes, I enclosed OneWireDeviceHandler in a using block.

Tried also to reuse same instance. This works until I restart application.

I tried to dispose instance after every reading.

if (this.oneWireDeviceHandler == null)

           {

               this.oneWireDeviceHandler = new OneWireDeviceHandler(true, true);

           }

           foreach (var device in oneWireDeviceHandler.OneWireDevices.GetDevices<DS18B20>())

           {

               var result = device.GetTemperature();

               this.tempData.Temperature = result;

               // Insert code to log result in some way

               device.DS2482_100.Dispose();

           }

           this.oneWireDeviceHandler.Dispose();

           this.oneWireDeviceHandler = null;

But the same result here.

After restarting application, it fails on this line: new OneWireDeviceHandler(true, true);

Do you any other idea, whats wrong?

Thank you,

Fabian

Von: Fredrik Rinsén [mailto:[email protected]]
Gesendet: Montag, 10. Oktober 2016 22:25
An: Rinsen/OneWire [email protected]
Cc: fabianandres [email protected]; Comment [email protected]
Betreff: Re: [Rinsen/OneWire] There is no I2C devices found when running from headed app (#2)

Hi!

Have you made sure that you are disposing the OneWireDeviceHandler in a using block? Or reuse the same instance over and over again. The I2C bus that is used to communicate with DS2482-100 is a very limited resource that needs to be disposed every time if you let go of the instance.

using(var oneWireDeviceHandler = new OneWireDeviceHandler())
{
foreach (var device in oneWireDeviceHandler.GetDevices())
{
var result = device.GetTemperature();
// Insert code to log result in some way
}
}

I have been running a device for months without any issues.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub #2 (comment) , or mute the thread https://github.com/notifications/unsubscribe-auth/ACVXoAqcR9DQgOw6HM7_6AzpmtDRJS9Gks5qyp8GgaJpZM4Fkmv2 . https://github.com/notifications/beacon/ACVXoB3dKsNZu0tjFc8GR2Iwk-F-MrOtks5qyp8GgaJpZM4Fkmv2.gif

from onewire.

Rinsen avatar Rinsen commented on August 18, 2024

Could you create a as small as possible repro project in a github repository that I can try with the same problem?

It probably has to do with the project type in some way I think, but it´s strange... And I would like to investigate and try to fix this issue :)

from onewire.

fabianandres avatar fabianandres commented on August 18, 2024

Hello,

I created a repository at https://github.com/fabianandres/BrewSentinel

Thank you for your help!

Von: Fredrik Rinsén [mailto:[email protected]]
Gesendet: Mittwoch, 12. Oktober 2016 21:30
An: Rinsen/OneWire [email protected]
Cc: fabianandres [email protected]; Mention [email protected]
Betreff: Re: [Rinsen/OneWire] There is no I2C devices found when running from headed app (#2)

Could you create a as small as possible repro project in a github repository that I can try with the same problem?

It probably has to do with the project type in some way I think, but it´s strange... And I would like to investigate and try to fix this issue :)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #2 (comment) , or mute the thread https://github.com/notifications/unsubscribe-auth/ACVXoO8zrkf6rIF8M5pT1__ZaGMByM5zks5qzTVIgaJpZM4Fkmv2 . https://github.com/notifications/beacon/ACVXoMlnGuubJUvnZT6Qp1rLAmns0zxYks5qzTVIgaJpZM4Fkmv2.gif

from onewire.

Rinsen avatar Rinsen commented on August 18, 2024

I think I have found the issue here, I will try to implement it and release a new version with some sample code but I have a lot of other things going on so I cant promise when it will be done but within some days at least.

But the problem is related to how Task<> and IAsyncOperation<> is working in headed and headless apps. For some reason that I can´t understand they differ. The solution in headed apps is to run an IAsyncOperation<> with a method call to .AsTask() to get a "normal" Task<> and things start to work as they do in headless mode. while waiting for a Task<> to complete.

I will post here as soon as it is done so you can test it @fabianandres

from onewire.

Rinsen avatar Rinsen commented on August 18, 2024

@fabianandres
I have made a commit today that contains a sample for headed applications and I also have made some changes in the Rinsen.IoT.OneWire project to handle async calls in a way that seems to work.

And in the Headed sample you will see that I never dispose the OneWireHandler as this is for some reason not supported with my current implementation in headed mode. But it still works as it should in headless and there you can dispose it and create a new one if you like to.

I have not updated my nuget package right now but will do some more tests before I do that.

I will also close down this issue when that package is out as the main issue is resolved.

from onewire.

Rinsen avatar Rinsen commented on August 18, 2024

I have published a new version to nuget now and will close this issue

https://www.nuget.org/packages/Rinsen.OneWire/0.1.5

from onewire.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.