Netduino home hardware projects downloads community

Jump to content


Photo

OneWire ALPHA


  • Please log in to reply
167 replies to this topic

#21 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 04 February 2011 - 02:45 PM

Edit: You haven't attached your source, I see? ;p

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.

#22 sterned

sterned

    New Member

  • Members
  • Pip
  • 5 posts

Posted 17 February 2011 - 05:18 PM

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.

#23 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 March 2011 - 11:24 PM

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

#24 spur

spur

    Member

  • Members
  • PipPip
  • 27 posts

Posted 30 March 2011 - 08:55 PM

Thanks for the 4.1.1 b1 One Wire build Chris :D

#25 NDFan

NDFan

    New Member

  • Members
  • Pip
  • 2 posts

Posted 31 March 2011 - 11:48 AM

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

#26 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 31 March 2011 - 10:05 PM

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?


Sure. We'll put one together by the weekend.

EDIT: posted :)

Chris

#27 acetate

acetate

    Member

  • Members
  • PipPip
  • 26 posts
  • LocationSeattle, WA

Posted 04 April 2011 - 03:17 AM

Big thanks to Chris Walker and CW2.

#28 Steve88W

Steve88W

    New Member

  • Members
  • Pip
  • 3 posts

Posted 09 May 2011 - 05:35 PM

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. :blink:

Much thanks!

#29 mcianc

mcianc

    New Member

  • Members
  • Pip
  • 4 posts
  • LocationItaly

Posted 15 May 2011 - 04:20 PM

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

#30 mcianc

mcianc

    New Member

  • Members
  • Pip
  • 4 posts
  • LocationItaly

Posted 28 May 2011 - 06:55 PM

Thanks, work perfectly.

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.


Updated
... my be I understood, the problem is
.NET Micro Framework Porting Kit
http://blogs.msdn.co...ework-v3-0.aspx

#31 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 30 May 2011 - 11:53 AM

...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
  {
    //...
  }
}


#32 mcianc

mcianc

    New Member

  • Members
  • Pip
  • 4 posts
  • LocationItaly

Posted 31 May 2011 - 08:38 AM

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. :(

#33 grimbouk

grimbouk

    New Member

  • Members
  • Pip
  • 8 posts

Posted 02 June 2011 - 03:15 PM

Hi guys, this is great work! Is it possible to provide the same beta firmware for the NetduinoMini? Or have I missed something somewhere? thanks Tim

#34 Valkyrie-MT

Valkyrie-MT

    Advanced Member

  • Members
  • PipPipPip
  • 315 posts
  • LocationIndiana, USA

Posted 05 June 2011 - 11:14 PM

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

#35 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 06 June 2011 - 06:01 AM

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.

#36 Valkyrie-MT

Valkyrie-MT

    Advanced Member

  • Members
  • PipPipPip
  • 315 posts
  • LocationIndiana, USA

Posted 07 June 2011 - 02:08 AM

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!

Now, what happened with the NetBios stuff?

*** Thanks CW2 *** :D

-Valkyrie-MT

#37 Valkyrie-MT

Valkyrie-MT

    Advanced Member

  • Members
  • PipPipPip
  • 315 posts
  • LocationIndiana, USA

Posted 19 June 2011 - 03:46 AM

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...

*** Thanks again to CW2 ***

-Valkyrie-MT

Attached Files



#38 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 20 June 2011 - 06:26 AM

Throw Events for device alerts

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.


#39 phantomtypist

phantomtypist

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts
  • LocationNew York, NY

Posted 22 June 2011 - 02:52 AM

Chris, Any chances you might be able to get a Netduino Mini version of the firmware in the works? Thanks

#40 grimbouk

grimbouk

    New Member

  • Members
  • Pip
  • 8 posts

Posted 04 July 2011 - 06:14 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.