Page 2 of 2

Re: UDP Communication using WiFly

Posted: Tue Aug 02, 2011 11:04 am
by avidan
thank you for sharing.
do you know if this would make the TouchOSC implementation possible?
are these commands a one time thing, or would we need to send the commands on each boot up?

Re: UDP Communication using WiFly

Posted: Wed Aug 03, 2011 1:31 am
by avidan
thats great info. but what if the device where we are sending the data is an iPhone (with a changing IP).
also, how are you sending the UDP data, using the spark fun library?
any code samples are greatly appreciated.
thanks!

Re: UDP Communication using WiFly

Posted: Wed Aug 03, 2011 4:16 am
by jam60
avidan: see my June 21 post for commands to set up WiFly to receive UDP. Also read that post again to see the issue with receiving OSC commands from iPhone TouchOSC app.

In order to communicate directly between the WiFly and an iPhone, the WiFly is going to have to be the access point. That means the iPhone IP address cannot be "changing". You must configure the iPhone to be on the same network as the WiFly. I can't remember whether the WiFly can be a DHCP server but I think not.

Re: UDP Communication using WiFly

Posted: Thu Feb 16, 2012 3:17 am
by aposada
hello,
any news about this topic?
i want to use touchosc with wifly but i cant receive nothing to my terminal.
My hardware is xbee explorer + wifly

My Wifly configaration is:

IF=UP
DHCP=ON
IP=172.26.0.233:9000
NM=255.255.255.0
GW=172.26.0.6
HOST=172.26.0.46:8001
PROTO=UDP,
MTU=1524
FLAGS=0x7
TCPMODE=0x0
BACKUP=0.0.0.0
<2.28>

i use maxmsp to send UDP packets with udpsend object,
i receive something when i send from serial terminal from wifly to max, but nothing in the other direction!

any ideas?

Re: UDP Communication using WiFly

Posted: Fri Mar 02, 2012 10:48 pm
by waltermixxx
UDP test app for iphone is great at testing sending and receiving datagrams...
it will generate udp datagrams, and will also receive them...

I loaded a blank sketch (the bare minimum) into an arduino with a wireless proto shield (xbee socket) and put my RN-XV in it,
configured it for UDP with a particular ip address and particular port and i was able to use the app to test communication both ways...

the app is free and seems to be pretty cool :)

Re: UDP Communication using WiFly

Posted: Sun Mar 04, 2012 3:30 pm
by waltermixxx
Ardumote is also good :)
check out my posts on the arduino forum, same username :)

http://www.flickr.com/photos/66577016@N00/ flicker pics of the app and project...

http://arduino.cc/forum/index.php/topic,94546.0.html link to forum post :)

cheers :)

Re: UDP Communication using WiFly

Posted: Sat Apr 21, 2012 10:17 am
by blairkelly
Hey everybody, I've been working on a project that relies heavily on two-way UDP packet transfer between Processing and the Wifly.

In short, after putting the Wifly into UDP mode and applying all the other relevant settings, I use this code to fill up the Spi buffer:
Code: Select all
void ptb(char c)
{
  //prints to SpiSerial (fills up the buffer).
  SpiSerial.print(c, BYTE);
}
void fb()
{
  //FLUSH BUFFER (sends buffer contents to host).
  //a carriage return character (hex 0xd) flushes the WIFLYs buffer and sends the msg
  //where FBC is defined as: char FBC = 0xd;  //carriage return.
  SpiSerial.print(FBC, BYTE);
}
Remember to instantiate your SpiSerial object first:
Code: Select all
SpiSerial.begin();
I hope this helps a bit. For a lot of you I'm sure that wouldn't be hard to figure out. It just wasn't obvious to me :)

I go into more detail on my project's blog post:

http://www.blairkelly.ca/2012/04/20/arduino-wifly-mini/


Best regards,

Blair

Re: UDP Communication using WiFly

Posted: Fri Aug 03, 2012 11:50 am
by questionguy
aposada wrote:hello,
any news about this topic?
i want to use touchosc with wifly but i cant receive nothing to my terminal.
My hardware is xbee explorer + wifly

My Wifly configaration is:

IF=UP
DHCP=ON
IP=172.26.0.233:9000
NM=255.255.255.0
GW=172.26.0.6
HOST=172.26.0.46:8001
PROTO=UDP,
MTU=1524
FLAGS=0x7
TCPMODE=0x0
BACKUP=0.0.0.0
<2.28>

i use maxmsp to send UDP packets with udpsend object,
i receive something when i send from serial terminal from wifly to max, but nothing in the other direction!

any ideas?
Do you know how to set IF=UP, I have not been able to find out how and find any documentation on it in the datasheet

Re: UDP Communication using WiFly

Posted: Tue Aug 14, 2012 1:02 pm
by INGAme
Hey Guys,

this is my first post. As to the last post: I think the simple answer is you can't! As well as you can't set the MTU, for example. (This setting isn't even shown in the Default Settings part of the Datasheet). But the current settings should already show IF=UP. Just issue the 'get ip' command and have a look.


I have another Question about UDP Communication. We're using the WiFly together with a self-created sensor node called INGA and are building a game controller (like the upcoming Wii U controller) that has not only the usual D-Pad and gyro and accelerometer. You can integrate your smartphone (android) into the controller and have a touchscreen for your game. With a library we provide, games can stream video (in realtime!) to this second screen. (Like it is the case in the Wii U Controller).

As we have our own Sensor Node in the controller, we have data from a gyro, accelerometer, temperature, pressure (ok the last two are not really necessary for gaming) and an IR-Cam (disassambled from a WiiMote) that can track up to four ir lightsources.

All together this counts up to 46 Bytes (including a small header) we want to send to the host system (let's say the PC).

We are able to send Packets over UDP, but every 10th to 20th msg doesn't take 15ms to be sent like the other messages but about 350ms.
Now my Question: Has anyone tried sending UDP packages and has evaluated how long it takes to send these messages? I mean have you for example counted the number of packages you were able to send in one second or more important how much time it takes between two messages?

I would be very interested in your results!

Thanks!

(By the way, I'm not an native speaker of the english language, so please forgive me any mistakes in the above text)

Re: UDP Communication using WiFly

Posted: Thu Aug 23, 2012 11:32 am
by questionguy
I have been using a WiFly for about one week transferring data via UDP communication. However, recently, the WiFly has been unable to connect in infrastructure mode and receive data. I have been using a sample UDP Server sketch that was posted earlier on this forum. Here are the symptoms:

- WiFly's green LED blinks fast unable to connect to valid IP Address on network.
- WiFly connects to valid IP Address only to disconnect once I open the Serial monitor for Arduino
- WiFly turns DHCP on and sets an IP address of 192.168.1.5 after I upload the UDP Server sketch and only after I upload this sketch.

The WiFly had been working earlier and I am unsure of what could be occurring, whether it is going to default settings or not, but I have not found anything in the datasheet. Any help would be appreciated.
Code: Select all
#include "WiFly.h"
#include "Credentials.h"
#include "SPI.h"


WiFlyServer server(7778);

void setup() {
  WiFly.begin();

  if (!WiFly.join(ssid, passphrase)) {
    while (1) {
      // Hang on failure.
    }
  }

  Serial.begin(9600);
  Serial.print("IP: ");
  Serial.println(WiFly.ip());
  
  server.begin();
}

void loop() {
  WiFlyClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        /*(char c = client.read();
        Serial.print(c);*/
        
         Serial.println("");
       char c;
    }
    client.stop();
  }
}