There are a few tips spread over the forum and I want to bring the end-to-end instructions together here on how to get it to work. I still would go for the M0 based Lora for memory and processing power but I like to be able to refer to a true atmel for best support for hooking up any sensor or display based on libraries. What’s great about both is that the communication module and the microcontroller are on one board already. Batterypowerwise I still need to find out how low it can go (below self-discharge rate of battery). I used Arduino 1.8.2 on a Mac - your milage may vary.
Get an Adafruit Feather 32u4 lora with the right frequency range for your region (866 for Europe)
Follow instructions on the adafruit site to hook up antenna and power supply
Connect pin 6 with IO1 (as labeled on the feather)
Do not use the built-in support for finding and download the lmic library - rather follow the instructions and download the zip file from github instead, and also do the modification described in the tutorial
Remove all mentions of bmp280 sensor and temperatur and pascal from the sample source code and instead send the following data as a test without sensors: byte buffer[2] = {1,2};
Change the pins to match the feather 32u4 lora like this:
just checking: you have a (full) gateway near enough and it is operational (shows up in the console of the owner of the gateway as online)?
i never expected the otaa onboarding to work right away given that i had only read other people’s tips and plugged it together. it did work right away (“joining” is followed by something like “joined”) and continues to work (joined again also after power off and on of the node).
I had the same problem because the node and thr gateway were too close, about 3 meters.
Try standing between the antennas. so they don’t see each other anymore.
That cured my problem…
Im so glad I found this page, ihave been looking todo the same thing for weeks now, I have a multitech gateways connected to ttn and its working. (tested with other devices) I have now bought the 32u4 feather and need to get it working, i followed all steps but when i load the code the red led on the feather flashes for 5 seconds and stops flashing, there is no activity in the serial monitor or on ttn, i have a suspicion that my implementation of the keys are not correct. can some one post there key section of the arduino code or share the entire sketch as an example ?
i managed to get it working after redoing it again but the serial window is still inactive,
Must i enable debugging somewhere? seeing your example code will still be great!
One step you might add… Change the radio frequency range in the lmic config.h (I’m in Canada at 915MHZ, but the default code is 868).
This got me one step closer… I see data now on the gateway but mostly EV_JOIN_FAILED in the Serial output.
On the TTN Console I see Join Request at 904.6MHz and Join Accept at 923.9MHz… but I thought my 8 gateway frequencies are centered on 904.3 and 905.0???
What gateway are you using? I am based in south africa and the 868mhz is correct for my location.
Have you defined the semtech chip(1272 or 1276) you are using in the config file ?
Are you using a feather for the node device ?
I have managed to succesfully send data to TTN. the serial monitor as you mentioned outputs " started" and then “EV join” and nothing else. but the system is running in the background s i get a packet of data once a minutes.
Im not sure if the serial log is buggy or if its due to the sleep procedure that switched everything off when done transmitting.
I’ve made a gateway from the RisingHF board set (RHF0M301 concentrator board). It is setup for 915MHz… I got it working initially with the RisingHF RaspberryPi image and their pktfwd executable, but now I’ve switched over to the ic880a howto, with the necessary tweeks for the RHF board.
I finally got the Adafruit 32u4 LoRa node to work… just now! The trick turned out to be careful placement of the Clock Error adjustment…
!!! You really have to put the LMIC_setClockError(MAX_CLOCK_ERROR * 1 / 100); after the LMIC_Reset(); !!!
Didn’t Join at all until I did that after every reset… I will look into exactly where it is needed but it didn’t work in the original place.
I had better luck coming out of sleep after I disabled all the Serial calls… I don’t think the UART recovers properly or something.
I do see long stretches of missing data sometimes, even now…
Glad to see you go it working, I was just as relieved when i saw the info coming through the first time, iv given up trying to understand why the serial does not work, want to get my head around the code and then rewrite it to make sure everything works correctly. the long strehces of missing data i suspect is due to the sleep routine and the LMICsetClockError(MAX_CLOCK_ERROR * 1 / 100); change. You will see if you take the sleep cycle down to 1 (every 8 seconds) you are lucky to get a transmission every 30 seconds. Good luck with that if you figure out why this happens i would like to know myself.
I am now trying to implement Arduino -> TTN -> Cayenne via the LLP protocol for custom info.
I disabled all my Serial code and switched the LED Pin to 13 (the 32u4 Lora has dedicated SPI pins so the LED seems to work fine). I use the LED to show basic functionality (like blinking it very briefly every transmit) so I can now see the device comes out of sleep reliably after joining and transmits every 20 seconds or so (two cycles).
Problem now is that many gaps in data counter appear… the radio often uses frequencies that aren’t part of a little 8-channel gateway in America (72 channels available). So I’ve been trying to use the LMIC_disableChannel to restrict the node to available frequencies in my gateway but it seems to often ignore it and different forks of LMIC have different behaivour w.r.t the channels that get disabled and whether or not they honour the settings!
I’m using OTAA. The gateway I’ve set up uses the TTN frequency plan (global_conf.json) which sets up 8+1 channels, but the LMIC Arduino library uses all the channels available by default and there seems to be multiple issues with the LMIC_disableChannel() function since it seems to ignore the settings and appears to broadcast on disabled channels… so I get lots of gaps in my Counter sequence due to missed packets.
O.k. counter gaps seem to be resolved… you need to disable the unused channels (or sub-bands with LMIC_disableSubBand() ) after the reset of the LMIC library.
// initial job
static void initfunc (osjob_t* j) {
// reset MAC state
LMIC_reset();
// Let LMIC compensate for +/- 1% clock error
LMIC_setClockError(MAX_CLOCK_ERROR * 1 / 100);
// Disable subbands not supported by TTN 915MHz plan
for (int i=0;i<8;i++)
if (i != 1)
LMIC_disableSubBand(i);
// start joining
LMIC_startJoining();
// init done - onEvent() callback will be invoked...
}
It is very specific to the TTN 915MHz plan… basically they only use SubBand 1.
With this in place my node joins in about 4 seconds or so and I see all eight channels being used randomly… not sure when the 500kHz channel will be used.
Also, I found each LMIC fork to be a little different. I settled on the MCCI Catena LMIC fork which seems to be the most up-to-date and oriented to 915MHz.