Full Arduino Mini LoraWAN below 1uA Sleep Mode

(Peter Katana) #102

Hi dear,

thanks for your fast response. I simply want to get your example up and running bcs it would be a perfect starting point for my ideas. I deleted the new BME280 llib now and copied the header files from your tree into the directory where the .ino file is located (your complete source tree is now one directory up bcs arduino creates a sub dir in that tree dir.
Now he compiles fine but I got a lot of unresolved references …
/Users/Peter/Projekte/ISY-Box/LoraWeather/Parkett Decke Node/LoRaWAN_TTN_Env_Node-master/LoRaWAN_TTN_Env_Node/LoRaWAN_TTN_Env_Node.ino:316: undefined reference to BME280I2C::begin()' /var/folders/zg/_ch0sxr910z5mt6j6skz3dz00000gn/T//ccjKsYlH.ltrans1.ltrans.o: In functiondo_send’:
/Users/Peter/Projekte/ISY-Box/LoraWeather/Parkett Decke Node/LoRaWAN_TTN_Env_Node-master/LoRaWAN_TTN_Env_Node/LoRaWAN_TTN_Env_Node.ino:274: undefined reference to readVcc()' /var/folders/zg/_ch0sxr910z5mt6j6skz3dz00000gn/T//ccjKsYlH.ltrans5.ltrans.o: In function__static_initialization_and_destruction_0’:
/Users/Peter/Projekte/ISY-Box/LoraWeather/Parkett Decke Node/LoRaWAN_TTN_Env_Node-master/LoRaWAN_TTN_Env_Node/LoRaWAN_TTN_Env_Node.ino:160: undefined reference to BME280I2C::BME280I2C(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, bool, unsigned char)' /var/folders/zg/_ch0sxr910z5mt6j6skz3dz00000gn/T//ccjKsYlH.ltrans0.ltrans.o: In functionupdateEnvParameters()’:
/Users/Peter/Projekte/ISY-Box/LoraWeather/Parkett Decke Node/LoRaWAN_TTN_Env_Node-master/LoRaWAN_TTN_Env_Node/LoRaWAN_TTN_Env_Node.ino:181: undefined reference to BME280::temp(bool)' /Users/Peter/Projekte/ISY-Box/LoraWeather/Parkett Decke Node/LoRaWAN_TTN_Env_Node-master/LoRaWAN_TTN_Env_Node/LoRaWAN_TTN_Env_Node.ino:183: undefined reference toBME280::pres(unsigned char)’
/Users/Peter/Projekte/ISY-Box/LoraWeather/Parkett Decke Node/LoRaWAN_TTN_Env_Node-master/LoRaWAN_TTN_Env_Node/LoRaWAN_TTN_Env_Node.ino:184: undefined reference to BME280::hum()' /var/folders/zg/_ch0sxr910z5mt6j6skz3dz00000gn/T//ccjKsYlH.ltrans0.ltrans.o: In function__vector_21’:
/Users/Peter/Projekte/ISY-Box/LoraWeather/Parkett Decke Node/LoRaWAN_TTN_Env_Node-master/LoRaWAN_TTN_Env_Node/LoRaWAN_TTN_Env_Node.ino:174: undefined reference to _adc_irq_cnt' /Users/Peter/Projekte/ISY-Box/LoraWeather/Parkett Decke Node/LoRaWAN_TTN_Env_Node-master/LoRaWAN_TTN_Env_Node/LoRaWAN_TTN_Env_Node.ino:174: undefined reference to_adc_irq_cnt’
collect2: error: ld returned 1 exit status

I assume that its because the wrong lib objects path. How I need to handle your source tree (ph2lb/LoRaWAN_TTN_Env_Node) within Arduino ? And once more, sorry for my maybe stupid questions and many thanks for your help !
Br Peter



The errors mean that the source compiles ok, but the linker can’t find the referenced functions.
You may have forgotten to copy the Adcvcc.cpp, BME280.cpp and BME28012C.cpp into you’re the project directory.

For a clean start :

Best to do is to download the zipfile : https://github.com/ph2lb/LoRaWAN_TTN_Env_Node/archive/master.zip
And extract it in you’re Arduino Sketch folder. The Directory name will be "LoRaWAN_TTN_Env_Node-master"
so you have to rename it to “LoRaWAN_TTN_Env_Node”. Else the Adruino IDE can’t handle it.

That should compile without a problem. From there you can rebuild you own program.

(Peter Katana) #104

You are my hero for today !
Rebuild works without any problems.

Many thanks for your help !
Br Peter


@PeterKatana, you’re welcome.

Enjoy and please show us you’re end result.

(Peter Katana) #106

Hi lex,

should I see something on the serial monitor when the prog is running ?
I just see a single “Ly” … not more.

Btw: I have running here an Raspi Dragino hat single channel gw - connect status green in the ttn network console.
Registered the Lora node as application --> device and changed the addresses appropriately in your example code but don’t know, if the node can connect / see the raspi gw. In the ttn portal the node is shown as not connected.

Many many thanks for your help !

Thanks in advance Peter


Oh when you running Single channel you should change the code to the channel the Raspi Dragiono supports.
It will probably be channel 0 on SF7, so you have to change the line :

// #define CHANNEL0


#define CHANNEL0

When you want to debug info you should set the serial terminal to 1115200.
But remember that you have to set the board settings correct (when using a 3.3V mini pro it’s 8Mhz, a 5V mini pro is 16Mhz).

(Peter Katana) #108

HI lex,
changed to channel 0. Setup serial speed appropriately and got:
/Users/Peter/Google Drive/Mac Documents/Documents/Arduino/libraries/arduino-lmic-master/src/lmic/radio.c:689
Seems that the initialization of the RF chip is not working. Maybe its a wrong one ?
Should be a RF95W bcs of europe …

You mean the board settings in Arduino IDE ? Yes, they are correct.


For Europe the correct chip should be indeed a RFM95W.

(Peter Katana) #110

The same error … used an new Arduino and also a new RFM95W (different product and outfit).
I used the wiring from:

But there is no magic I assume.
Any ideas ?


There is magic, but did you change the wiring in the source code ? Because when you didn’t there will be no wireless magic :wink:

Below are the correct defines (rows 116 to 121)

#define LMIC_NSS 6
#define LMIC_DIO0 2
#define LMIC_DIO1 3
#define LMIC_DIO2 4

(Peter Katana) #112

That was the magic part … you were right !


691288: 10

Do you know where can I found more about this mapping to read ?
Br Peter


With the mapping do you mean how to connect the RFM95?

(Peter Katana) #114

Hi Lex,

yes, I mean the pin mapping you send me before.
#define LMIC_NSS 6
#define LMIC_DIO0 2
#define LMIC_DIO1 3
#define LMIC_DIO2 4
I need to read more about the lmic library.
Wish you a perfect weekend!
Br Peter


Hello Peter,

These settings are indeed used by the LMIC library to define which pins used for the variouse IO pins. The NSS is the chip select pin used to select the RFM95W chip.
For the use of the DIOś checkout page 41 of http://www.hoperf.com/upload/rf/RFM95_96_97_98W.pdf

It are signals that which are used by the RFM95W to signal certain states to the host controler. like RX of TX done etc.

(Peter Katana) #116

Hi Lex,
thanks for the tips. Will read them.
If I want to display the values in a dashboard, I can go your way with the mysql backend (I mean your proposed backend code with an mysql db) or need to modify the code so that the sketch uses the cayenne protocol. Am I right ?
And what way you would recommend ? The mysql backend bcs its more flexible ?
btw: I want to transport two temperature and two humidity values - in that case I assume cayennelpp is not feasible bcs it only allows to transport one temperature value. And I also see no function for dealing with voltage values like for the battery status.
Or am I totally wrong ?
Thanks Peter


Indeed, a mysql backend can be more flexible. Especialy when you have 2 temp and 2 humidity values.
But although I have made some tests with cayenne for demonstration purposes, the limitations where the reason why I build my own back-end.

But maybe somebody else reading this topic could give info.


yes you can send more then one temp/humidty … every temp/humidity gets their own 'channel ’ number.
but you don’t get the fancy lex_ph2lb graph’s :wink:

(Peter Katana) #119

Thanks guys. I think it is the same with Blynk. Perfect for fast prototyping, but if you have special requirements you need a data leak and a dashboard software.
I am happy that I am part of such a expert and helpful community.
Appreciate your help a lot.


Nothing stops you using cayenne protocol and pulling the decoded data from your ttn app into your own database. The downside is that Cayenne isn’t the most efficient for its use of bytes so consumes more power and means you can’t update as often by the ttn fair use

(Peter Katana) #121

I will play with both I assume. Setup in parallel a db backend.
Need the two BME280 on parallel on the I2C bus get working.
Thanks for theh tip!