Weather Station 2019 is a device to monitor temperature and humidity, that sends all the results to the
Cayenne server with LoRa radio modulation. Weather Station 2019 is built around an Arduino MKRWAN
1300 board.
It’s powered by an Ansmann 3.7V 5200mAh battery connected to Microchip MIC5201 3,3V fixed voltage regulator
in order to guarantee low quiescent currents.
The chosen sensor is I2C interface version of SENSIRION SHT35-DIS. It has a
resolution of ± 0.1% ° C and ± 1.5% RH. SHT35-DIS consumptions are 45μA in idle
state and 6mA in measurement. It’s assembled on a special PCB and placed into
waterproof cap.
Weather Station 2019 is wired inside an Hammond’s Polycarbonate box with 160x90x60,5mm dimensions
and IP66 protection’s degree.
i am using a node mcu, ESP8266. and i want to track the device with the location widget, like the map on the screenshot. but i cant find it. how can i use that widget?
/*
This example shows how to connect to Cayenne using an ESP8266 and send/receive sample data.
The CayenneMQTT Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.
Steps:
1. If you have not already installed the ESP8266 Board Package install it using the instructions here: https://github.com/esp8266/Arduino#installing-with-boards-manager.
2. Select your ESP8266 board from the Tools menu.
3. Set the Cayenne authentication info to match the authentication info from the Dashboard.
4. Set the network name and password.
5. Compile and upload the sketch.
6. A temporary widget will be automatically generated in the Cayenne Dashboard. To make the widget permanent click the plus sign on the widget.
*/
//#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTPIN 5
#define DHTTYPE DHT11
DHT_Unified dht(DHTPIN, DHTTYPE);
// WiFi network info.
char ssid[] = "";
char wifiPassword[] = "";
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "";
char password[] = "";
char clientID[] = "";
unsigned long lastMillis = 0;
#define VIRTUAL_CHANNEL 1
#define ACTUATOR_PIN 4 // Do not use digital pins 0 or 1 since those conflict with the use of Serial.
void setup() {
Serial.begin(9600);
pinMode(ACTUATOR_PIN, OUTPUT);
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
dht.begin();
sensor_t sensor;
}
void loop() {
Cayenne.loop();
//Publish data every 1 seconds (1000 milliseconds). Change this value to publish at a different interval.
if (millis() - lastMillis > 1000) {
lastMillis = millis();
//Write data to Cayenne here. This example just sends the current uptime in milliseconds.
Cayenne.virtualWrite(0, lastMillis);
sensors_event_t event;
dht.temperature().getEvent(&event);
Cayenne.celsiusWrite(3, event.temperature);
dht.humidity().getEvent(&event);
Cayenne.virtualWrite(2, event.relative_humidity, "rel_hum", "p");
}
}
// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
CAYENNE_OUT_DEFAULT()
{
// Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
Cayenne.virtualWrite(0, millis());
Cayenne.virtualWrite(20, buffer, "gps", "m");
// Some examples of other functions you can use to send data.
//Cayenne.celsiusWrite(1, 22.0);
//Cayenne.luxWrite(2, 700);
//Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);
}
// Default function for processing actuator commands from the Cayenne Dashboard.
// You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN(VIRTUAL_CHANNEL)
{
int value = getValue.asInt();
CAYENNE_LOG("Channel %d, pin %d, value %d", VIRTUAL_CHANNEL, ACTUATOR_PIN, value);
// Write the value received to the digital pin.
digitalWrite(ACTUATOR_PIN, value);
}