Show Posts
Pages: [1]
1  Using Arduino / Networking, Protocols, and Devices / Re: Arduino WiFi Shield UDP Support on: April 16, 2013, 10:08:38 am
So, after 30 hours of craziness, debug, trial and error, I went directly to show the board to one of the guys of Officine Arduino here in Italy.
And it looks like the shield is defective.
OMG.
smiley
Thanks you all for the support
2  Using Arduino / Networking, Protocols, and Devices / Re: Arduino WiFi Shield UDP Support on: April 15, 2013, 06:30:15 pm
By the way, sorry for the late info but I've realized I'm using a shield with the HDG204 chip
3  Using Arduino / Networking, Protocols, and Devices / Re: Arduino WiFi shield with HDG204 chip. on: April 15, 2013, 06:27:59 pm
I don't know if it's related, but I'm using a Arduino UNO Rev 3, same wifi shield of you, and I don't know if it's working properly.

It connects to the network, but printing out the network info always gives me:

Code:
Attempting to connect to WPA SSID: phwifi
You're connected to the networkSSID: phwifi
BSSID: 0:0:0:0:0:0
signal strength (RSSI):0
Encryption Type:0

IP Address: 192.168.2.6


The ip changes, but all the other infos are always zero.
4  Using Arduino / Networking, Protocols, and Devices / Re: Arduino WiFi Shield UDP Support on: April 15, 2013, 06:17:08 pm
Tim,
about your instructions: when you say to update /Applications/Arduino_104_UDP.app/Contents/Resources/Java/hardware/arduino/firmwares/wifishield/scripts/ArduinoWifiShield_upgrade.sh

should I also update the file
/Applications/Arduino_104_UDP.app/Contents/Resources/Java/hardware/arduino/firmwares/wifishield/scripts/ArduinoWifiShield_upgrade_mac.sh
?

Thanks

5  Using Arduino / Networking, Protocols, and Devices / Re: Arduino WiFi Shield UDP Support on: April 15, 2013, 05:46:23 pm
The ip class has changed from the previously code because I'm trying different networks, sorry about the confusion
About the firmware upgrade, I'm pretty sure I did follow your instructions smiley-sad

I was just reading this interesting post and trying to understand if there are any differences:
http://flashgamer.com/arduino/comments/how-to-update-the-official-arduino-wifi-shield
 
6  Using Arduino / Networking, Protocols, and Devices / Re: Arduino WiFi Shield UDP Support on: April 15, 2013, 05:22:18 pm
Yes, I'm trying to broke apart the problems.

The first thing that looks strange is that I've tried to connect to different routers/networks, and my Arduino always Seruial.prints this networks info:

Code:
Attempting to connect to WPA SSID: phwifi
You're connected to the networkSSID: phwifi
BSSID: 0:0:0:0:0:0
signal strength (RSSI):0
Encryption Type:0

IP Address: 192.168.2.6


where the IP obviosly changes, but the other info are always zero.....
7  Using Arduino / Networking, Protocols, and Devices / Re: Arduino WiFi Shield UDP Support on: April 15, 2013, 03:18:27 pm
hey don't worry it was a joke smiley

About my code: actually I don't have any error, it compiles and run without any issue, but the problem is that the server on the listening machine isn't receiving anything....
Is the initialization of your class correct? Is it right I'm initializing it like this:

Code:
Udp.begin(receiverPort);

...using receiverPort as argument?

Is the composition of the UDP message correct?
Thank you again
8  Using Arduino / Networking, Protocols, and Devices / Re: Arduino WiFi Shield UDP Support on: April 15, 2013, 11:53:25 am
Thanks again for your help.
Your suggestion was already implemented in my code (I'm not THAT noob  smiley-razz )

here goes my code


Code:

#include <WiFi.h>
#include <WiFiUdp.h>
#include <SPI.h>


char ssid[] = "customNet";   // SSID of your network
char pass[] = "customPassword";  // password of your  Network
int status = WL_IDLE_STATUS;     // the Wifi radio's status

IPAddress receiverIP(192, 168, 1, 212); // IP of udp packets receiver
unsigned int receiverPort = 9100;      // port to listen on receiver machine

WiFiUDP Udp;

int firstSensorPin = A0; //define sensor pin
int secondSensorPin = A1;
int thirdSensorPin = A2;
int forthSensorPin = A3;

int firstSensorValue;
int secondSensorValue;
int thirdSensorValue;
int forthSensorValue;

void setup() {
 
  Serial.begin (9600);
 
 // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    status = WiFi.begin(ssid, pass);      // Connect to WPA/WPA2 network:   
    delay(5000);      // wait 5 seconds for connection:
  }
  delay (2000);

  Serial.print("You're connected to the network");
  printCurrentNet(); 
  Udp.begin(receiverPort);
}



void loop() {
 
  firstSensorValue = analogRead(firstSensorPin);
  secondSensorValue = analogRead (secondSensorPin);
  thirdSensorValue = analogRead (thirdSensorPin);
  forthSensorValue = analogRead (forthSensorPin);
 
  byte valueInBytes[8] = {lowByte(firstSensorValue), highByte(firstSensorValue),
                          lowByte(secondSensorValue), highByte(secondSensorValue),
                          lowByte(thirdSensorValue), highByte(thirdSensorValue),
                          lowByte(forthSensorValue), highByte(forthSensorValue)
                         }; //convert it to byte array
 
  Udp.beginPacket(receiverIP, receiverPort); //start udp packet
  Udp.write(valueInBytes, 8); //write sensor data to udp packet
  Udp.endPacket(); // end packet

  delay(10000);
 
}




void printCurrentNet() {
  // print the SSID:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print the MAC address of the router you're attached to:
  byte bssid[6];
  WiFi.BSSID(bssid);   
  Serial.print("BSSID: ");
  Serial.print(bssid[5],HEX);
  Serial.print(":");
  Serial.print(bssid[4],HEX);
  Serial.print(":");
  Serial.print(bssid[3],HEX);
  Serial.print(":");
  Serial.print(bssid[2],HEX);
  Serial.print(":");
  Serial.print(bssid[1],HEX);
  Serial.print(":");
  Serial.println(bssid[0],HEX);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(rssi);

  // print the encryption type:
  byte encryption = WiFi.encryptionType();
  Serial.print("Encryption Type:");
  Serial.println(encryption,HEX);
  Serial.println();
 
  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);
}

9  Using Arduino / Networking, Protocols, and Devices / Re: Arduino WiFi Shield UDP Support on: April 15, 2013, 10:42:54 am
Ok, I've setup a network for my test and now I have the IP address assigned.

Just to be clear: my setup is composed by an Arduino reading 4 sensor and sending their values via UDP packets to a Node.js server. Everything was working fine with my Ethernet shield of course smiley


I had 3 global variables declared:
IPAddress receiverIP(192, 168, 2, 34); // IP of udp packets receiver
unsigned int receiverPort = 9100;      // port to listen on my PC
EthernetUDP Udp;

In my setup I was initializing the EthernetUDP object:

Udp.begin(9100);


...and then I my loop I was reading my sensors and sending them like this:

byte valueInBytes[8] = {lowByte(firstSensorValue), highByte(firstSensorValue),
                          lowByte(secondSensorValue), highByte(secondSensorValue),
                          lowByte(thirdSensorValue), highByte(thirdSensorValue),
                          lowByte(forthSensorValue), highByte(forthSensorValue)
                         }; //convert it to byte array
 
  Udp.beginPacket(receiverIP, receiverPort); //start udp packet
  Udp.write(valueInBytes, smiley-cool; //write sensor data to udp packet
  Udp.endPacket(); // end packet


Now, I'm a n00b and the setup it's getting quite complex for me, but since I switch to your library I don't know how to adapt my code to have everything working.
Any help would be appreciated smiley
10  Using Arduino / Networking, Protocols, and Devices / Re: Arduino WiFi Shield UDP Support on: April 15, 2013, 07:14:26 am
Thx for you super-fast reply
I'm running it, but I just noticed that your sketch is printing me that I don't have the correct IP address....
------
Connected to wifi
SSID: todonet
IP Address: 0.0.0.0
----

any hint?
11  Using Arduino / Networking, Protocols, and Devices / Re: Arduino WiFi Shield UDP Support on: April 15, 2013, 06:46:17 am
Hi Tim and thanks for your awesome work, I've just received my wifi shield today and I'm quite disappointed to find out that all the work done (based on UDP) it's not working smiley-sad
Thanks God I've found this thread.
Just a quick question: has the UDP packet some kind of size limit?
I've followed your instructions, but I'm still not receiving the data I'm expecting....
12  Using Arduino / Audio / Re: Basic Theremin: analogWrite() and tone() commands on the same pin on: February 08, 2012, 06:12:56 pm
ok, thx for your replies.
I didn't mention something important, but maybe you can point me in the right direction. I did a test: instead of reading by the Arduino the voltage setted by the pot and using it to PWM the piezo, I connected directly the + of the piezo to the output of the potentiometer, and it worked. I thought "I'm powering it using the V setted by the potentiometer, so it must be right". And it was working. But how it's possible that's working when on the same time I'm PWM it with the analogWrite commanded by the value of the photoresistor?
13  Using Arduino / Audio / Basic Theremin: analogWrite() and tone() commands on the same pin on: February 08, 2012, 05:51:45 pm
I was trying to build a basic theremin with my Arduino for didactic purpose. My idea was reading a potentiometer for the volume and a photoresistor for the pitch.

My code right now is:

int piezoPin = 5;
 int sensorPin = 1;
 int potPin = 2;

 int sogliaMinima = 20;
 int sogliaMassima = 160;

 void setup () {
   pinMode (piezoPin, OUTPUT);
   Serial.begin (9600);
 }

 void loop () {
  // first block of code working
  int potLevel = analogRead (potPin);
  int levelVolume = map (potLevel, 0, 1022, 0, 170);
  analogWrite (piezoPin, levelVolume);


  // second block of code working
  int sensorValue = analogRead (sensorPin);
  int pitchLevel = map (sensorValue, sogliaMinima, sogliaMassima, 100, 1000);
  tone (piezoPin, pitchLevel);
 }


This is not working, and it's a software issue not a circuit mistake. Both first block and second block are working if commenting one of them, but don't work together. So my question is: can I use tone() and analogWrite on the same pin?
14  Using Arduino / General Electronics / Re: Reading potentiometer from another circuit on: April 11, 2011, 07:44:54 pm
Thx guys,
I was trying to use the AREF pin because it seemed to me that the voltage in which the pedal is operating is not 5 V. When I opened the pedals part, the first stuff I did was testing the voltage of one of the pot. pedals, and I found this 0/2.2 V. I tested the voltage between Vin and the central pin of the pot, that are actually the only pins cabled in the controller (this thing get me very confused)
Sorry guys, I know that this sound confused but I'm getting very tired, here it's almost 3 AM.
Hope you could help me more...
15  Using Arduino / General Electronics / Reading potentiometer from another circuit on: April 11, 2011, 07:20:06 pm
Hi guys,
I've spent the last 5 hours wondering how could solve my problem, hope someone can help me.
I've opened a gamepad controller (steering wheel + pedals), and I would like to read the values of the pedals in my Arduino. They obviously are simple potentiometers powered on by USB.
The question is.... I can read with my multimeter 2.2 Volt output from one potentiometer when the pedal is not pressed. When pressed voltage goes to 0.
I've connected one pin of the pot. to my AREF pin, and the other to an analog pin. I can read values from 10/15 to 1023, but they are behaving quite weirdly. I mean that the analogRead is always almost at 10, I press the pedal and it's not incrementing, then if i keep on pressing it it suddenly jumps to 1023.
Are the connection ok? Is there something that I'm missing? (<- Sure )
Thx guys

Pages: [1]