Rinsen/OneWire

Using with Raspberry Pi 3

Closed this issue · 8 comments

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!

There are more or less no differences between the second and third version affecting this at least. This is what you have available
https://docs.microsoft.com/en-us/windows/iot-core/learn-about-hardware/pinmappings/pinmappingsrpi

When talking over hardware protocols like i2c or one wire the timing demands are really high and important to exactly fulfill to be successful when communicating.
There are two common ways to fulfill this requirement and only one is possible from a managed language/runtime like C#.

The first and best option is to rely on hardware that is handling all the hard parts when communicating. This is what a RPi can do for i2c for example.
The other is to build it in software and then send data with the correct timings and that can't be done in any safe and good way with a managed runtime like .NET.

It's fairly easy to do on an Arduino for example where you can calculate how long time things will take down to a very short period of time.

This library is only handling the first option of going from .NET to i2c and then via an external hardware component (DS2482) sending one wire data.

I'm happy that I can try to help!

Thank you for your response!

Let me just clarify that I'm primarily a software developer and starting to get my feet wet in building IoT devices. It's a new world that I'm getting into so please be patient as I make my way to how all this works together … boards (Pi, Arduino, etc), OSs (Linux, Windows IoT, etc), and software (Perl, C#, etc). I'm not too interested in going out of my comfort zone, which is primarily C# and Visual Studio, which brought me to your project.

I pretty much get what you responded with, and that being C# as a bottleneck to successfully read the GPIO04 pin because of timing issues … did I understand that correctly? So in order for the timing to work with C#, an intermediate component, the DS2482, is needed to correct the timing issues between the DS18B20 sensor and the GPIO04 pin for C# to read the pin correctly. Please let me know if I have that wrong.

In regards to your library … it sounds like once I get that DS2482 component, it sits on 6 pins of the Raspberry Pi (pins 1-6), and your library reads GPIO 2 & 3. Question on that. Part of the project I'm working on requires reading 3 different devices, one of which is already connected to GPIO 2 & 3. If I were to attach the DS2482 component to the board, along with my other sensor connected to GPIO 2 & 3, do you think the readings will interfere with each other (both DS18B20 and my other sensor)?

Last thing. I've contemplated moving my project over to an anduino board, but I'm having a hard time finding sources on how I can run C# apps on it. If you think this would be a viable option to try and have some links to point me in the right direction, I'd really appreciate it.

Again, thank you for your time!

If you want to do .NET on and an "Arduino" style board, look at the netduino (https://www.wildernesslabs.co/Netduino) it's an Arduino style board that uses .NET Micro Framework.

I think you have understood what I tried to say just fine. This is the board I use and it's connected via i2c.
https://www.modmypi.com/raspberry-pi/sensors-1061/kits-and-interface-boards-1062/r-pi-i2c-1-wire-owfs-expansion-module-

I have never tested to connect other things to the same port but it should in theory work as long as it's i2c also.

There are no way out running dotnet that I know of on the Arduous as they are so limited in their speed and memory. But as @mleaming say you could use a Netduino instead. They are fun but are staring to get pretty old now, the C# language support in them are very basic and they have a limited memory that can be an issue in som cases.

But it's possible to do a lot of fun thing's with them. I have for example built a small web server for them a few years ago.
https://github.com/Rinsen/WebServer

And the one wire is easy to use without any external thing's.

But compared to Windows Iot on the raspberry a Netduino feels very basic...

@mleaming Thank you for the link. If I get stuck I'll look into that. As @Rinsen was saying, though, it's a bit old and my current project already has software running UWP on the Raspberry Pi 3 with other sensors working. Thank you for your time and your response!

@Rinsen I've been looking at that expansion module. I'm trying to find a comparable module from other sources like Amazon (so I don't have to wait at least a week to have it shipped here to the US), but not having much luck. Do you have some thoughts on other places I can purchase that expansion module … even if it's not from the same company?

Appreciate your time. Thank you!

I don't know of any place in the US as I usually try to avoid ordering from the US because of taxes that are added when shipping to EU...

But any break out board with the correct chip should work. I have even built a version on a standard breakout board with a chip I got from eBay and a sample schematic from the datasheet.

Closing old issues with no activity, please file a new issue if still relevant