Project tutorial

Arduino UNO MQTT Meteo Station © GPL3+

Do you know the MQTT protocol? Use this with Cayenne. Build your project and use a free cloud platform with Dashboard and many Widgets.

  • 2,889 views
  • 0 comments
  • 4 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

Do you know the MQTT protocol?

The MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.

For this project I use the MQTT protocol under Cayenne developer ambient. When you make an object that have sensor or actuator, you can make also a protocol for communication between that object, and for example your smartphone. The last step, the communication with smartphone, or computer, require a platform that show the value, or the buttons to activate the actuator. Cayenne give you a free platform to experiments your prototipe.

MQTT is the preferred transport and API for sending data to the Cayenne Cloud, or for devices that receive commands from Cayenne. The Cayenne Cloud acts as a broker, managing the various sensor and actuator client devices that wish to send and receive data using the Cayenne Cloud.Cayenne MQTT is straightforward and easy to use, offering several different ways of connecting your data to Cayenne.

Step 1: Connect the sensors

The hardwares of the project are:

Optional

DHT-11

Step 2: Mount the Adafruit bmp085

This sensor use a I2C communication, and a SPI communication. For this project I use a I2C Arduino UNO communication port.

THIS SENSOR WORK AT 3,5V!

See the sensor pin and connect:

  • VCC of the BMP085 sensor to 3.3V (NOT 5.0V!);
  • GND to Ground;
  • Connect SCL to i2c clock - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 5;
  • Connect SDA to i2c data - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 4;
  • EOC is not used, it signifies an end of conversion;
  • XCLR is a reset pin, also not used here;

After install the BMP085 library by https://github.com/adafruit/Adafruit-BMP085-Libra...

Restart the Arduino IDE and select the BMP085 test. See the result on the serial. If all it's ok you can see Temperature, Barometric pressure, and altitude.

Step 3: The MQTT Cayenne library

Now download the Cayenne Library, install on Arduino IDE. After open the Example of Cayenne MQTT library, and modify the Cayenne authentication info. This should be obtained from the Cayenne Dashboard.

char username[] = "MQTT_USERNAME";

char password[] = "MQTT_PASSWORD";

char clientID[] = "CLIENT_ID";

upload the code on your Arduino. All of the required information we need can be found on the Cayenne dashboard’s Choose SDK and connect your device screen. Refer to this screen and copy & paste your MQTT Username, MQTT Password and Client ID into the sketch file.

The example sketch file includes placeholders for these values, so we just need to update them with the values provided to us on our dashboard. TIP: The credentials shown here are unique for your account and the current device being added. When programming new devices, always be sure to copy & paste from the Cayenne dashboard screen so that the correct values are used for your device.

Click on Add new... --> Bring You Own Thing --> Copy the MQTT username, password and clientID

Step 4: Upload the Cayenne MQTT code

Go to:

https://github.com/masteruan/Cayenne_meteo_MQTT

Modify the USER, PASSWORD and ID variable. Open your Arduino IDE and copy the file and upload on your Arduino UNO.

Open the serial monitor for debug.

Step 5: Meteo MQTT Dashboard

Now make your Cayenne dashboard. Connect the Arduino UNO + Ethernet Shield to internet and you see the serial messages. When you see the connection message, try to open Cayenne Dashboard, and see the values on the screen. After you can modify the icons of Cayenne widget, or show the diagram, or make a new dashboard with the different data.

Code

Adafruit BMP280 Library
https://github.com/adafruit/Adafruit_BMP280_Library
Adafruit BMP085l Library
https://github.com/adafruit/Adafruit-BMP085-Library
Cayenne MQTT Arduino Library
https://github.com/myDevicesIoT/Cayenne-MQTT-Arduino
Cayenne meteo MQTT
https://github.com/masteruan/Cayenne_meteo_MQTT
BMP085 test
Download the library, connect the sensor to Arduino board and test it !

Comments

Similar projects you might like

Third Eye for The Blind

Project tutorial by Muhammed Azhar

  • 397 views
  • 0 comments
  • 8 respects

Automatic Gate with FSM and ISR

Project showcase by Nuno Miguel Guerreiro Carvalho Martins and AndreNeves

  • 96 views
  • 0 comments
  • 2 respects

One Button Restart of a Stalled Raspberry Pi Zero W

Project tutorial by Ray Burnette

  • 2,008 views
  • 0 comments
  • 15 respects

Remote Controlled Scoreboard/Soundboard

Project showcase by Scott Clandinin

  • 664 views
  • 2 comments
  • 4 respects

Spectrum Analyzer Using Winamp and Arduino Uno

Project showcase by raul

  • 1,352 views
  • 1 comment
  • 8 respects

IoT Pet Feeder

Project tutorial by circuito.io team

  • 5,223 views
  • 0 comments
  • 29 respects
Add projectSign up / Login