Hi Mike
It got stuck today at 17:09:45. This was the last request time phpmyadmin recorded.
The last bits of the access log:
Code: Select all
192.168.0.101 - - [08/Feb/2014:17:07:36 +0000] "GET /submit.php?temp=19&hum=48 HTTP/1.0" 200 1862
laptop1 - - [08/Feb/2014:17:07:53 +0000] "GET /phpmyadmin/index.php?ajax_request=1&recent_table=1&token=d12e7bdbf94a622036d43d7e942019b4 HTTP/1.1" 200 236
192.168.0.101 - - [08/Feb/2014:17:07:55 +0000] "GET /submit.php?temp=19&hum=48 HTTP/1.0" 200 1862
192.168.0.101 - - [08/Feb/2014:17:08:14 +0000] "GET /submit.php?temp=19&hum=48 HTTP/1.0" 200 1862
192.168.0.101 - - [08/Feb/2014:17:08:32 +0000] "GET /submit.php?temp=19&hum=48 HTTP/1.0" 200 1862
192.168.0.101 - - [08/Feb/2014:17:08:51 +0000] "GET /submit.php?temp=19&hum=48 HTTP/1.0" 200 1862
192.168.0.101 - - [08/Feb/2014:17:09:10 +0000] "GET /submit.php?temp=19&hum=48 HTTP/1.0" 200 1862
192.168.0.101 - - [08/Feb/2014:17:09:28 +0000] "GET /submit.php?temp=19&hum=48 HTTP/1.0" 200 1862
laptop1 - - [08/Feb/2014:17:28:14 +0000] "GET /phpmyadmin/index.php?token=d12e7bdbf94a622036d43d7e942019b4 HTTP/1.1" 200 45428
laptop1 - - [08/Feb/2014:17:28:14 +0000] "GET /phpmyadmin/themes/pmahomme/jquery/jquery-ui-1.9.2.custom.css HTTP/1.1" 304 -
laptop1 - - [08/Feb/2014:17:28:14 +0000] "GET /phpmyadmin/themes/pmahomme/img/logo_left.png HTTP/1.1" 304 -
laptop1 - - [08/Feb/2014:17:28:14 +0000] "GET
Last bits of the error log:
Code: Select all
[Sat Feb 08 17:08:49.552243 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2360] PHP 1. {main}() C:\\wamp\\www\\submit.php:0
[Sat Feb 08 17:09:08.205310 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2361] PHP Notice: Undefined index: light in C:\\wamp\\www\\submit.php on line 19
[Sat Feb 08 17:09:08.205310 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2361] PHP Stack trace:
[Sat Feb 08 17:09:08.205310 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2361] PHP 1. {main}() C:\\wamp\\www\\submit.php:0
[Sat Feb 08 17:09:08.205310 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2361] PHP Notice: Undefined index: smc in C:\\wamp\\www\\submit.php on line 20
[Sat Feb 08 17:09:08.205310 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2361] PHP Stack trace:
[Sat Feb 08 17:09:08.205310 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2361] PHP 1. {main}() C:\\wamp\\www\\submit.php:0
[Sat Feb 08 17:09:26.842376 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2362] PHP Notice: Undefined index: light in C:\\wamp\\www\\submit.php on line 19
[Sat Feb 08 17:09:26.842376 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2362] PHP Stack trace:
[Sat Feb 08 17:09:26.842376 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2362] PHP 1. {main}() C:\\wamp\\www\\submit.php:0
[Sat Feb 08 17:09:26.842376 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2362] PHP Notice: Undefined index: smc in C:\\wamp\\www\\submit.php on line 20
[Sat Feb 08 17:09:26.842376 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2362] PHP Stack trace:
[Sat Feb 08 17:09:26.842376 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2362] PHP 1. {main}() C:\\wamp\\www\\submit.php:0
[Sat Feb 08 17:09:45.465441 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2363] PHP Notice: Undefined index: light in C:\\wamp\\www\\submit.php on line 19
[Sat Feb 08 17:09:45.465441 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2363] PHP Stack trace:
[Sat Feb 08 17:09:45.465441 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2363] PHP 1. {main}() C:\\wamp\\www\\submit.php:0
[Sat Feb 08 17:09:45.465441 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2363] PHP Notice: Undefined index: smc in C:\\wamp\\www\\submit.php on line 20
[Sat Feb 08 17:09:45.465441 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2363] PHP Stack trace:
[Sat Feb 08 17:09:45.465441 2014] [:error] [pid 2940:tid 1520] [client 192.168.0.101:2363] PHP 1. {main}() C:\\wamp\\www\\submit.php:0
[Sat Feb 08 17:29:05.760806 2014] [:error] [pid 2940:tid 1532] [client 192.168.0.101:2366] PHP Notice: Undefined index: light in C:\\wamp\\www\\submit.php on line 19
[Sat Feb 08 17:29:05.760806 2014] [:error] [pid 2940:tid 1532] [client 192.168.0.101:2366] PHP Stack trace:
I'm using this code now:
/*
* DigiPlant arduino sketch
* Rev 1.0 06/02/2014
*/
// Include required libraries
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <string.h>
#include "utility/debug.h"
#include "DHT.h"
#include<stdlib.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
// Define CC3000 chip pins
#define ADAFRUIT_CC3000_IRQ 3
#define ADAFRUIT_CC3000_VBAT 5
#define ADAFRUIT_CC3000_CS 10
// WiFi network settings
#define WLAN_SSID "TP-LINK AP"
#define WLAN_PASS "password"
#define WLAN_SECURITY WLAN_SEC_WPA2
// DHT11 & I2C LCD configuration
#define DHTPIN 2
#define DHTTYPE DHT11
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
// Create CC3000 & DHT instances
DHT dht(DHTPIN, DHTTYPE);
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT, SPI_CLOCK_DIV2);
// Local server IP, port, and repository
uint32_t ip = cc3000.IP2U32(192,168,0,100);
int port = 80;
String repository = "/";
// Setup routine
void setup(void)
{
lcd.begin(16,2);
// Initialize DHT sensor
dht.begin();
Serial.begin(115200);
lcd.setCursor(0, 0);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(F("Initialising..."));
// Initialise the CC3000 module
if (!cc3000.begin())
{
while(1);
}
lcd.setCursor(0,1);
lcd.clear();
lcd.print(F("Connecting..."));
// Connect to WiFi network
cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY);
Serial.println("Connected to AP!");
// Check DHCP
Serial.println(F("Request DHCP"));
while (!cc3000.checkDHCP())
{
delay(100);
}
lcd.setCursor(0,1);
lcd.clear();
lcd.print(F("Connected!"));
}
void loop(void)
{
// Measure the humidity & temperature
float h = dht.readHumidity();
float t = dht.readTemperature();
// Print humidity & temperature on LCD display
if (isnan(t) || isnan(h)) {
lcd.setCursor(0, 0);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(F("No data!"));
}
else {
lcd.setCursor(0, 0);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(F("Current values:"));
lcd.setCursor(0,1);
lcd.print(t, 1);
lcd.print(F("C"));
lcd.print(F(" "));
lcd.print(h, 1);
lcd.print(F("%"));
}
// Transform to String
String temperature = String((int) t);
String humidity = String((int) h);
// Print data
Serial.print("Temperature: ");
Serial.println(temperature);
Serial.print("Humidity: ");
Serial.println(humidity);
Serial.println("");
// Send request
String request = "GET "+ repository + "submit.php?temp=" + temperature + "&hum=" + humidity + " HTTP/1.0";
send_request(request);
// Update every second
delay(1000);
}
// Function to send a TCP request and get the result as a string
void send_request (String request) {
// Connect
Serial.println("Starting connection to server...");
Adafruit_CC3000_Client client = cc3000.connectTCP(ip, port);
// Send request
if (client.connected()) {
client.println(request);
client.println(F(""));
Serial.println("Connected & Data sent");
}
else {
Serial.println(F("Connection failed"));
}
while (client.connected()) {
while (client.available()) {
// Read answer
char c = client.read();
}
}
Serial.println("Closing connection");
Serial.println("");
client.close();
}
What's interesting is that when it gets stuck the LCD display shows "Initialising..." which would suggest that the arduino has gone to the beginning of the setup fuction?
Hope this helps shed some light on the issue. It seems totally random when it cuts out. Some days it can go for ours, others it can do just 4 requests.
Thanks for your help