Hi what should I do if I can’t find Adafruit feather m0 in the list of given devices?
it is not offically supported but you try connecting it to cayenne MQTT broker with the adrafruit MQTT library.
Thanks for your help. Could you please assist me in detail on how to connect cayenne MQTT with the Adafruit MQTT library?
the feather m0 supports on wifi101 library. Here is an example on how to connect to MQTT Arduino WiFi101 MQTT Example (using PubSubClient by Nick O'Leary) · GitHub
you will need to makes changes based on esp8266-MQTT-v1/esp8266-MQTT-v1.cpp at master · spacefolder/esp8266-MQTT-v1 · GitHub to connect it to cayenne.
Thank you so much. I am bigginer and have no knowledge in this field. I am using arduino-lmic/ttn-otaa-feather-us915-dht22.ino at master · mcci-catena/arduino-lmic · GitHub so I will just write these statements in my code?
#include <SPI.h>
#include <WiFi101.h>
#include <PubSubClient.h>
you need to be specific, whether you are using a MQTT or lora board. can you share a link to the device you are using.
Bundle of thanks for your kind support. I am using this Pinouts | Adafruit Feather M0 Radio with LoRa Radio Module | Adafruit Learning System with DHT22 Sensor Arduino Wiring | Using LoraWAN and The Things Network with Feather | Adafruit Learning System.
The Gateway is Dragino LPS8
here is a code for lmic and cayenne lpp Uplink and downlink CayenneLPP payload to TTN using LMIC library - #13 by shramik_salgaonkar
Sir, If I add the mentioned part of your code in the place of temperature, then what should i add for humidity section?
void do_send(osjob_t* j){
// Check if there is not a current TX/RX job running
if (LMIC.opmode & OP_TXRXPEND) {
Serial.println(F("OP_TXRXPEND, not sending"));
} else {
// read the temperature from the DHT22
float temperature = dht.readTemperature();
Serial.print("Temperature: "); Serial.print(temperature);
Serial.println(" *C");
// adjust for the f2sflt16 range (-1 to 1)
temperature = temperature / 100;
// read the humidity from the DHT22
float rHumidity = dht.readHumidity();
Serial.print("%RH ");
Serial.println(rHumidity);
// adjust for the f2sflt16 range (-1 to 1)
rHumidity = rHumidity / 100;
// float -> int
// note: this uses the sflt16 datum (https://github.com/mcci-catena/arduino-lmic#sflt16)
uint16_t payloadTemp = LMIC_f2sflt16(temperature);
// int -> bytes
byte tempLow = lowByte(payloadTemp);
byte tempHigh = highByte(payloadTemp);
// place the bytes into the payload
payload[0] = tempLow;
payload[1] = tempHigh;
// float -> int
uint16_t payloadHumid = LMIC_f2sflt16(rHumidity);
// int -> bytes
byte humidLow = lowByte(payloadHumid);
byte humidHigh = highByte(payloadHumid);
payload[2] = humidLow;
payload[3] = humidHigh;
// prepare upstream data transmission at the next possible time.
// transmit on port 1 (the first parameter); you can use any value from 1 to 223 (others are reserved).
// don't request an ack (the last parameter, if not zero, requests an ack from the network).
// Remember, acks consume a lot of network resources; don't ask for an ack unless you really need it.
LMIC_setTxData2(1, payload, sizeof(payload)-1, 0);
}
// Next TX is scheduled after TX_COMPLETE event.
}
here you will find all about cayenne LPP and data types Cayenne Docs