Here’s a bit of info and examples to get started with the Arduino MKR WAN 1300:
Official reference:
- https://www.arduino.cc/en/Guide/MKRWAN1300
- https://www.arduino.cc/en/Guide/Cores
- LoRa library documentation
- LoRa library source
Here’s a bit of info and examples to get started with the Arduino MKR WAN 1300:
I have also been playing with this board and I liked it.
There are still some quirks to the MKRWAN library but the developers at Arduino are actively supporting and updating it.
I have wraped up a post about my experiences using it with PlatformIO, you can read it here:
as Tinkerman mentioned, the example for OTAA works out of the box.
for ABP you need to upgrade the firmware to ARD-078 1.1.3.
dont be suprised: the FW upload starts immediately after you loaded the upload program ( MKRWANFWUpdate_standalone )
Just made my first steps with these module using Gonzalos OTAA examples.
The module is always sending packets using SF12 BW125.
Is it possible to set the data rate using the ‘official’ arduino library (MKRWAN.h)?
Seems as if ADR doesnt work
Yep, I think you’re right, there’s no ADR and it’s not possible to change the data rate manually either, at least that’s how it was last time I tried.
You can change it with AT commands, but unfortunately it is nog part of the official library.
Easiest is probably to subclass the Arduino library and add it (on my todo list, but i am a bit out of time these days )
Ok, i did some small extensions to MKWAN.h.Added two public methods:
bool dataRate(uint8_t dr) {
sendAT(GF("+DR="), dr);
if (waitResponse() != 1) {
return false;
}
return true;
}
bool setADR(bool adr) {
sendAT(GF("+ADR="), adr);
if (waitResponse() != 1) {
return false;
}
return true;
}
Method dataRate uses argument dr from 0 (SF12/BW125) to 5 (SF7BW125). Value 6 didn’t work for me.
setADR returns true but doesn’t work, as @gonzalo wrote
Has anybody tried to power these up using batteries (AA or AAA) ?
For me it does not seem to work.
When I power them via usb I can see messages arrive at ttn but with batteries the arduino seems to be dead (@ AA’s measured at 3.2V).
When I power via usb while haveing the batteries connected and then remove the usb it seems to work
Regards
I tried with LiPo and it works perfectly.
ok thanks. I do not have a lipo battery to test. The official arduino doc clearly says that you can use a pair AA or AAA batteries but unless I got a faulty module, this does not seem to be the case
What voltage did this LiPo have? I’m wondering if I can use a single 18650 cell (Li-Ion) to power this board without any regulation.
look at the schematic!
Voltage at the screwconnector (X1) will not be regulated. connect there only 2 x AA(A) batteries.
At Vin on the header you could connect a LiPo. that will be regulated down to 3V3, but it must not be grater than 5V in any case!
I managed to get mine powered up using 2 AA cells connected to the screw terminal. Notice that the ON LED won’t turn on when it’s battery powered (this confused me for a while):
LED ON: This LED is connected to the 5V input from either USB or VIN. It is not connected to the battery power. This means that it lits up when power is from USB or VIN, but stays off when the board is running on battery power. This maximizes the usage of the energy stored in the battery. It is therefore normal to have the board properly running on battery power without the LED ON being lit.
I simply made it blink in the setup
part to have some visual feedback.
First of all many thanks @gonzalo for putting this together. It managed to build my first TTN node using a MKRWAN 1300 and your instructions were extremely helpful.
After the first days of testing I arrived to similar questions as the others in terms of batteries.
I am using 2 AAA standard batteries and ran two test cycles sending a message very 60 seconds. In both tests the node stopped sending after about 1500 uplinks, the voltage was at about 2.6V.
Therefore asking myself I should not
@ursm stated that should work via Vin, did you test it?
first I assume, without knowing your message size, that you’re violating the
Fair Access Policy:
Golden rule: 30 seconds air-time per device per day
For 10 bytes of payload, this translates in (approx.):
20 messages per day at SF12
500 messages per day at SF7
more for SF7BW250 and FSK (local-area)
Downlink bandwidth is even more restricted
you can’t send all messages as ‘confirmed uplink’
second: No I did not test it, I only made a statement about proper voltage and it’s connection.
Thanks, @gonzalo for the information. Does anyone have a tutorial on connecting an Arduino Wan 1300 to Pycom LoPy nano Gateway by any chance?
Ok thanks.
NB: I am aware I need to reduce the frequency. It was only for a fist test/simulation with a very small payload to understand the power consumption.
I believe that if you are using the MKRWAN library and the arduino firmware your attempts to send data at periods of less that 120 seconds will fail. This is hard coded and you can’t get round it but the dummy write in the library will dump your data.
The library is has a lot of blocking code delays and does not handle unexpected data or delays in connection requests well. Hopefully this will be addressed as the product matures.
There are a number of Arduino MKRWAN restrictions imposed that are not well documented but if you have a specific query I will try look at it but I am no expert on the firmware or the library.
I am not certain about ADR but if I force the datarate I get no responses from the network with anything other than setting 0…this may be just a poor signal as I am a 7km from my nearest gateways and in a rural location. I will add a local gateway soon and this should help diagnose network related issues better.
Is anyone aware if there is much effort going on to improve the library or document the firmware? Information seems hard to come by.
On the battery front I am using a 400mAh 3.2v lithium and charging it from a small solar cell. In other words I have scavanged an external LED home lamp case and push the output through a charge circuit, dc-dc booster and simple regulator. The device works away reliably but I have to top up the charge using the USB connector when working indoors.
Hope this helps,
JohnB
I successfully send at SF7 too, likely is the distance from the gateway. However, I read somewhere that ADR is not really working.
I have two MKRWANs running next to each other and I am using the MKRWAN library.
In the code I have
modem.setADR(true);
modem.dataRate(5);
First one is connected on SF9BW125, the second on SF7BW125.
I recently added the ArduinoLowPower.h to reduce the power consumption (time will show if that really helps)