Page 1 of 1

Arduino + WiFi shield, rubbish in ADC

Posted: Wed Dec 05, 2012 4:54 pm
by strohkopf
Hi! I have problems.

I use your wifi shield http://www.seeedstudio.com/wiki/Wifi_Shield with DFRduino Uno.
I need to send results from some ultra sound/IR detectors that are connected to board's ADCs to my PC via wifi. But! It sends only rubbish when wifi shield is initialized.

My code is:

Code: Select all

#include "Wifly.h"
#include <SoftwareSerial.h>

#define SSID "MyWiFi"
#define PASSWORD "12345678"
#define IP "192.168.137.1"
#define PORT "40020"

#define _W_I_F_I_

WiflyClass Wifly(2,3);
int sensors[6];

void setup()
{
  Serial.begin(9600);//use the hardware serial to communicate with the PC
  
#ifdef _W_I_F_I_
  Wifly.init();//Initialize the wifishield
  Wifly.setConfig(SSID,PASSWORD);//here to set the ssid and password of the Router
  Wifly.join(SSID);
  Wifly.checkAssociated();
  while(!Wifly.connect(IP,PORT));//connect the remote service
  Wifly.writeToSocket("Connected!");
#endif

}

void loop(){
  Serial.print("Sensors:");
  for( int i = 0 ; i < 6 ; i++ ){
    analogRead(i);
    delay(5);
    sensors[i] = analogRead(i);
    Serial.print(sensors[i]);
    Serial.print(", ");
  }
  Serial.println(";");
  delay(30);
}
Rubbish looks like this:

Code: Select all

$$$CMDopen 192.168.137.1 40020
Söý•ÿþ“þ.Ãþ›þ‹þÑþÁþ2

Connect to 192.168.137.1:40020
<2.23> *OPEN*Connected!Sensors:472, 1023, 1019, 1023, 1023, 1023, ;
Sensors:791, 1023, 1019, 1023, 1023, 1023, ;
Sensors:908, 1023, 1020, 1023, 1023, 1023, ;
Sensors:954, 1023, 1019, 1023, 1023, 1023, ;
Sensors:966, 1023, 1020, 1023, 1023, 1023, ;
Sensors:986, 1023, 1019, 1023, 1023, 1023, ;
Sensors:998, 1022, 1020, 1023, 1023, 1023, ;
Sensors:1013, 1023, 1019, 1023, 1023, 1023, ;
Sensors:1014, 1023, 1019, 1023, 1023, 1023, ;
Sensors:1007, 1023, 1018, 1023, 1023, 1023, ;
Sensors:996, 1023, 1019, 1023, 1023, 1023, ;
Sensors:986, 1023, 1019, 1023, 1023, 1023, ;
Sensors:993, 1023, 1019, 1023, 1023, 1023, ;
Sensors:1002, 1023, 1020, 1023, 1023, 1023, ;
Sensors:1016, 1023, 1020, 1022, 1023, 1023, ;
Sensors:1015, 1023, 1020, 1023, 1023, 1023, ;
Sensors:1005, 1023, 1019, 1023, 1022, 1023, ;
Sensors:995, 1023, 1019, 1023, 1023, 1023, ;
Sensors:988, 1022, 1020, 1023, 1023, 1023, ;
Sensors:995, 1023, 1019, 1023, 1023, 1023, ;

And when I remove #define _W_I_F_I_
It works correctly:

Code: Select all

Sensors:131, 131, 32, 65, 55, 42, ;
Sensors:102, 122, 31, 57, 53, 44, ;
Sensors:87, 117, 30, 40, 56, 84, ;
Sensors:69, 109, 31, 39, 63, 114, ;
Sensors:74, 103, 31, 44, 86, 129, ;
Sensors:103, 109, 31, 52, 90, 126, ;
Sensors:114, 111, 31, 65, 84, 86, ;
Sensors:132, 116, 31, 70, 76, 52, ;
Sensors:130, 125, 30, 63, 52, 33, ;
Sensors:97, 116, 31, 57, 48, 35, ;
Sensors:85, 110, 33, 44, 52, 70, ;
Sensors:68, 108, 31, 36, 60, 105, ;
Sensors:66, 99, 32, 43, 79, 125, ;
Sensors:94, 104, 31, 50, 90, 129, ;
In both cases I use ultrasound detector on A2. (Attach a photo to post)

I am sure that the sensor is Ok. So.. What should I do?
Cheers! Anton. Sorry for bad english.

Re: Arduino + WiFi shield, rubbish in ADC

Posted: Thu Dec 06, 2012 11:04 am
by Jacket Chen
Hi,accroding to your said,there maybe something wrong with your wifi:

you can use wifi shield separately,and confirm whether it works well with your PC.And then you need to know the return value of Ultrasonic Ranger, not all messages can sent to PC via wifi shield.

Any problem please let's know.

Re: Arduino + WiFi shield, rubbish in ADC

Posted: Fri Dec 07, 2012 3:20 am
by strohkopf
Hi Jacket, thank you for your reply.
But I am sure that wi-fi works correctly, it sends all data to PC, moreover I have two wi-if shields (for my goals i need two) and they work the same way. So i think it is wifi radio interference or smth like that.

P.S. The data from arduino I put in topic I received via COM port, not via wifi.

Re: Arduino + WiFi shield, rubbish in ADC

Posted: Wed Jan 09, 2013 6:35 pm
by strohkopf
Well... no support from seeed? Why guys? Are you response for your products?

Re: Arduino + WiFi shield, rubbish in ADC

Posted: Thu Jan 10, 2013 3:36 pm
by Jacket Chen
Hi , you said , your Wifi shield is ok , and the data you get from Ultrasonic sensor is ok after you modify its' code, so what else we could help you?

Re: Arduino + WiFi shield, rubbish in ADC

Posted: Thu Jan 17, 2013 6:34 pm
by strohkopf
Yes. WiFi shield works, recieves and transmit data well. Ultra sound sonar works well. But together it work incorrectly.

Today I tied to supply variable resistor to ADC. Photo in attachements.

When the wifi isn't suplied ADC read data corectly. I just increase resistance on my resistor. You can see graph in attachements, everry thing is liner everything is ok. But! When wifi is on and initialized and connected to network. ADC read looks like 2nd graph. I think it is problem in library, maybe it use some port, pins or smth else.

Re: Arduino + WiFi shield, rubbish in ADC

Posted: Fri Feb 08, 2013 1:41 am
by strohkopf
So... any suggestions?