The Netduino forums have been replaced by new forums at community.wildernesslabs.co.
This site has been preserved for archival purposes only
and the ability to make new accounts or posts has been turned off.
I like to see the search function, so I can have multiple sensors.
I have published an updated version in different thread that supports the rest of 1-Wire commands (i.e. Search), source code included. There is no firmware binary though, I am waiting for the official source release (certain features like PWM have not been published yet). I could provide a custom build if requested.
CW2, I just wanted to thank you for this straightforward, effective one wire solution. The sample code was extremely helpful, as well.
After suffering with LM35s on the overly noisy analog ports, I was about ready to put the netduinos in the bottom of a drawer and order an arduino for my brewing project. Your firmware is giving me consistent, accurate readings from my DS18B20s. Can't wait until it gets integrated into the official release.
Good work, and thanks again.
Due to the popularity of CW2's OneWire driver (and with his permission), we have made a special build of the v4.1.1 beta 1 firmware for Netduino with CW2's OneWire functionality included. Compiled using RVDS.
At the time I write this post, the latest update is attached to the first post in this thread.
Chris
Hi Chris,
as beginner with the Netduino Plus I want to try to use a DS1820. It seems this experimental firmware is for the Netduino, not the Plus version.
Is it possible to get this compiled firmware for the ND plus too?
best regards
a Fan of Netduino
as beginner with the Netduino Plus I want to try to use a DS1820. It seems this experimental firmware is for the Netduino, not the Plus version.
Is it possible to get this compiled firmware for the ND plus too?
At least we are a huge step closer to supporting the DHT11 and DHT22
I'm hoping that one of the code gurus releases some code to support the 'cheaper' humidity sensors.
Until then, I'll keep trying to mash my keyboard in hopes of tweaking this to work.
Hi to all
I'm new too of NetDuino word and i'm tring to use OneWire protocol with NetDuino Plus, I'm excited to see this implemeentation become reality.
I tested with DS18B20 and also for me work perfectlly, I just waiting the full integration into official firmware.
Thanks so much
But i have an issue, i have my Class Library, where live other my classes without problem, but if i copy the file OneWire.cs inside CW.NETMF.OneWire into my Class Library and so I have MyNamespace.OneWire the compilation finish without problem, I upload when whole solution to NetDuino but when the constructor is invoked and exception is generated..
To let work my project I need use the CW.NETMF.OneWire Class Library.
Someone have idea? I have checked every params of project, but I have not able to solve it.
...but if i copy the file OneWire.cs inside CW.NETMF.OneWire into my Class Library and so I have MyNamespace.OneWire the compilation finish without problem, I upload when whole solution to NetDuino but when the constructor is invoked and exception is generated..
Unfortunately, it is not possible to move OneWire.cs to another project, because there is 'native driver' (the actual implementation of 1-Wire methods decorated with MethodImpl(MethodImplOptions.InternalCall) attribute) in the firmware and it must match the dll name and checksum, otherwise the exception is thrown; and this happens in runtime.
Could you please provide more details on why you need MyNamespace.OneWire? It is planned to include OneWire class in the official firmware (and get the rid of CW.NETMF). Also, you can derive your own OneWire class in MyNamespace:
namespace MyNamespace
{
public class OneWire : CW.NETMF.Hardware.OneWire
{
//...
}
}
Unfortunately, it is not possible to move OneWire.cs to another project, because there is 'native driver' (the actual implementation of 1-Wire methods decorated with MethodImpl(MethodImplOptions.InternalCall) attribute) in the firmware and it must match the dll name and checksum, otherwise the exception is thrown; and this happens in runtime.
Could you please provide more details on why you need MyNamespace.OneWire? It is planned to include OneWire class in the official firmware (and get the rid of CW.NETMF). Also, you can derive your own OneWire class in MyNamespace:
namespace MyNamespace
{
public class OneWire : CW.NETMF.Hardware.OneWire
{
//...
}
}
Hi CW2
thanks for your replay, I was trieing to migrate your class to my Class Library only to better have all that I need in a whole project and have less namespace to import, and the final and better reason is to grove my knologe to be albe to create by myself a low level language implementation in Netduino. Like yuo can see in this other my post i'm becoming mad with a wind sensor and I need to decide if comunicate with it trought C# or C++ low level language, but for this I need to learn how do it, and your project seem perfect to learn.
For OneWire implementation i can wait the official firmware, but for wind sensor I need do by myself, no one seem have exprerencie with netduino.
Does anyone know where to find the DLL with the OneWire class? The one containing the "CW.NETMF.OneWireTestApp.csproj" project? It's not in the zip in the first post.
Thanks,
Valkyrie-MT
Does anyone know where to find the DLL with the OneWire class? It's not in the zip in the first post.
CW.NETMF.OneWire.dll is in the zip archive directory Solutions\Netduino\Interop\CW_NETMF_OneWire\ManagedCode\bin\Debug (and Release). If it is not there, open Solutions\Netduino\Interop\CW_NETMF_OneWire\ManagedCode\CW.NETMF.OneWire.csproj or Solutions\Netduino\Interop\CW_NETMF_OneWire\OneWireTestApp\OneWireTestApp.csproj project and build it, the dll will be created.
CW.NETMF.OneWire.dll is in the zip archive directory...
AH! The solution source code is in the Netduino_v4.1.1_beta1_CW.NETMF.OneWire-1.0.5.0.zip file! I had downloaded the Netduino Plus firmware and just assumed the that the other file was just the standard Netduino Firmware especially because of the smaller file size... Thanks! I just hooked a DS18B20 sensor and it looks superb! I'm just disappointed I hadn't noticed this thread until now. I was having issues with thermistors and really wanted this to work!
FANTASTIC! The One-Wire code in the firmware appears solid to me. I haven't seen any issues with it. Although, I really wanted to see a much simpler and object oriented way of working with 1 wire, so I wrote a wrapper class (called OneWireNetwork) out of CW2's sample. I only tested it with my DS18B20 sensors, but I have more coming soon and hopefully will add classes for them. So, what I did was create a collection class of devices that has a "Discover" method to scan the One-Wire network for devices. I hope this can be the start of a One-Wire framework that will make this the easiest One-Wire platform available. I have attached the code to this post. It is a complete replacement for CW2's OneWireTestApp project from the first post. Also, this example works with 1, 2, 3, or more devices, using parasite power or not.
By using the library, the code gets very simple:
public static void Main()
{
// TODO: Change pin according to the actual wiring
var deviceNetwork = new OneWireNetwork(Pins.GPIO_PIN_D0);
// Interrogate the devices on the network (adding them to the collection)
deviceNetwork.Discover();
while (true)
{
// Loop through all the discovered devices
foreach (var aDevice in deviceNetwork)
{
Debug.Print("Address: " + aDevice.Address);
if (aDevice is DS18B20)
Debug.Print("Temp: " + (aDevice as DS18B20).Temperature);
}
Thread.Sleep(20000);
}
}
Output:
1-Wire device present
Multiple devices present
72000002DC320128
B2000002DC405128
54000002DC577D28
Address: 000002DC3201
Temp: 23.375
Address: 000002DC4051
Temp: 23.4375
Address: 000002DC577D
Temp: 23.5
The program '[16] Micro Framework application: Managed' has exited with code 0 (0x0).
Things still to add:
Support for reading and writing to the device memory
Throw Events for device alerts
Robust exception handling
Throw Events for devices being added or removed
Support for a variety of One-Wire devices
Automatic instantiation of classes based on detected device family (should probably use some Reflection here)
I think CW2's firmware should get included into the next Beta. Let's get more people trying to use it...
The next version of OneWire, which is currently under development, adds support for Alarm/Conditional Search (ROM command 0xEC), Overdrive mode (125 kbps speed), and has some minor improvements. My plan is to keep OneWire class as simple as possible, to minimize firmware size, and provide additional features via managed extensions, wrappers or derived classes. Please let me know if you want/need to include any specific functionality; your OneWireNetwork looks superb.
I only tested it with my DS18B20 sensors, but I have more coming soon and hopefully will add classes for them
Besides DS18B20, I have DS1990A+F3 Serial Number iButton, DS1825 thermometer, DS24B33 EEPROM and DS2450 A/D converter, so I can offer testing the code with those devices and implementation of classes for them, if needed.
Automatic instantiation of classes based on detected device family
This would be nice. You might want to check out the following table for the list of 1-Wire devices and their family code.
Hi Guys,
Do you have an update as to when we can expect the OneWire functionality to be rolled into the core platform? From what I've seen it works great... But I am only using it with a couple of DS18B20s.
Thanks
Tim