Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
1,288 Views

How to configure the Intel Edison as an udp server in an adhock network ?

I have done some experiments with the edison (systemstudio, C ++ , Win7).

The integration into an existing network via wifi was also ok.

But the next Steps are not clear: I would like to use the edison with a special hardware for measurements.

The edison should be an udp Server that responds to requests from a (Android-)Client. But there is no AP / Network, it must be an adhoc Connection.

Now is the question how is to configure the System?

What is to do with the system settings and what in application? Normally is assumed that the edison is integrated into a network (SSID, key, PW)

Which IP is to be used?

An example would be helpful.

Thanks and greetings

Achim

0 Kudos
8 Replies
Highlighted
Community Manager
33 Views

Hello Achim,

 

 

Thank you for interest in the Intel® Edison Breakout Board.

 

 

I understand that you want to measure a variable with a special hardware, then transfer the data to your Edison board, which acting as a UDP server, should send information, when requested, to an Android client. All of this through an ad-hoc connection.

 

I have a question before presenting what I've found so far, are you not able to use an AP network or you don't want to use one? Because if you can, you should check this link https://communities.intel.com/message/442354# 442354 https://communities.intel.com/message/442354# 442354 in order set the Edison as an UDP server.

 

 

Generally, the UDP communication part is more Linux related than Edison related, so here is a link that may help you program UDP sockets http://www.binarytides.com/programming-udp-sockets-c-linux/.

 

 

Regarding the ad-hoc connection, the Intel Edison Wi-Fi Guide, section 4.2.4 ( http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edison_wifi_331438001.pdf), gives the necessary steps to create/connect to such network.

 

 

In case you need further assistance, don't hesitate to contact us.

 

 

Regards,

 

Andres V.
Highlighted
Beginner
33 Views

Hi Andres,

thanks for your mail.

....UDP ad-hoc Connection: At the moment is to be used an android tablet (as terminal).

Some tablets can not open a WiFi hotspot if they don't have internet-accsess. The final user does not allow the use of tabets with internet option.

If the case the EDISON is configured as an AP, I assume that the energy consumption is higher!?

This path would be not optimal also for other reasons (using of multiple devices....)

I tried to program the edison (wifi Guide, 4.2.4 create / connect to an ad-hoc network).

There were 2 Problems:

1. I don't found the directory with the file 'edison_env' to load the wpacli_ibss_open.sh - script.

my edison directory is empty !?

C:\>dir F:\

 

Datenträger in Laufwerk F: ist EDISON

 

Volumeseriennummer: 80C7-D7A4

Verzeichnis von F:\ <--- empty

Datei nicht gefunden

C:\>

2. Because I have configured one edison (as adhoc nw), but it haven't not worked completely.

These are the Settings:

mailto:root@edison_gfxxxx root@edison_gfxxxx:~# ifconfig

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:65536 Metric:1

RX packets:48644 errors:0 dropped:0 overruns:0 frame:0

TX packets:48644 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:3696976 (3.5 MiB) TX bytes:3696976 (3.5 MiB)

 

usb0 Link encap:Ethernet HWaddr 02:00:86:77:6a:b0

inet addr:192.168.2.15 Bcast:192.168.2.255 Mask:255.255.255.0

inet6 addr: fe80::86ff:fe77:6ab0/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:5296 errors:0 dropped:0 overruns:0 frame:0

TX packets:3730 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:3045212 (2.9 MiB) TX bytes:531807 (519.3 KiB)

 

wlan0 Link encap:Ethernet HWaddr 78:4b:87:ad:31:95

inet addr:192.168.0.10 Bcast:192.168.0.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:553 errors:0 dropped:0 overruns:0 frame:0

TX packets:1187 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:29532 (28.8 KiB) TX bytes:343779 (335.7 KiB)

  

mailto:root@edison_gfxxxx root@edison_gfxxxx:~# wpa_cli status

Selected interface 'wlan0'

bssid=00:24:d7:6a:03:09 --> PC

ssid=edison_gfxxxx (ad-hoc network: why that ?)

id=0

mode=IBSS

pairwise_cipher=CCMP (*)

group_cipher=CCMP (*)

key_mgmt=WPA2-PSK (*)

wpa_state=COMPLETED

ip_address=192.168.0.10 --> Edison

p2p_device_address=7a:4b:87:ad:31:95

address=78:4b:87:ad:31:95

mailto:root@edison_gfxxxx root@edison_gfxxxx:~#

With this setting works the data exchange, but the PC must be AP. (in this case)

(*) i can't cange this positions

It would be great if i could adjust directly the edison network parameters (for one device, s.a. unix scripts )

I would be glad about help.

Greetings Achim

0 Kudos
Highlighted
Beginner
33 Views

Hi Andres,

For better understanding, I would like to show my goal.

I hope the edison isn't the wrong way.

Greetings Achim

0 Kudos
Highlighted
Community Manager
33 Views

Hello Achim,

 

 

Thank you for the information provided.

 

 

You mentioned that the data exchange is working, but the PC is not configured as an AP yet. What is preventing your PC from being used as an AP? What are you currently using as an AP?

 

 

In the link previously provided (https://communities.intel.com/message/442354# 442354 https://communities.intel.com/message/442354# 442354), it is mentioned that the Edison should be put in AP mode, even if you are using it as an UDP transmitter/receiver.

 

 

Is the access point in Step 3 different from the PC in steps 1 and 2?

 

 

I'll be waiting for your response.

 

 

Regards,

 

Andres
0 Kudos
Highlighted
Beginner
33 Views

Hi Andres,

thanks for your mail.

AP: We must use android tablets with no internet-accsess. That means, that a lot of these devices can't open a hotspot and thus therefore can not be an access point.

Yesterday we corrected our concept. The edison will be the master and AP, the tablet client.

The originally planned ad hoc network is becoming more and more difficult. Normally Android does not support an ad hoc Network, and so is it necessary to make changes.

But the licensing conditions become more stringent.

Now i have set the edison as an AP, the connection to the Android device worked fine.

>> Is the access point in Step 3 different from the PC in steps 1 and 2?

The real device will be a router - this will be connected via a network to a PC.

Really will be a Win PC the AP. -sorry-

Please once more: where is the location of the file 'edison_env' ?

Best regards

Achim

0 Kudos
Highlighted
Community Manager
33 Views

Hello Achim,

Thank you for the information provided.

I understand that you are testing a new setup, with the Edison board as access point, with the Android devices working as clients. You say that this setup is working fine.

Which guide are you following? Is the 'edison_env' file needed for your new AP setup? Have you started the wpa_supplicant to use the wpa_cli (as stated here http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edison_wifi_331438001.pdf http://www.intel.com/content/dam/support/us/en/documents/edison/sb/edison_wifi_331438001.pdf, section 4.2)?

 

This guide may help you find 'edison.env' (under Modifying the source files): http://drejkim.com/blog/2014/11/22/building-an-edison-image-and-changing-the-root-partition-size/ http://drejkim.com/blog/2014/11/22/building-an-edison-image-and-changing-the-root-partition-size/.

I'll be waiting for your response.

Regards,

 

Andres
0 Kudos
Highlighted
Beginner
33 Views

Hello Andres,

thanks for your mail.

For the design of the connection edison <--> android tablet I have used several documents and examples.

The documents you recommended were also helpful.

Here are some snippets: (it's running on my hardware)

(for remembering: simple UDP Connection between Intel Edison and Android tablet, Edison is now AP)

Edison - part ( Eclipse Platform Version: Luna SR2 (4.4.2))

main(int argc, char **argv)

{

struct sockaddr_in myaddr; // edison address

struct sockaddr_in remaddr; // remote address

socklen_t addrlen = sizeof(remaddr); // length of addresses

int recvlen; // bytes received

int serversocket; // socket edison - is server

unsigned char buf[BUFSIZE]; // receive buffer

unsigned char buf2[BUFSIZE]; // sendbuffer

string returnString = "Edison is listening to you"; // return_message

// create a UDP socket

if ((serversocket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {

printf("cannot create socket\n");

return 0;

}

printf("Socket open\n");

// bind the socket

memset((char *)&myaddr, 0, sizeof(myaddr));

myaddr.sin_family = AF_INET;

myaddr.sin_addr.s_addr = inet_addr("192.168.42.1"); // edison IP

myaddr.sin_port = htons(PORT);

if (bind(serversocket, (<sp...

0 Kudos
Highlighted
Community Manager
33 Views

Hello Achim,

 

 

Thank you for the information provided.

 

 

I'm glad you found the documents provided useful.

 

 

Now that I have a better understanding of your setup, are you experiencing any issue? Is there anything I can assist you with? What part of your setup is missing?

 

 

I'll be waiting for your response.

 

 

Regards,

 

Andres
0 Kudos