data transfer from the the WiShield via sockets

Discussion about any of the included sketches (i.e. WebServer), or user-generated applications.

Re: data transfer from the the WiShield via sockets

Postby GregEigsti » Sun Oct 25, 2009 9:47 am

So my guess would be that interrupting every 1 ms + the overhead of the SPI transaction to fetch the data + WiShield's processor needs are enough to make things explode. Can you configure your ADC to interrupt greater than every 1 ms? Does the code that I sent to you, which does not do any SPI transaction(s), work for you?

Greg
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Re: data transfer from the the WiShield via sockets

Postby fdarvas » Sun Oct 25, 2009 3:32 pm

here is the code I can run sofar:

This reads from the ADC (still called every ms). This just reads the values from the adc into a buffer of 40 longs. After 40 ms, it sets a flag, sBuff.

Code: Select all
void read_ad_data()
{
  byte input[4];
  byte instr=192;
  write_ads1210(instr,input,0);
  pinMode(SDIO,INPUT);
  int sclk,D0;
  adc_val= 0;
  for(sclk=(NBIT-1); sclk>=0; sclk--)
  {
    digitalWrite(SCLK,HIGH);
    D0=digitalRead(SDIO);
    if(D0==HIGH)
      adc_val+=pow2[sclk];
    // Serial.print(D0,DEC);
    digitalWrite(SCLK,LOW);
    //Serial.println();
  }
  //Serial.write((unsigned byte*)&adc_val,4);
  if(lenbuff<40)
  {
  buff[lenbuff++]=adc_val;
  }
 
  if(lenbuff>39)
  {
    lenbuff=40;
    sBuff=1;
  }
}


The sending is done here. Basically all it does is, whenever the ADC sets the "buffer ready" alias sBuff flag to 1 and the wishield cares to execute this function, to send the buffer off to the socket, reset the flag and the buffer.

Code: Select all
void socket_app_appcall(void)
{
  /*
   * If a new connection was just established, we should initialize
   * the protosocket in our applications' state structure.
   */
  if(uip_connected()) {
    sock = &(uip_conn->appstate);
  }

  if(uip_closed() || uip_aborted() || uip_timedout()) {
    sock = NULL;
  }
  if(sBuff>0)
  {
    if(uip_poll()) {
      uip_send(buff, lenbuff* sizeof(long));
    }
   lenbuff=0;
   sBuff=0;
}
  /*
  if(uip_acked()) {
   if(lenbuff < uip_mss()) {
   lenbuff = 0;
   memset(buff, 0, 10 * sizeof(long));
   }
   else {
   lenbuff -= uip_mss();
   memmove(buff, buff + uip_mss(), lenbuff);
   uip_send(buff, lenbuff);
   }
   }
   */
}


This works relatively stable and I do get indeed 40 longs on my receiver side. But again, it take 300 ms for the 40 longs or 160 bytes to arrive and so my overall performance again is "magically" reduced to 500 bytes/s. How is that possible? No matter what I do, I wont get more than that.
fdarvas
 
Posts: 29
Joined: Wed Sep 16, 2009 9:44 pm
Location: Seattle

Re: data transfer from the the WiShield via sockets

Postby jaeru » Thu Aug 19, 2010 6:32 am

i know I'm reviving a old post but I'm confuse about the wishield

I thought i could transfer data up to 2Mbps through the wishield because it uses 802.11b protocol.
I would like to know if that is possible because need to transfer video or better say i have to do video streaming.

This is what I'm making. I'm doing a robot for a competition and in the competition rules the robot must transmit video of the camera to the PC. i thought i could use the wishield but it seems wishield doesn't have a high transfer data enough for video streaming.

i would like, if anybody knows, to explain me if i can do that, transfer video using the wishield.

I would appreciate a lot your answers.

Note: sorry for my English errors, English isn't my mother languages.
jaeru
 
Posts: 4
Joined: Fri Jul 09, 2010 12:34 pm

Re: data transfer from the the WiShield via sockets

Postby spidermonkey04 » Thu Aug 19, 2010 6:54 pm

The limiting factor here isn't the wifi chip, but the Arduino itself with it's low memory and speed.
With that said, it IS possible but might be more trouble than its worth.
I've been doing some work with a UART camera, and if I'm REALLY pushing it I might be able to get 5 FPS at 320x240 jpegs. And of course, higher frames per second at a lower resolution. I'm guessing thats not good enough to drive a robot. If you need real time video, around 24fps, then look into other options.
The code can be a bit slow if you need high data rates, but with a little tweaking you can do anything you want. Mine is heavily modified right now but I can send an 800 byte packet every 30 milliseconds or so. So including the TCP overhead, 10Kb/s should be doable.
It all depends on how much work you're willing to put into it...

---Jared
spidermonkey04
 
Posts: 66
Joined: Thu Oct 29, 2009 6:45 pm

Re: data transfer from the the WiShield via sockets

Postby jaeru » Fri Aug 20, 2010 6:16 am

ok

Thanks for the information

i'll keep investigating so i can do what i want to do

Really thanks :D
jaeru
 
Posts: 4
Joined: Fri Jul 09, 2010 12:34 pm

Re: data transfer from the the WiShield via sockets

Postby yba2cuo3 » Wed Nov 10, 2010 8:13 pm

Has anyone tried sending MIDI @ 31250bps via UDP on WiShield?
User avatar
yba2cuo3
 
Posts: 4
Joined: Wed Oct 20, 2010 7:09 am
Location: Ottawa, Ontario

Re: data transfer from the the WiShield via sockets

Postby GregEigsti » Thu Nov 11, 2010 11:55 am

@ 31250bps

The WiShield is capable but you are running on an Arduino which is not a speed demon... There are some threads that contain the highest bps that folks have been able to attain with the WiShield/Arduino.
Check out the wiki!
uIP Stack Docs
Compatible Access Point List
WiShield user contrib branch - DNS, DHCP, AP Scanning, bug fixes, etc.
SlackLab.org - My geek projects blog.
User avatar
GregEigsti
 
Posts: 1067
Joined: Sun Aug 02, 2009 5:23 pm
Location: Sammamish WA USA (near Seattle)
  • Website

Previous

Return to Sketches and Applications

Who is online

Users browsing this forum: No registered users and 1 guest