Daten mit Arduino+WebInterface an SQL Server senden

Hallo.
Ich habe folgenden Code um Wetterdaten, die der Arduino mittels 433MHz Empfänger von meinen Wettersensoren empfängt und darstellt, sowie von einem
BMP085 zusätztiche Daten, dann an einen SQL Server sendet (Freier Server kein Zugang von Extern an Datenbank)
Die Daten werden mittels GET Verkettung im URL gesendet.
Wenn ich die Daten von Hand sende, trägt das PHP Skript die ein, aber wenn der Arduino sendet kommt nichts an.
Zugang zum Server wird bestätigt: Arduino sendet Daten, aber wo kommen die an?

Hier der Code (Zugangsdaten sind mit xxx )

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,2, 77 };
byte server[] = { XXX,XXX,XXX,XXX};   
Client client(server, 80);
char host[] = "xxx.funpic.de";
char url[]  = "/daten.php";	
#include "WeatherStationReceiver.h"
#include <Wire.h>

//-----------------------------------------------------------------------------------------------------------
// Comment out what you don't want

#define BAROMETER_SENSOR // uncomment only if you have bmp085 barometer sensor in your arduino weather station
//#define DEBUG  // uncomment for retrive debub info (it must have even serialog uncommented)
#define SERIALOG

// Timer 1 Input capture period and captured event time detection
uint uiICP_CapturedTime;
uint uiICP_PreviousCapturedTime;
uint uiICP_CapturedPeriod;
uint uiICP_PreviousCapturedPeriod;
uint ui_Nibbles;
byte bICP_CapturedPeriodWasHigh;
byte bICP_PreviousCapturedPeriodWasHigh;
unsigned long ulICP_Timestamp_262_144mS;

//----------
int iByte = 0; // incoming data packet
//----------

//----------
byte bICP_DEA_IsFirstByte;
byte bICP_DEA_State;                                 //Interpreter state machine
byte bICP_DEA_PacketData[WSR_PACKETARRAYSIZE][4+5];  //incoming RF packet data with 4 byte timestamp at start, already bit reversed to suit.
//main array size must be ^2, and there may be some other count dependencies in the interpreter.
byte bICP_WSR_PacketInputPointer;           //
byte bICP_WSR_PacketOutputPointer;          //
byte bICP_WSR_PacketInputBitPointer;        //
uint uiICP_WSR_ReceivedPacketCount;         //
//----------
// Saved timestamp at packet receive conversion
unsigned long ulWSR_LastTimestamp_262_144mS;
//----------
// Real world data, latest received and converted by Packet_Converter_DEA(), Ventus, clone
byte bWSR_StationTransmitterID;         //
byte bWSR_LastStationTransmitterID;
static byte bDEA_CurrentSensorType;
sint siWSR_CurrentTemperature;          //
byte bWSR_CurrentHumidity;              //
long bWSR_CurrentWindDirection;         //
uint uiWSR_CurrentWindSpeed_m_per_sec;  //
uint uiWSR_RainfallCount;               //
uint uiWSR_PreviousRainfallCount;       //
byte b_CurrentBattStatus;
unsigned long ulWSR_Rainfall_mm_x10;
byte bIsSolarData;

byte bPacketChecksum;
//----------
const char strWindDirection[16][4] = 
{
  "N  ", "NNO", "NO ", "ONO",
  "O  ", "OSO", "SO ", "SSO",
  "S  ", "SSW", "SW ", "WSW",
  "W  ", "WNW", "NW ", "NNW"
};

typedef struct {
  unsigned long TimeStamp;
  uint Press;
  sint Temp[3];
  byte Hr[3];
  byte Tbat[3];
  uint wdir;
  uint avgwspeed;
  uint gstwspeed;
  byte battW;
  uint rain;
  uint SolarRad;
  byte isfully;
} 
weather_packet;

weather_packet W_Packet;

const unsigned char OSS = 0;  // Oversampling Setting
// Calibration values
int ac1;
int ac2; 
int ac3; 
unsigned int ac4;
unsigned int ac5;
unsigned int ac6;
int b1; 
int b2;
int mb;
int mc;
int md;

// b5 is calculated in bmp085GetTemperature(...), this variable is also used in bmp085GetPressure(...)
// so ...Temperature(...) must be called before ...Pressure(...).
#ifdef BAROMETER_SENSOR
long b5; 
short temperature;
long pressure;
#endif

//Initial configuration
void setup(void)
{
 Ethernet.begin(mac, ip);
  Wire.begin();

#ifdef SERIALOG
 Serial.begin( 57600 );
  Serial.println( "Empfang gestartet. Bitte warten...." );
#endif

  Init_Ports();
  Init_RF_Interpreters();

#ifdef BAROMETER_SENSOR
  bmp085Calibration();
#endif

  interrupts();   // Enable interrupts (NOTE: is this necessary? Should be enabled by default)


  uiWSR_PreviousRainfallCount=0;
}

/**
 * Main program loop
 */
void loop(void)
{
  if (client.available()) 
  {
    char c = client.read();
    Serial.print(c);
  }
  delay(10000);
    client.stop();
    client.flush();
#ifdef BAROMETER_SENSOR
          temperature = bmp085GetTemperature(bmp085ReadUT());
          pressure = bmp085GetPressure(bmp085ReadUP());
          W_Packet.Press=(uint)(pressure);
#endif
   
       [color=red][font=Verdana] if (client.connect())  // Verbindung zum Server aufbauen 
          {
           Serial.print("Verbunden...sende Daten...");
    client.print("GET /daten.php?T=");
    client.print(temperature/10, DEC);
    client.print( '.', BYTE );
    client.print(temperature%10, DEC);
    client.print("&D=");
    client.print(pressure/100+3, DEC);
    client.print( '.', BYTE );
    client.print(pressure%100, DEC);
    client.print("&R=");
    client.print(uiWSR_RainfallCount/4, DEC );
    client.print( '.', BYTE );
    client.print(uiWSR_RainfallCount%4, DEC );
    client.print("&A=");
    client.print(siWSR_CurrentTemperature/10, DEC );
    client.print( '.', BYTE );
    client.print(siWSR_CurrentTemperature/10, DEC );
    client.print("&H=");
    client.print(bWSR_CurrentHumidity, DEC );
    client.print("&DW=");
    client.print(W_Packet.avgwspeed/5, DEC );
    client.print( '.', BYTE );
    client.print(W_Packet.avgwspeed%5, DEC );
    /*client.print("&RWIN=");
    client.println(strWindDirection[int(bWSR_CurrentWindDirection/22.5)]);*/
    client.print("&BW=");
    client.print(W_Packet.gstwspeed/5, DEC );
    client.print( '.', BYTE );
    client.print(W_Packet.gstwspeed%5, DEC );
    client.println(" HTTP/1.1");
    client.print("Host: 213.202.225.65");
    client.println();
    Serial.println("fertig!");
 Serial.print("GET /daten.php?T=");
    Serial.print(temperature/10, DEC);
    Serial.print( '.', BYTE );
    Serial.print(temperature%10, DEC);
    Serial.print("&D=");
    Serial.print(pressure/100+3, DEC);
    Serial.print( '.', BYTE );
    Serial.print(pressure%100, DEC);
    Serial.print("&R=");
    Serial.print(uiWSR_RainfallCount/4, DEC );
    Serial.print( '.', BYTE );
    Serial.print(uiWSR_RainfallCount%4, DEC );
    Serial.print("&A=");
    Serial.print(siWSR_CurrentTemperature/10, DEC );
    Serial.print( '.', BYTE );
    Serial.print(siWSR_CurrentTemperature/10, DEC );
    Serial.print("&H=");
    Serial.print(bWSR_CurrentHumidity, DEC );
    Serial.print("&DW=");
    Serial.print(W_Packet.avgwspeed/5, DEC );
    Serial.print( '.', BYTE );
    Serial.print(W_Packet.avgwspeed%5, DEC );
    /*Serial.print("&RWIN=");
    Serial.println(strWindDirection[int(bWSR_CurrentWindDirection/22.5)]);*/
    Serial.print("&BW=");
    Serial.print(W_Packet.gstwspeed/5, DEC );
    Serial.print( '.', BYTE );
    Serial.print(W_Packet.gstwspeed%5, DEC );
    Serial.println(" HTTP/1.1");
    Serial.print("Host: 213.202.225.65");
    Serial.println();
          }
          
       else
  {
    Serial.println(" ***** VERBINDUNGSAUFBAU NICHT MÖGLICH *****");
      
      
  }
  client.stop();
 while(client.status() != 0)
{
  delay(5000);
....

Könnte sein dass Du nach dem Header noch eine leere Zeile senden musst...?

Hallo.

Es ist eine leere Zeile drin: client.print(W_Packet.gstwspeed%5, DEC ); client.println(" HTTP/1.1"); client.print("Host: 213.202.225.65"); client.println(); oder meintest du die Stelle nicht. Ich bin absoluter Anfänger bei PHP+Arduino!

Nein, die Host-Zeile schickt keinen Zeilenumbruch, da fehlt das "ln".

Getestet und das war es!!! Oh mein Gott. Fast 3 Wochen rumprobiert mit diversen Büchern usw. Und so eine einfach Sache!!!

Super Vielen Dank!!!

Kein Problem. :wink: