jefffhaynes / XBee

A .NET library for XBee wireless controllers
MIT License
41 stars 17 forks source link

Getting Started. Need some enlightenment. #9

Closed PaulNoto closed 8 years ago

PaulNoto commented 8 years ago

Hi Jeff, Thank you for doing all the heavy lifting involved with creating this XBee library. I'm going to use it going forward. However, I'm having some issues I hope you will help me with.

My development environment is a Windows 10 Pro Box and Visual Studio 2015 Community, and your XBee Library 2.1.0.0.

I have experience with XBees and I am switching over from a netduino solution to a PC based solution because the creator of the netduino hasn't been heard from for over 6 months.

The last issue in this list is the one I'm stuck on and can't figgure out. I have overcome all the others by using the source code to the XBee library in my test project and making modifications as required.

Issues:

1. Failed to open COM4 with ZNetZigBeeS2 not supported.

Not a problem because these are the old XBees that have reached End of Life and I had already orderd S2C versions for this project. However, they have been available for years and I was wondering why you don't support them?

2. Failed to open COM4 with 46 not supported.

This is a S2C XBee that I just received from DigiKey PN:602-1558-ND MFPN:XB24CZ7SIT-004 with a Hardware Version of 2E43. 2E Hex = 46 Dec. I modified the HardwareVersion.cs file because it only contained an enum for: XBee24S2C = 0x22. I added: XBee24C = 0x2E. I also had to modify the XBeeController.cs file: CreateNode switch statement to include, case HardwareVersion.XBee24C: return new XBeeSeries2( this, HardwareVersion.XBee24C, address ); and that solved the issue. FYI: I ordered 3 different types of XBees: RPSMA, UFL, and PCB Antenna. They all start the Hardware Version with 2E.

3. Sleeping End Devices are not found during Network Discovery.

This is to be expected. I didn't find anything in the readme file addressing this issue. I solved it by manualy adding the node after network discovery:

await controller.DiscoverNetwork();
AddLog( "END network discovery" );
endPorch = await controller.GetRemoteNodeAsync( new NodeAddress( new LongAddress( ulong.Parse( "0013A20040D967EC", System.Globalization.NumberStyles.HexNumber ) ), new ShortAddress( ushort.Parse( "7D34", System.Globalization.NumberStyles.HexNumber ) ) ) );
endPorch.SampleReceived += ( node, sample ) => AddLog( cntr1++.ToString() + " " + DateTime.Now.ToShortTimeString() + " End_Porch Sample: " + sample.DigitalSampleState.ToString() );
AddLog( "End_Porch Added to controller" );

I'm OK with this. However their must be a shorter way of doing this that I didn't find. Also, these sleeping nodes eventualy send a sample to the controller and I was wondering how to catch a transmission from a new network node so I can have software add it to a list of unknown nodes and then add it to my network with my user interface. That way I don't have to use X-CTU to get it's info first.

4. My sample data coming in from all my XBees says "none" by the time it gets to AddLog(). A Router is sending samples and 2 End Devices are sending samples. This is the one I'm stuck on. I know they are sending DIO input pin states. I just can't figure out where in the library the data is disapearing. Is there more I need to configure when a Node is added? Any help would be appreciated.

Thanks, Paul

jefffhaynes commented 8 years ago

Hey Paul, thanks for the info. I've added your new hardware info and I'll push a new package soon.

On the sample thing it depends what you're sending but any chance it's showing up on DataReceived instead of SampleReceived?

PaulNoto commented 8 years ago

I'm only getting SampleReceived events. In controller.NodeDiscoverd ( Which does find the Router ) I add event handlers for SampleReceived and DataReceived. The only events I get are SampleReceived.

I'm confident of my XBee configuration. I have had them running reliably for years with the Netduino and GBee Library.

Where in your code should I set a breakpoint to see when the decision is made that causes your code to decide that no Pin State info was sent with the sample. I know the Nodes are sending the Pin State with the sample to the controller. Somehow it gets lost in translation.