![](/media/cache/profiles/5a245e9a52805642a6a095aeb71ee307.jpg.50x50_q85.jpg)
Demo program for LoRaWan with data formated for cayenne interface on mydevices.com Check on https://goo.gl/fTUDNc
Demonstration d'un node LoRaWan sur carte : Discovery IOT STmicro : B-L072Z-LRWAN1 https://www.st.com/en/evaluation-tools/b-l072z-lrwan1.html
L e code original MBED-ARM : https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-lorawan/ est une application de l'API LoRAWan https://os.mbed.com/docs/v5.9/reference/lorawan.html
Le code original a été adapté pour une carte B-L072Z-LRWAN1 équipée d'un capteur de température LM35 connecté en 3.3v sur le port PA_0 (port analogique AN0) Les données sont formatées "cayenne" et visualisables sur mydevices.com ( https://goo.gl/fTUDNc ) Documentation cayenne : https://mydevices.com/cayenne/docs/lora/#lora-cayenne-low-power-payload
Les essais ont été réalisés avec une passerelle TTN https://www.thethingsnetwork.org/ le "Payload Format" ayant été configuré pour "Cayenne LPP"
Des capteurs virtuels on été également ajoutés (humidité, température, lumière, etc...) pour les essais au format cayenne.
Données physiques transmises (downlink)
- Température sur capteur LM35 - Tension sur PA_1 (AN1) est transmise entre 0% et 100% - Etat du bouton bleu
Données physiques reçues (uplink) Un actionneur permet d'allumer/eteindre à distance la led verte de la carte B-L072Z-LRWAN1
L'interface mydevice.com proposé permet de visualiser :
- Les capteurs virtuels - La température réelle sur LM35 - L'état du bouton bleu
lora_radio_helper.h@2:dc95ac6d6d4e, 2018-03-09 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Mar 09 13:15:17 2018 +0000
- Revision:
- 2:dc95ac6d6d4e
- Parent:
- 0:7037ed05f54f
- Child:
- 3:8c7198d1a2a1
Refactor construction of LoRaWANInterface object
This is refactoring of commit 59b4e195c39 to get rid of unnecessary pointer assignment.
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-lorawan
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:7037ed05f54f | 1 | /** |
mbed_official | 0:7037ed05f54f | 2 | * Copyright (c) 2017, Arm Limited and affiliates. |
mbed_official | 0:7037ed05f54f | 3 | * SPDX-License-Identifier: Apache-2.0 |
mbed_official | 0:7037ed05f54f | 4 | * |
mbed_official | 0:7037ed05f54f | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
mbed_official | 0:7037ed05f54f | 6 | * you may not use this file except in compliance with the License. |
mbed_official | 0:7037ed05f54f | 7 | * You may obtain a copy of the License at |
mbed_official | 0:7037ed05f54f | 8 | * |
mbed_official | 0:7037ed05f54f | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
mbed_official | 0:7037ed05f54f | 10 | * |
mbed_official | 0:7037ed05f54f | 11 | * Unless required by applicable law or agreed to in writing, software |
mbed_official | 0:7037ed05f54f | 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
mbed_official | 0:7037ed05f54f | 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbed_official | 0:7037ed05f54f | 14 | * See the License for the specific language governing permissions and |
mbed_official | 0:7037ed05f54f | 15 | * limitations under the License. |
mbed_official | 0:7037ed05f54f | 16 | */ |
mbed_official | 0:7037ed05f54f | 17 | |
mbed_official | 0:7037ed05f54f | 18 | #include "lorawan/LoRaRadio.h" |
mbed_official | 0:7037ed05f54f | 19 | |
mbed_official | 0:7037ed05f54f | 20 | #ifndef APP_LORA_RADIO_HELPER_H_ |
mbed_official | 0:7037ed05f54f | 21 | #define APP_LORA_RADIO_HELPER_H_ |
mbed_official | 0:7037ed05f54f | 22 | |
mbed_official | 2:dc95ac6d6d4e | 23 | #include "SX1272_LoRaRadio.h" |
mbed_official | 2:dc95ac6d6d4e | 24 | #include "SX1276_LoRaRadio.h" |
mbed_official | 2:dc95ac6d6d4e | 25 | |
mbed_official | 2:dc95ac6d6d4e | 26 | #define SX1272 0xFF |
mbed_official | 2:dc95ac6d6d4e | 27 | #define SX1276 0xEE |
mbed_official | 2:dc95ac6d6d4e | 28 | |
mbed_official | 2:dc95ac6d6d4e | 29 | #if (MBED_CONF_APP_LORA_RADIO == SX1272) |
mbed_official | 2:dc95ac6d6d4e | 30 | |
mbed_official | 2:dc95ac6d6d4e | 31 | SX1272_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI, |
mbed_official | 2:dc95ac6d6d4e | 32 | MBED_CONF_APP_LORA_SPI_MISO, |
mbed_official | 2:dc95ac6d6d4e | 33 | MBED_CONF_APP_LORA_SPI_SCLK, |
mbed_official | 2:dc95ac6d6d4e | 34 | MBED_CONF_APP_LORA_CS, |
mbed_official | 2:dc95ac6d6d4e | 35 | MBED_CONF_APP_LORA_RESET, |
mbed_official | 2:dc95ac6d6d4e | 36 | MBED_CONF_APP_LORA_DIO0, |
mbed_official | 2:dc95ac6d6d4e | 37 | MBED_CONF_APP_LORA_DIO1, |
mbed_official | 2:dc95ac6d6d4e | 38 | MBED_CONF_APP_LORA_DIO2, |
mbed_official | 2:dc95ac6d6d4e | 39 | MBED_CONF_APP_LORA_DIO3, |
mbed_official | 2:dc95ac6d6d4e | 40 | MBED_CONF_APP_LORA_DIO4, |
mbed_official | 2:dc95ac6d6d4e | 41 | MBED_CONF_APP_LORA_DIO5, |
mbed_official | 2:dc95ac6d6d4e | 42 | MBED_CONF_APP_LORA_RF_SWITCH_CTL1, |
mbed_official | 2:dc95ac6d6d4e | 43 | MBED_CONF_APP_LORA_RF_SWITCH_CTL2, |
mbed_official | 2:dc95ac6d6d4e | 44 | MBED_CONF_APP_LORA_TXCTL, |
mbed_official | 2:dc95ac6d6d4e | 45 | MBED_CONF_APP_LORA_RXCTL, |
mbed_official | 2:dc95ac6d6d4e | 46 | MBED_CONF_APP_LORA_ANT_SWITCH, |
mbed_official | 2:dc95ac6d6d4e | 47 | MBED_CONF_APP_LORA_PWR_AMP_CTL, |
mbed_official | 2:dc95ac6d6d4e | 48 | MBED_CONF_APP_LORA_TCXO); |
mbed_official | 2:dc95ac6d6d4e | 49 | |
mbed_official | 2:dc95ac6d6d4e | 50 | #elif (MBED_CONF_APP_LORA_RADIO == SX1276) |
mbed_official | 2:dc95ac6d6d4e | 51 | |
mbed_official | 2:dc95ac6d6d4e | 52 | SX1276_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI, |
mbed_official | 2:dc95ac6d6d4e | 53 | MBED_CONF_APP_LORA_SPI_MISO, |
mbed_official | 2:dc95ac6d6d4e | 54 | MBED_CONF_APP_LORA_SPI_SCLK, |
mbed_official | 2:dc95ac6d6d4e | 55 | MBED_CONF_APP_LORA_CS, |
mbed_official | 2:dc95ac6d6d4e | 56 | MBED_CONF_APP_LORA_RESET, |
mbed_official | 2:dc95ac6d6d4e | 57 | MBED_CONF_APP_LORA_DIO0, |
mbed_official | 2:dc95ac6d6d4e | 58 | MBED_CONF_APP_LORA_DIO1, |
mbed_official | 2:dc95ac6d6d4e | 59 | MBED_CONF_APP_LORA_DIO2, |
mbed_official | 2:dc95ac6d6d4e | 60 | MBED_CONF_APP_LORA_DIO3, |
mbed_official | 2:dc95ac6d6d4e | 61 | MBED_CONF_APP_LORA_DIO4, |
mbed_official | 2:dc95ac6d6d4e | 62 | MBED_CONF_APP_LORA_DIO5, |
mbed_official | 2:dc95ac6d6d4e | 63 | MBED_CONF_APP_LORA_RF_SWITCH_CTL1, |
mbed_official | 2:dc95ac6d6d4e | 64 | MBED_CONF_APP_LORA_RF_SWITCH_CTL2, |
mbed_official | 2:dc95ac6d6d4e | 65 | MBED_CONF_APP_LORA_TXCTL, |
mbed_official | 2:dc95ac6d6d4e | 66 | MBED_CONF_APP_LORA_RXCTL, |
mbed_official | 2:dc95ac6d6d4e | 67 | MBED_CONF_APP_LORA_ANT_SWITCH, |
mbed_official | 2:dc95ac6d6d4e | 68 | MBED_CONF_APP_LORA_PWR_AMP_CTL, |
mbed_official | 2:dc95ac6d6d4e | 69 | MBED_CONF_APP_LORA_TCXO); |
mbed_official | 2:dc95ac6d6d4e | 70 | |
mbed_official | 2:dc95ac6d6d4e | 71 | #else |
mbed_official | 2:dc95ac6d6d4e | 72 | #error "Unknown LoRa radio specified (SX1272,SX1276 are valid)" |
mbed_official | 2:dc95ac6d6d4e | 73 | #endif |
mbed_official | 0:7037ed05f54f | 74 | |
mbed_official | 0:7037ed05f54f | 75 | #endif /* APP_LORA_RADIO_HELPER_H_ */ |