-
Update
11/30/2016 at 22:52 • 0 commentsI have now some new choices:
- Find out how to call a https page with the ESP8862
- Find a way to tell my webserver to call the https Page for me (until now no luck)
- Create an Android App and an Webapp using FireBase and VS Studio 2015
- - Find a way to teach the ESP8862 XMPP Protocoll or find a way to translate it to.
- Just give up
-
First almost useful ESP8266 Testapplication
11/23/2016 at 21:11 • 1 commentGreatly Inspired by #ESP8266 Retro Browser I have rewritten my sketch a bit :)
/* Software serial With ESP 8266 Test Tested with Arduino Uno Autor: Stefan-Xp @ HackADay.io +++ ESP8266 ++ D10 --> ESP8266 TX D11 --> ESP8266 RX +++ Input +++ A0 --> Button --> Ground +++ Output +++ // Status LEDs tbd */ #include <SoftwareSerial.h> // Access Point #define SSID "tbd" #define PASS "0123456789" // My luggage has the same combination! // General Defines #define TIMEOUT 5000 // ~ms #define SERVER_IDENTIFIER "useYourOwn;-)" // I/O Defines #define SWITCH_PIN A0 SoftwareSerial mySerial(10, 11); // RX, TX ; SoftwareSerial for ESP8266 char charbuffer[255]; // Characterbuffer for incoming Data int inCount; // Count of incoming Data Bytes boolean sendHTTPRequest(String Parameter); // Function for sendingHTTPRequest void setup() { // Open serial communications and wait for port to open: Serial.begin(19200); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } // set the data rate for the SoftwareSerial port for ESP8266 mySerial.begin(9600); // Perhapps you need to Adjust the Baudrate at the ESP8266! Serial.print("Ready for commands!\r\n"); // This is one Input Pin pinMode(SWITCH_PIN, INPUT_PULLUP); } void loop() // run over and over { byte inputChar, rndCount; String OutPutParameter; int iCount; /* Maybe there should be regular checks if the ESP8266 is still connected or something... */ // This reads the Data as long as there are some available while (mySerial.available()>0) { inputChar = mySerial.read(); charbuffer[inCount] = inputChar; // If there is a new line, there shall also be a new row if(inputChar == '\n') { inCount++; charbuffer[inCount] = '\r'; } inCount++; // Print if buffer is full if(inCount > 254) { Serial.print(charbuffer); inCount = 0; while (inCount > 0) { // clear buffer inCount--; charbuffer[inCount] = 0; } } } // If there are some Datas in the Buffer, print them now. if(inCount > 0) { Serial.print(charbuffer); inCount = 0; while (inCount > 0) { // clear buffer inCount--; charbuffer[inCount] = 0; } } // If there are commands via Serial... if (Serial.available()) switch(Serial.read()) { case '?': Serial.print("Request Status ... "); mySerial.print("AT+CIPSTATUS\r\n"); break; case 's': // Send Testdata OutPutParameter = "/ESP_Test/Test.php?info=RandomNumber%20"; OutPutParameter += random(1000); OutPutParameter += "<br>"; sendHTTPRequest(OutPutParameter); } // If Button is pressed, send on release.. if(digitalRead(SWITCH_PIN) == LOW) { while(digitalRead(SWITCH_PIN) == LOW) rndCount++; OutPutParameter = "/ESP_Test/Test.php?info=RandomNumber%20by%20Button:%20"; OutPutParameter += rndCount; OutPutParameter += "<br>"; sendHTTPRequest(OutPutParameter); } } // This Function waits as long as the desired String is received boolean waitForString(String myString) { int TimeOut = 0; byte checkNumber = 0; Serial.print("Waiting for String " + myString + " ... "); // Do this until TimeOut while (TimeOut < TIMEOUT) { if(mySerial.available()>0) { // Check every Character of myString if(mySerial.read() == myString[checkNumber]) { checkNumber++; if(checkNumber >= myString.length()) { // Pass - ALL Characters were found return true; } } } else { delay(1); TimeOut++; } } return false; } // This function sends a HTTP Request with specific parameters boolean sendHTTPRequest(String Parameter) { Serial.println("Sending HTTP Request..."); String cmd, cmd2; // Contact the Server cmd = "AT+CIPSTART=\"TCP\",\""; cmd += SERVER_IDENTIFIER; cmd += "\",80\r\n"; mySerial.print(cmd); delay(100); // Check if "ok" if(waitForString("ok") == false) return false; else Serial.println("pass"); // Build Command to be sent to the Server cmd = "GET "; cmd += Parameter + " HTTP/1.1\r\nHost: "; cmd += SERVER_IDENTIFIER; cmd += ":80\r\n\r\n"; // Tell the ESP8266 to listen to Data cmd2 = "AT+CIPSENDBUF="; cmd2 += cmd.length() ; cmd2 += "\r\n"; mySerial.print(cmd2); // Now wait for > if(waitForString(">") == false) return false; else Serial.println("pass"); // Send Request mySerial.print(cmd); // Maybe a check should be here to check if the Data was transfered sucessfully. } // Connect to the specified wireless network. // To do: Implement a StatusLED for Connection State. // To do: Test This. boolean connectWiFi() { Serial.print("WifiNetwork Connect ... "); String cmd = "AT+CWJAP=\""; cmd += SSID; cmd += "\",\""; cmd += PASS; cmd += "\""; // Check if "ok" if(waitForString("ok") == false) { Serial.println(" fail"); return false; } else { Serial.println(" pass"); } return true; }
The Code is a bit bigger now... i think nothing for the 1k Contest :-P
And here is the Code in the PHP Page:
<?php $inhalt = $_GET['info'] . "\n\r"; $handle = fopen ("Result.html", a); // Attach fwrite ($handle, $inhalt); fclose ($handle); echo "Write: " . $inhalt . "Success" ?>
And also the Result.htm:
RandomNumber 807<br> RandomNumber 249<br> RandomNumber 807<br> RandomNumber by Button: 208<br> RandomNumber by Button: 73<br> RandomNumber by Button: 2<br> RandomNumber 807<br> RandomNumber 807<br> RandomNumber by Button: 99<br> RandomNumber 807<br> RandomNumber 249<br> RandomNumber 73<br> RandomNumber 807<br> RandomNumber 249<br>
Did you notice, that you get the same Random Numbers every Time the Arduino reboots? :-DThe next steps are:
- Adding at least 2 Status LEDs (Connection State, Request State)
- Exchanging Softwareserial for Serial
- Add the SoftwareSerial for the BOSS Swissphone Pager
- Check the Webinterface of http://www.Divera247.com
- Develop an Algorithm to Get a Useful AlertMessage.
- Solder together an Hardware incarnation of this Device ;-)
I hope you enjoyed this writeup and comments are always apreciated!
-
Well now it's working
11/23/2016 at 00:08 • 1 commentWow it is some kind of addictive ;)
This is the latest Code:
/* Software serial multple serial test */ #include <SoftwareSerial.h> SoftwareSerial mySerial(10, 11); // RX, TX char charbuffer[255]; int inCount; void setup() { // Open serial communications and wait for port to open: Serial.begin(19200); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } // set the data rate for the SoftwareSerial port mySerial.begin(9600); Serial.print("Ready for commands \r\n"); } void loop() // run over and over { byte inputChar; int iCount; while (mySerial.available()>0) { inputChar = mySerial.read(); charbuffer[inCount] = inputChar; // If there is a new line, there shall also be a new row if(inputChar == '\n') { inCount++; charbuffer[inCount] = '\r'; } inCount++; // Print if buffer is full if(inCount > 250) { Serial.print(charbuffer); inCount = 0; while (inCount > 0) { inCount--; charbuffer[inCount] = 0; } } } if(inCount > 0) { Serial.print(charbuffer); inCount = 0; while (inCount > 0) { inCount--; charbuffer[inCount] = 0; } } if (Serial.available()) switch(Serial.read()) { case '?': Serial.print("Send At..."); mySerial.print("AT+CIPSTATUS\r\n"); break; case '1': Serial.print("Send At..."); mySerial.print("AT+CIPSTART=\"TCP\",\"retro.hackaday.com\",80\r\n"); break; case '2': Serial.print("Send At..."); mySerial.print("AT+CIPSENDBUF=48\r\n"); break; case '3': Serial.print("Send At..."); mySerial.print("GET / HTTP/1.1\r\nHost: retro.hackaday.com:80\r\n\r\n"); break; case '5': Serial.print("Send At..."); mySerial.print("+IPD,100\r\n"); break; }
Still not that pretty but it works more or less if you send 1,2,3,5 :-D
It seems there are still some characters missing... but it is already to late for "today".
BTW: After i increased the Baudrate of mySerial, i got less missing characters.
I think somebody who is more experienced will find this code a piece of crap. Sorry for this.
-
How it is not working
11/22/2016 at 21:47 • 5 commentsI tested this Program:
/* Software serial test */ #include <SoftwareSerial.h> SoftwareSerial mySerial(10, 11); // RX, TX char charbuffer[255]; int inCount; void setup() { // Open serial communications and wait for port to open: Serial.begin(115200); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } // set the data rate for the SoftwareSerial port mySerial.begin(115200); } void loop() // run over and over { byte inputChar; int iCount; if (mySerial.available()>0) { inputChar = mySerial.read(); charbuffer[inCount] = inputChar; inCount++; } if (Serial.available()) switch(Serial.read()) { case '?': Serial.print("Send At..."); mySerial.print("AT\n\r"); break; case '!': Serial.print(charbuffer); while (inCount > 0) { charbuffer[inCount] = 0; inCount--; } break; } }
Result:
--> ? <-- Send At... --> ! <-- AªCQÔ¤*IIOR†…
Too bad.. -
Hello ESP8266
11/21/2016 at 22:15 • 11 commentsToday i got first contacts between ESP8266 and Arduino Uno.
One Major drawback is, that the tx/rx is occupied by the ESP8266.
So once you can't really see whats going on and second you can't flash the Arduino when connected.
I added the EA DOG Shield to my Arduino to get some Response from the communication.
But viewed from now it is still some way to go.
I wonder if it is normal, that the ESP8266 gets hot.... i used the Schematic like from the ESP Breakoutboard.
BTW: Don't connect USB+ and Voltages > 5V together... PC did't like it (Rebootet) but i hope no further damage is happened.
-
ESP8266 and Arduino Uno still don't want to play
11/20/2016 at 21:45 • 0 commentsAs begun with https://hackaday.io/project/2746-furious-tooth-fairy-door-unlock/log/49242-time-for-a-update/discussion-69901
I still have some plans for this project.
- Get the Data of the alarm message from the dme. [done with Software Serial and a small circuit]
- Set up the ESP
- Connect via FTDI 3.3V Cable ==> works
- Connect to Arduino UNO TX and RX ==> Do i need to switch RX and TX when using the Terminal versus when using the Uno?
- Connect to Software Serial ==> Don't work properly .. Echo works, Responses get scrambled.. See below code (Mostly from Example) [1]
- Tell the ESP to call a specific Website with specific received data (not begun)
#include <SoftwareSerial.h> SoftwareSerial mySerial(10, 11); // RX, TX void setup() { // Open serial communications and wait for port to open: Serial.begin(115200); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } Serial.println("Goodnight moon!"); // set the data rate for the SoftwareSerial port mySerial.begin(115200); mySerial.println("AT"); } void loop() // run over and over { if (mySerial.available()) Serial.write(mySerial.read()); if (Serial.available()) mySerial.write(Serial.read()); }
Hmm.. maybe tomorrow i get some enlightment.
-
The 7x5 Dot Matrix LED Prototype...
10/22/2015 at 20:47 • 0 commentsSo it's time to give away my prototype (I need more space) It goes to a good friend.
So you get the Pictures of the Prototype of https://hackaday.io/project/3099/log/14142-the-7x5-dot-matrix-display
It is a 4 Layer PCB ;-) ...
Toplayer:
Layer 1:Layer 2:Bottom Layer:
I think with a bit of chasing it would make a nice piece of art :-) -
Well well ;-)
09/16/2015 at 21:23 • 3 commentsIt looks like the Alarmierungsuhr is going to get a little Sister.
I take some of the left over PCBs and build a Clock with will go into family with my FB 7S Clock :-)
Nice Paint Job isn't it? ;)
-
Already well done :-D
08/21/2014 at 20:15 • 0 commentsI have to admit, that i almost finished the project before starting this HAD-Project ;-)
Please enjoy my Video:
Step by Step I will add a few more informations.