Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By kas
#22763 This simple App can switch a light bulb or any appliance from anywhere in the world, using an Android smartphone

Image
to implement the project first start using a standard PC MQTT client to drive MQTTled.ino demo sketch


The demo esp8266 board

Image
Setup the Hardware :
- One button from GPIO2 to Ground
- One led + resistor from GPIO0 to Ground
- Pull Up CH-PD pin

Upload MQTT_led_V1.06 demo sketch to the esp8266, (attached file below)
make sure you use your own router username and pass
Code: Select allconst char* ssid = "Livebox-27C2";                    // Your specific WiFi network credentials
const char* pass = "23456789";

const char* serverURI = "m20.cloudmqtt.com";          //  Your specific MQTT broker parameters
const uint16_t port =    18084;
const char* user_name = "uqkfcjrz";
const char* password =  "+++++++++";
const char* clientID =  "MQTTkas";                    // client ID

:idea: Credit to biobier for the Button management coding :idea:


MQTT broker
Choose and configure a mqtt broker (I use CloudMQTT)
Image

MQTT test client
To test your setup, download and configure a standard MQTT client (I use MQTT-spy)
Image
Make sure to subscribe to 'led' and 'feedback'


Installing the Android App
Finally get MQTT Commander App, and configure both Connection and Session pages,
Image
You are now ready to go ;)


Image>> Video <<

Android App and ESP8266 led are now fully synchronized
- the App button drives the board led
- a local led state change will be reflected on the Android device screen


I will post the Application on Google Play within a few weeks (as a free App)
In the meantime, to get it NOW, notify me here and drop me a Private Message including your email address.
Again, to make life easier, please make sure to have the system working with MQTT-spy, before trying MQTT Commander

This board is a proof of concept; I plan to replace the led by a 3V Opt coupler insulated relay
Image

I am baffled by this new cute WiFi device, and may end up developing a joystick application similar to Joystick Bluetooth Commander

.
You do not have the required permissions to view the files attached to this post.
Last edited by kas on Wed Jul 08, 2015 12:54 pm, edited 4 times in total.