The aim of this Project is to visualize, on your Cayenne myDevices account, the measure values of humidity and temperature obtained and sent through MQTT from your Agrumino Lemon(Lifely), device which is chip-based on ESP8266.
Since Agrumino Lemon has all the needed sensors on board (sensor of temperature, soil moisture, illuminance, etc...), it becomes useful in order not to buy and use a lot of connection wires and sensors(as common instead for other microcontrollers), but just connect the Agrumino with a micro-USB cable to the PC.
Below is reported the video tutorial of the overall procedure explained in this web page:
2. Starting with Cayenne myDevicesStep 1: login to Cayenne myDevices
After you created an account on Cayenne myDevices, login to it at the link:
or search it on google and then do the login.
Step 2: select the correct device (Generic ESP8266 for Agrumino)
Now select "Generic ESP8266" for your Agrumino Lemon chip-based on ESP8266.
Step 3: take note of your given MQTT credentials
In your Cayenne configuration dashboard you can see three MQTT credentials to receive and/or send data from your Agrumino to the Cayenne platform and/or viceversa(MQTT USERNAME, MQTT PASSWORD, CLIENT ID).
Take note of them, because of course these must be used in your Agrumino code.
The only other two credentials to use in your Agrumino code are the connection name and password to connect to your wifi(SSID_NAME and SSID_PASSWORD in the code).
3. Programming Agrumino on Arduino IDEStep 4: Download the Cayenne MQTT library.ZIP file to include on Arduino IDE
Always in your Cayenne configuration dashboard, on the left, is reported a link to download the Cayenne MQTT Library(click on "Cayenne MQTT Library"), which will bring you at the following github link:
https://github.com/myDevicesIoT/Cayenne-MQTT-ESP
Then from the github page download the.ZIP file with the green button,
and include it on your Arduino UNO libraries:
Also install the Agrumino library already present in the libraries handler of Arduino IDE:
Configure your device selecting "Lifely Agrumino Lemon vx" as the board, set the baud rate (Upload speed) according to that specified in your code(argument of the function call "Serial.begin(****)" into the function declaration "void setup()"), and select the USB port where you attached the USB cable that connects to your Agrumino device:
After that, you can upload the code to your Agrumino.
4. Customizing Cayenne platform and setting some triggersStep 5: return to your Cayenne myDevices platform
After the code has been correctly uploaded on Agrumino, return to your Cayenne myDevices platform that is waiting for your device to connect to it through MQTT, and check if the current measure values of humidity(channel 0) and temperature(channel 1) have been correctly sent:
Step 6: customize the humidity and temperature widget
To better describe what the two channel widgets represent, it is better to customize them with some more representative names and logos to be displayed to the user. To do that, click on the '+' symbol at the top-right corner of every widget to add them to the dashboard, then click on 'Settings' to customize them:
Step 7: set some notification triggers for the humidity and temperature channels
It is possible to set some triggers for chosen values of humidity and temperature, and to send related notifications to the user via email or sms to warn it about.
From the top-right corner of every widget, click on "Trigger", then give a name to every trigger you create, and fill the form with the trigger conditions(threshold values of humidity or temperature), in order to notify the user when these happen(via sms in this example).
Step 8: check if the real frequency measure corresponds to the specified one in the code
Now it is time to check if the real frequency measure correspond to the desired one specified in the code( 1 min in this example). So a look to the Serial monitor of the Arduino and to the dashboard of Cayenne must be done.
At the same moment, look if the phone is receiving the triggered sms notifications (in case the humidity and temperature values trigger them):
In this case, the frequency measure is exactly 1 minute as we specified in the code, and also the humidity and temperature values triggered the sms notifications(humidity below 20% and temperature above 30°C, on the right).
6. ConclusionsThe semplicity of use of the Agrumino Lemon in therm of code(the Lifely community documents and mantains its libraries) and also thanks to the zero wire connections and third part sensors needed, it made a lot easier and fast its use compared to other famous microcontrollers.
In addition, Cayenne myDevices platform semplified a lot the MQTT connection, and gave the possibility to use a lot of useful widgets, and free methods to send trigger notifications (via sms and emails).
Comments
Please log in or sign up to comment.