This project will allow you to build your own weather forecast station using a RGBW led bulb as weather condition and\or temperature indicator. Using the visual communication different light colours can give information about the current weather condition when you wake up in the morning or information about temperature at a specific time. Different weather information can be provided by the weather channel on the IFTTT environment that is used for the remote control of the led bulb for turning ON\OFF and colour changing.
Once the system setup is complete you will be able to have a complete remote control of your led bulb with an easy additional configuration of specific IFTTT DO buttons.
How it worksThe LYT led bulb is a radio led bulb that can be controlled by an Arduino board with a specific software and using a LYTWiFi shield. By default specific commands can be sent to the LYT bulb using the serial interface of the Arduino board (i.e. by the Arduino IDE).
The LYTWiFi shield has also an ESP8266 module with a standard firmware version that is used to connect the shield to the network by a WiFi interface. In this project the ESP8266 standard firmware will be replaced by a specific version that allow the system to receive specific commands for the LYT bulb from the network.
Using the IFTTT automation web service, specific commands for the LYT bulb will be sent on the base of the weather condition and temperature at specific time or during the day.
For a complete system setup follow the steps below.
Note
The project has been developed using the following version of the software development environment:
- Arduino IDE ver. ver. 1.6.8.
- ESP8266 board manager ver. 2.0.0.
First of all an email account is needed for the commands to be sent for the control of the LYT bulb. The mail server must be POP3 and allow non-encrypted data (server port = 110).
Once the account is created the following data is needed for the customization of the LYTWiFi firmware:
- mail server name
- mail server port
- email address
- email password
An IFTTT account must be created. Once the account is created you can define the "recipes" for the weather forecast updates.
Once the account is created you have to connect to the channel that is needed for the project:
- MAKER channel
- Weather channel
Once connected to the MAKER channel keep aside the key associated to your account connection to the channel for the following customization of LYTWiFi firmware.
STEP 3. Customize LYTWIFI firmawareBefore LYTWiFi firmware update, the code must be customized with parameters of:
- your WiFi connection
- your email account
- your IFTTT MAKER channel connection key
In details two different code are available for ESP8266 firmware update:
demo_firmware_esp8266_ifttt_thermometer
demo_firmware_esp8266_ifttt_remote_control
For both code apply the modifications to the following blocks of code with your own parameters:
Mail Server
const char pop_server[] =<mail server name>;
const int pop_port = <mail server port>;
const char pop_user[] = <email address>;
const char pop_pass[] = <email password>;
WiFi connection
// Connect to the specified AccessPoint
WiFiMulti.addAP(<SSID>, <password>);
MAKER channel web request
http.begin("https://maker.ifttt.com/trigger/lytwifi_thermometer_on/with/key/<MAKER channel key>");
http.begin("https://maker.ifttt.com/trigger/lytwifi_remote_control_on/with/key/<MAKER channel key>");
Both Arduino and LYTWiFi shield must be programmed. Use Arduino IDE for both software\firmware updates.
Arduino UNO board must be loaded with the demo_firmware_lytwifi_2 code. This code has minor modifications respect to the official Authometion sample code for the control of LYT led bulb. Program Arduino UNO board using Arduino IDE.
For the firmware update of the LYTWiFI shield an external USB to serial converter is needed. As described in the LYTWiFi shield manual, for ESP8266 programming set the following jumper configuration:
- remove JP1, JP2, JP3
- set JP4 G0-GND connection
- connect serial port to shield: Rx->JP1 central Wire, Tx->JP2 central wire, GND to some GND connection
Once programmed set the jumper configuration in the default mode:
- remove serial converter connection to the board
- set JP1, JP2, JP3
- remove JP4 G0-GND connection
In the following figure the configuration for the programming mode and default mode.
Set Arduino IDE to program a "Generic ESP8266 module" choosing from Tools-> Board menu and selecting the correct port for the USB to serial converter you have installed. You can program the LYTWiFi shield with one of the example code on the base of the project example you want to run.
In the following the specific instructions for the different examples.
EX1 - Thermometer applicationTo run the thermometer application first of all upload the demo_firmware_esp8266_ifttt_thermometer to the LYTWiFi shield.
Create IFTTT recipes
Now the IFTTT recipes for the application must be created.
First a recipe for the notifications of the system start will be created. The recipe will send a notification to your mobile device when the system with the thermometer application is turned ON. IFTTT mobile app is required on your mobile device.
Select "Create" from the user menu to start the recipe creation procedure:
- select "this" to define the trigger of the recipe
- select MAKER channel
- select "Receive a web request"
- set "lytwifi_thermometer_on" as event name and create the trigger
- select "that" to define the action of the recipe
- select IF Notifications channel. Connect to the channel if not connected
- select "Send a notification"
- set notification message and create the action
- set the recipe title and create the recipe
A second recipe will be created for message sending to LYTWiFi using email. The recipe will send an email to LYTWiFi shield with data about the current temperatue at the time that you specify.
Select "Create" from the user menu to start a new recipe creation procedure:
- select "this" to define the trigger of the recipe
- select Weather channel
- select "Today's weather report"
- set the time for the current temperature report and create the trigger
- select "that" to define the action of the recipe
- select Gmail channel. Connect to the channel if not connected
- select "Send an email"
- set the address to send the email. This is the email address that has been defined for the LYTWiFi shield
- set the following mail subject "ARDUINO " and add CurrentTempCelsius from the add ingredient button. The complete subject must be "ARDUINO {{CurrentTempCelsius}}"
- set a blank mail body
- set a blank mail attachment
- select "Create action"
- set the recipe title
- check "Receive notifications when recipe runs"
- select "Create the recipe"
After the creation of this two recipes reset the Arduino board to restart the system. If system is correctly configured:
- after board reset a notification on your mobile device will alert you that the
lytwifi_thermometerapplication is started
- at the time that you specified in the recipe the colour of the led bulb will be set on the base of the current temperature
For system testing the second recipe can be turned OFF, the time for the report can be changed and then turned ON again for a new temperature report.
Applying simple modifications to the LYTWiFi firmware you can define your own temperature ranges in number dimension and associated colour.
EX2 - Weather stationTo run the weather station application first of all upload the demo_firmware_esp8266_ifttt_remote_control to the LYTWiFi shield.
Create IFTTT recipes
Now the IFTTT recipes for the application must be created.
First of all a recipe for the notifications of the system start will be created. The recipe will send a notification to your mobile device when the system with the weather station application is turned ON and send an email to LYTWiFi with a command for LYT led bulb turn ON.
Select "Create" from the user menu to start the recipe creation procedure:
- select "this" to define the trigger of the recipe
- select MAKER channel
- select "Receive a web request"
- set "lytwifi_remote_control_on" as event name and create the trigger
- select "that" to define the action of the recipe
- select Gmail channel. Connect to the channel if not connected
- select "Send an email"
- set the address to send the email. This is the email address that has been defined for the LYTWiFi shield
- set the following mail subject "ARDUINO PON,0,0,1
- set a blank mail body
- set a blank mail attachment
- select "Create action"
- set the recipe title (i.e. LYTWiFi remote control ON!)
- check "Receive notifications when recipe runs"
- select "Create the recipe"
A second recipe will be created for message sending to LYTWiFi using email. The recipe will send an email to LYTWiFi shield when current weather condition changes to "Clear" with a command for LYT led bulb colour setting to green.
Select "Create" from the user menu to start the recipe creation procedure:
- select "this" to define the trigger of the recipe
- select Weather channel
- select "Current condition changes to"
- set the "Clear" condition change and create the trigger
- select "that" to define the action of the recipe
- select Gmail channel. Connect to the channel if not connected
- select "Send an email"
- set the address to send the email. This is the email address that has been defined for the LYTWiFi shield
- set the following mail subject "ARDUINO RGB,0,0,0,255,0,1"
- set a blank mail body
- set a blank mail attachment
- select "Create action"
- set the recipe title as "If current condition changes to clear, then set LYT green"
- check "Receive notifications when recipe runs"
- select "Create the recipe"
Other three recipes must be created in the same way as the previous one:
- "If current condition changes to cloudy, then set LYT blue" using "ARDUINO RGB,0,0,0,0,255,1"
- "If current condition changes to snow, then set LYT red" using "ARDUINO RGB,0,0,255,0,0,1"
- "If current condition changes to rai, then set LYT yellow" using "ARDUINO RGB,0,0,127,127,0,1"
After the creation of the recipes reset the Arduino board to restart the system. If system is correctly configured:
- after board reset a notification on your mobile device will alert you that the lytwifi_remote_control application is started and if the LYT led bulb is OFF this will be turned ON
- the colour of the led bulb will be set on the base of the current weather condition, and will be changed when condition changes
Applying simple modifications to the LYTWiFi firmware you can define your own colour code for the different weather condition. Other weather information can be provided by the IFTTT weather channel for different system usage (temperature, humidity).
EX3 - LYT remote controlWith the same firmware used for the weather station application is possible to obtain a complete remote control for the LYT led bulb from your mobile device. Commands for LYT turning ON\OFF and colour setting can be sent from IFTTT web service using the DO buttons instead of IF recipes.
Do button can be used only from your mobile device. So the specific App has to be installed.
Create IFTTT DO buttons
Now the IFTTT DO buttons for the application must be created.
First of all a DO button for the LYT turn ON must be created. The button will send an email to LYTWiFi with a command for LYT led bulb turn ON.
From DO button mobile app select the recipe collection icon:
- select + to add a new DO button
- select channel tab
- select Gmail channel
- select "Create a New Recipe"
- select "Send an Email"
- set the title (i.e Turn LYT ON)
- set the address to send the email. This is the email address that has been defined for the LYTWiFi shield
- set the following mail subject "ARDUINO PON,0,0,1"
- set a blank mail body
- set a blank mail attachment
- select "Add"
Other buttons must be created in the same way as the previous one:
- "Turn LYT OFF" using "ARDUINO POF,0,0,1" as mail subject
- "Set LYT mid white"using "ARDUINO SBR,0,0,127,1" as mail subject
- "Set LYT min white"using "ARDUINO SBR,0,0,255,1" as mail subject
- "Set LYT red"using "ARDUINO RGB,0,0,255,0,0,1" as mail subject
- "Set LYT green"using "ARDUINO RGB,0,0,0,255,0,1" as mail subject
- "Set LYT blue"using "ARDUINO RGB,0,0,0,0,255,1" as mail subject
After the creation of the recipes reset the Arduino board to restart the system. If system is correctly configured:
- after board reset a notification on your mobile device will alert you that the lytwifi_remote_control application is started and if the LYT led bulb is OFF this will be turned ON
- from your mobile device push one of the DO button created to change the status of the led bulb (i.e. set LYT colour red)
- wait for the command detection from the LYTWiFi shield and verify that the led bulb changes its colour according to the last command
Note
The remote control in this project is not developed to be a real-time method. The command can take several seconds to be received by the shield due to the network connection and mail server status.
System Test and DebugAfter the configuration you can test and debug your system using the serial debug port on the LYTWiFi shield. Both the firmware of the ESP8266 module uses this port to send message about its activity about connection status and command sent to the Arduino board for LYT bulb control.
Using the USB to serial converter used for ESP866 firmware update connect:
- Rx->JP4-G13 pin,
- Tx->JP4-G14 pin
- GND to some GND board connection.



_ztBMuBhMHo.jpg?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff)








Comments