Arduino + WiFi shield, rubbish in ADC

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]#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);
}[/code]

Rubbish looks like this:

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

Connect to 192.168.137.1:40020
<2.23> OPENConnected!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, ;
[/code]

And when I remove #define W_I_F_I
It works correctly:

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.
DSC00055.JPG

1 Like

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.

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.

Well… no support from seeed? Why guys? Are you response for your products?

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?

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.
table with wifi.png
table without wifi.png
DSC00062.JPG

So… any suggestions?