rinsen / onewire Goto Github PK
View Code? Open in Web Editor NEWOne Wire via DS2482-100 or DS2482-800 for Windows or Linux based Raspberry Pi IoT solutions
License: MIT License
One Wire via DS2482-100 or DS2482-800 for Windows or Linux based Raspberry Pi IoT solutions
License: MIT License
In WaitForOneWireReady()
, a new Stopwatch()
is created, but never started. As a result, the if-test (stopWatch.ElapsedMilliseconds > 5000)
will never evaluate to true:
OneWire/src/Rinsen.IoT.OneWire/DS2482_100.cs
Lines 329 to 337 in a102c23
var stopWatch = Stopwatch.StartNew();
The same issue can be found in this piece of code in ReadStatus(bool setReadPointerToStatus = false)
:
OneWire/src/Rinsen.IoT.OneWire/DS2482_100.cs
Lines 313 to 321 in a102c23
Regards
Hi,
thank you for your code, but I had no success with it. I used an schematic like http://www.raspi.cz/wp-content/uploads/2012/11/ds2482-1_bb.jpg and I get this exception in the catch-block in your sample code in LogTemperatures(ThreadPoolTimer timer):
{System.IO.FileNotFoundException: The system cannot find the file specified.
Slave address was not acknowledged.
at Windows.Devices.I2c.I2cDevice.Write(Byte[] buffer)
at Rinsen.IoT.OneWire.DS2482_100.OneWireReset()
at Rinsen.IoT.OneWire.OneWireDeviceHandler.GetConnectedOneWireDevices()
at Rinsen.IoT.OneWire.OneWireDeviceHandler.get_OneWireDevices()
at Rinsen.IoT.OneWire.OneWireDeviceHandler.GetDevicesT
at OneWire.StartupTask.LogTemperatures()}
Maybe you have an idea?
For the DS18B20 thermistor do you just need to connect it to any one of the GPIO ports?
Thanks
Do you thing support netcoreapp2.1 project type
I have released a new version with a lot of new features but also some breaking changes.
See the sample app and documentation for more details.
Firstly, thanks for a great project. Just started using it but going well so far.
I need a OneWireDeviceHandler ctor with a I2cDevice instead of the AD0/AD1 parameters. Long story but basically I am auto discovering what is connected to my I2C bus and instead of creating a device to detect the DS2482 and then disposing of it and then letting OneWireDeviceHandler create it again, adding a new ctor is more efficient. Below is what I added to line 60 of OneWireDeviceHandler.cs for your consideration in one of the next builds.
/// <summary>
/// One wire device handler via DS2482-100
/// </summary>
/// <param name="i2cDevice">Opened I2cDevice</param>
/// <exception cref="Rinsen.IoT.OneWire.DS2482100DeviceNotFoundException">Thrown if no DS2482-100 device is detected</exception>
public OneWireDeviceHandler(Windows.Devices.I2c.I2cDevice i2cDevice)
{
_ds2482_100 = new DS2482_100(i2cDevice);
try
{
_ds2482_100.OneWireReset();
}
catch (Exception e)
{
throw new DS2482100DeviceNotFoundException("No DS2482-100 detected, check that AD0 and AD1 is correct in ctor and that the physical connection to the DS2482-100 one wire bridge is correct.", e);
}
_oneWireDeviceTypes = new Dictionary<byte, Type>();
AddDeviceType<DS18S20>(0x10);
AddDeviceType<DS18B20>(0x28);
}
For details #1
Currently, this project only works with the standard (inbox) drivers. A minor tweak is required to add support for the lightning drivers.
I couldnt get the Onewire working for IoT Edge on Raspberry.
IoT Edge on Rasperry: this mean Linux on Raspberry and solution is running as a docker on it.
I2C is working and docker can see it. I have another I2C device connected and working which is using drivers from https://github.com/dotnet/iot.
I even tried disconnect another device from the I2C bus to leave just Onewire alone but still the same error message.
It was working under Windows IoT core.
Unhandled Exception: Rinsen.IoT.OneWire.DS2482100DeviceNotFoundException: No DS2482-100 detected, check that AD0 and AD1 is correct in ctor and that the physical connection to the DS2482-100 one wire bridge is correct. ---> System.IO.IOException: Error 121 performing I2C data transfer.
at System.Device.I2c.UnixI2cDevice.ReadWriteInterfaceTransfer(Byte* writeBuffer, Byte* readBuffer, Int32 writeBufferLength, Int32 readBufferLength)
at System.Device.I2c.UnixI2cDevice.Transfer(Byte* writeBuffer, Byte* readBuffer, Int32 writeBufferLength, Int32 readBufferLength)
at System.Device.I2c.UnixI2cDevice.Write(ReadOnlySpan 1 value)
at Rinsen.IoT.OneWire.DS2482Channel.OneWireReset()
at Rinsen.IoT.OneWire.DS2482DeviceFactory.PrivateCreateDs2482_100(I2cDevice i2cDevice, Boolean disposeI2cDevice)
--- End of inner exception stack trace ---
at Rinsen.IoT.OneWire.DS2482DeviceFactory.PrivateCreateDs2482_100(I2cDevice i2cDevice, Boolean disposeI2cDevice)
at HomeModule.Measuring.RinsenOneWireClient.ReadSensors() in /app/Measuring/RinsenOneWireClient.cs:line 25
at HomeModule.Schedulers.HomeTemperature.ReadTemperature() in /app/Schedulers/HomeTemperature.cs:line 41
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b__7_1(Object state)
at System.Threading.QueueUserWorkItemCallbackDefaultContext.<>c.<.cctor>b__5_0(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.QueueUserWorkItemCallbackDefaultContext.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Hallo,
I'm trying to use your "simple library" to read my old OneWire temperature sensor.
Could you please help me out a little, I'm one of those people that need a little more examples in order to compensate the lack of knowledge... :-)
Please advice
Dann
What is the level of effort to support the 800 version of the chip? I love the idea of a full C# version of DS1820B temperature monitors, but I do not want to be limited by 4 sensors.
I read through the closed question regarding wiring the DS18B20, but I think that refers to connecting to a Raspberry Pi prior to 3? I'm seeing a lot of articles on connecting the DS18B20 to the Raspberry Pi 3 GPIO04 pin, having the 3.3 wire connected to the data wire with a 4.7KOhm resistor. Unfortunately all the code samples is written in languages other than C#. The project I'm working on is built on a Raspberry Pi 3 running Windows 10 IoT Core.
This is more of a question than an issue with your project. First, in the closed question you mention the Raspberry Pi isn't equipped with a OneWire pin (I think that's how you described it), but are you referring to Pi's older than the Raspberry Pi 3? Second, if OneWire is truly capable on Raspberry Pi 3, does that mean the i2c 1-wire Owf expansion is obsolete on the Raspberry Pi 3? Third, assuming both questions are "Yes", will your OneWire library work with projects connected to a Raspberry Pi 3 with a DS18B20 sensor?
Thank you for your time!
TEMPERATURE (°C) DIGITAL OUTPUT(BINARY, MSB, LSB) DIGITAL OUTPUT (HEX)
+125 0000 0111 1101 0000 07D0h
+85* 0000 0101 0101 0000 0550h
+25.0625 0000 0001 1001 0001 0191h
+10.125 0000 0000 1010 0010 00A2h
+0.5 0000 0000 0000 1000 0008h
0 0000 0000 0000 0000 0000h
-0.5 1111 1111 1111 1000 FFF8h
-10.125 1111 1111 0101 1110 FF5Eh
-25.0625 1111 1110 0110 1111 FE6Fh
-55 1111 1100 1001 0000 FC90h
This is how it should work, and it doesn't.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.