Netduino home hardware projects downloads community

Jump to content


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.

Runner's Content

There have been 14 items by Runner (Search limited from 29-March 23)


By content type

See this member's

Sort by                Order  

#41010 Multiple Netduinos within one local Network

Posted by Runner on 05 December 2012 - 08:06 AM in Netduino Plus 2 (and Netduino Plus 1)

Hello all! please just forget about this post. :) I have checked the IP´s am MAC address with MFdeploy. In the startup of my main function I was setting the new IP address for the Netduinos. unfortunately I have not recognized a function call to one of the classes I have written at the beginning. In the "lost" class I have had a function which was setting the MAC address. Really thanks for your help and from now on I will improve my code documentation! :) btw: UDP is working fine. Connection to both of the Netduinos is working! You guys are really great! Thanks



#40930 Multiple Netduinos within one local Network

Posted by Runner on 04 December 2012 - 11:43 AM in Netduino Plus 2 (and Netduino Plus 1)

MAC, IP and networkport of all devices are different! I have checked this several times... Trying to switch my code to TCP protocol. This will cost data transfer rate (UDP is faster cause there is no handshake), but i hope it will fix the communication problem



#40351 Multiple Netduinos within one local Network

Posted by Runner on 28 November 2012 - 05:55 AM in Netduino Plus 2 (and Netduino Plus 1)

Hey!

Sorry was ill the last days.
Here some code:
System.Net.Sockets.Socket LVSocket = null;
System.Net.IPEndPoint LVEndpoint = null;
System.Net.Sockets.Socket uCSocket = null;
System.Net.IPEndPoint uCEndpoint = null;

// Path of the init File at the Sd Card
System.String Path = @"\SD\Config_INIT.txt";
// DEFAULT values if SD Card is not found or not inserted

// SETTINGS for Netduino #1
System.String LabViewIP = "192.168.1.20";                 
System.Int32 NetworkPort = 49001;                 
System.String NetduinoIP = "192.168.001.21";

// SETTINGS for Netduino #2
// System.String LabViewIP = "192.168.1.20";                 
// System.Int32 NetworkPort = 49002;                 
// System.String NetduinoIP = "192.168.001.22";

The program checks for an config file at the SD Card (works fine)
If no SD Card detected it will continue with:


System.Net.IPAddress IPLabview = System.Net.IPAddress.Parse(LabViewIP);
System.Net.IPAddress IPNetduino = System.Net.IPAddress.Parse(NetduinoIP);

Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableStaticIP(NetduinoIP, "255.255.255.0", "192.168.0.0");

if (uCEndpoint == null)

{
  uCSocket = UDPConnector.RecieveSocket(uCSocket);
  uCEndpoint = UDPConnector.RecievePoint(uCSocket, uCEndpoint, IPNetduino, NetworkPort);
}

if (LVSocket == null)
{
  LVSocket = UDPConnector.SendSocket(LVSocket);
  LVEndpoint = UDPConnector.SendPoint(LVSocket, LVEndpoint, IPLabview, NetworkPort);
}

byte[] Recieved = UDPConnector.getMessage(uCSocket);


BTW I´m using CAT5 cables



#39993 Multiple Netduinos within one local Network

Posted by Runner on 23 November 2012 - 11:16 AM in Netduino Plus 2 (and Netduino Plus 1)

Hey Markus, I´m sorry but the solution i mentioned above isn´t working.. But it sounded like a good reason for the failure... Have to leave to the university but a small update to the Network config: Netduino #1 IP: 192.168.1.21 Port: 49001 Netduino #2 IP: 192.168.1.22 Port: 49002 Laptop: IP: 192.168.1.20 Port: 49001 and 49002 The Laptop is running a Lab View program which opens 2 UDP protocol ports (both same IP but different ports) same result as before... everything is connected to a switch hard- and software works fine with just one Netduino connected.



#39986 Multiple Netduinos within one local Network

Posted by Runner on 23 November 2012 - 09:28 AM in Netduino Plus 2 (and Netduino Plus 1)

ok one device per port....found it.. :P thanks



#39985 Multiple Netduinos within one local Network

Posted by Runner on 23 November 2012 - 08:24 AM in Netduino Plus 2 (and Netduino Plus 1)

each netduino gets a fixed IP IPs are set with this function: System.Net.IPAddress IPNetduino = System.Net.IPAddress.Parse(NetduinoIP); #1: 192.168.001.122 #2: 192.168.001.222 Laptop: 192.168.001.020 the netduinos send the data to port 49000 of my Laptop. Is the port connection fixed and just for one device?



#39978 Multiple Netduinos within one local Network

Posted by Runner on 23 November 2012 - 07:45 AM in Netduino Plus 2 (and Netduino Plus 1)

Hello all together, i´ve received a second Netduino from a friend of mine. So i thought about setting up a small sensor network in my flat. Sensing different things for the beginning just the climate within and outside of the flat. Whatever this works fine! Both Netduinos are running (basically) the same programs. But... when i connect them both to the local Network just one of them works. My start up progress: - switching on Netduino #1 (IP: 192.168.1.100) - within the start up #1 sets it´s IP and starts working - checking connection from my Laptop (IP 192.168.1.20) ping to #1 -> works fine - switching on Netduino #2 (IP: 192.168.1.200) - same start up sequence like #1 - checking connection Laptop -> #2 -> works fine - want to call #1 doesn´t work anymore - pinging returns timeout tried solutions: - different network ports - different network IP´s - different style of connecting (switching on, then connecting networkcable, etc.) - basically the network connection if the Netduino which is connected first stops working when the second one is connected Any ideas or am I just missing something? Regards and thanks for help Runner



#24636 High Speed Ethernet

Posted by Runner on 24 February 2012 - 05:51 AM in Netduino Plus 2 (and Netduino Plus 1)

forgot to add some code... sorry

// setup for I2C

ushort Address = 0x80 >> 1;
int ICSpeed = 400;
           
var Duino = new Microsoft.SPOT.Hardware.I2CDevice(new Microsoft.SPOT.Hardware.I2CDevice.Configuration(Address, ICSpeed));

var commands = new Microsoft.SPOT.Hardware.I2CDevice.I2CTransaction[]
{
   Microsoft.SPOT.Hardware.I2CDevice.CreateWriteTransaction(Register),      //Order to read out the INA226
   Microsoft.SPOT.Hardware.I2CDevice.CreateReadTransaction(buffer),            // Recieve answer from INA226
};


// routine for reading out the I2C sensing device

    while (Shunt < ClusterSize)
    {
        Duino.Execute(commands, 1);   // I2C transmittion

        DATAOUT[Shunt++] = buffer[0];
        DATAOUT[Shunt++] = buffer[1];
    }
after the .Execute command there is the pause....
or takes the netduino so much time to write the two byte from buffer to dataout?



#24611 High Speed Ethernet

Posted by Runner on 23 February 2012 - 03:13 PM in Netduino Plus 2 (and Netduino Plus 1)

Short question... we are sampling data via I2C with a bus frequence of 400kHz it works really good and we get the right data out of the sensing device. But when i take a look at the communication there is a pause between each "bus package" one package consists of the order from the netduino ( 1 byte) and the response from the sensor (2 byte) after these 3 packages there is a pause of 500 micro seconds. Is there any chance to reduce this pause? kind regards Runner



#24602 High Speed Ethernet

Posted by Runner on 23 February 2012 - 09:10 AM in Netduino Plus 2 (and Netduino Plus 1)

Glad I could be of help! So did you use interop or just optimized the managed/C# code?


Unfortunately i have to admit that this was the easiest way:

took my brain out of the desk and used it for programming.. :-)

my code was full of converting functions...
e.g.:
i recieved a byte array converted it to a string...
then i separated the string to a string array and converted it again to byte or int or something else...
same procedure for sending data...
i don´t know why i have done things like that...

after all i have to laugh about the mess of code i´ve created.. :-)

therefore the warning: Do not use my code!



#24598 High Speed Ethernet

Posted by Runner on 23 February 2012 - 06:46 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi seuabb, at the moment we want to build a "wired Netduino measuring network"... Further projects are planed but we have a lack of manpower.. :-) my lecturer is searching for students cause he want to build up a wireless network for sensing devices and he wants to create sensing devices which are sending data via GPRS... btw: really big thanks to tunachicken27!!! i have rewritten the code (still working on it) but at the moment i have increased the value output from 350 values / second to approximately 2500... also found some more places to optimize... :-) Runner.... P.S.: for everyone who wants to use the code from above... DON´T DO IT!!! :-)



#24448 High Speed Ethernet

Posted by Runner on 20 February 2012 - 06:32 AM in Netduino Plus 2 (and Netduino Plus 1)

Good day everyone! @tunachicken27: i will try this in the next days and rewrite the code. I am not really good at programming. (what everyone could see in my code) but im trying to get better... @seuabb: i have tried a communication viw TCP befor but due to the "handshake" protocol of the TCP i thought that UDP would be better. also the handshake failed some times with LabView. But it was really great when the Netduino and LabView "talked" the first time with each other... In your application we don´t want to save data on the SD Card... For the project at the University we want to setup a host PC and several Netduinos. The Netduinos are used as local sensing devices and the PC with LabView running as Master in the network.... But at the moment we are just building up an prototype to check the performance. Thanks to all!



#24341 High Speed Ethernet

Posted by Runner on 17 February 2012 - 01:55 PM in Netduino Plus 2 (and Netduino Plus 1)

and here is some of the code I am using:

For sending the Data:
public static void sendMessage(string message, Socket send, IPEndPoint Endpoint)
{
    byte[] bytes = Encoding.UTF8.GetBytes(message);
    send.Send(bytes);                            
}

For setting up the connection:
// Checking if there is allready a socket 
public static Socket socketUDP(Socket SOCK)
{
    if (SOCK==null)
    {
        Socket send = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);  // build socket
        return send;                                                                                // take new one
    }
    else return SOCK;     // use old socket
}


public static IPEndPoint Point(Socket send, IPEndPoint IPEND)
{
      if (IPEND==null)
      {
          IPEndPoint Endpoint = new IPEndPoint(IPAddress.Parse("192.168.5.10"), 49000);
          send.Connect(Endpoint);   

          return Endpoint;
      }
      else return IPEND;
}

and at last the measurement..
while(true)
{
    Counter++;

    double PINDATA= GPIO_PIN_A0.Read();
    double value = (PINDATA* maxVoltage) / maxADCValue;
    string Measured= value.ToString("f6");

    DATAOUT= DATAOUT+ "+" + Measured;          // packing data seperated by "+"

    string Order= NDPConnect.getMessage(uCSocket);                    //checking for new orders

    if (Order.Length != 0)
    {
        NDPConnect.sendMessage(DATAOUT, LVSocket, LVEndpoint);  // send data immdiately
        DATAOUT= "";

        return Order;    // go to recieved case
    }


    if (Counter >= 20)
    {
      Counter= 0;
      NDPConnect.sendMessage(DATAOUT, LVSocket, LVEndpoint);  // send data
      DATAOUT= "";

      return "WAIT@ALL#";     // go to wait case
    };
}




#24339 High Speed Ethernet

Posted by Runner on 17 February 2012 - 01:40 PM in Netduino Plus 2 (and Netduino Plus 1)

Hey all, I hope someone could help me a little bit. My Netduino has diffrent operating states like: - reading out a sensing device via I2C - reading an analog input - wait for order - reboot and set initial states - .... When i am reading out the meassured data from I2C or an analog port I build data packages to send then via UDP to a local Pc. The Netduino is just a listener in the network. It reacts to special orders which are sent by the Pc via Labview. Everything works fine I really have no problems to set up a communication or something else... BUT.... And here the Problem starts.... it is just to slow! I am watching at the network traffic with wireshark. As you can see in the picture there are some DHCP packages.. Where do they come from?? And how to shut them down? and if you calculate the frequenc of the measured data... there are just 350 values per second... how is it possible to use the full 10Mbps of the Ethernet?? The Netduino has the IP 192.168.5.100 and LabView 192.168.5.10 The Netduino is listening to the Ethernet if there are some new orders from LabView to execute. but there are no differences in the transition speed if i check for a new order after every measured value or after 1000. I hope someone could help me cause working with the Netduino is really interesting. Thanks in advance Runner

Attached Files





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.