Introduction: Getting Started With LoraWAN: Build a LoRa Node With Arduino and RN2483
I'm going to summarize how I built my first TTN node using an Arduino Uno and an RN2483 radio module. See this as a "How to get started" tutorial for first time builders. There are a lot of things this design can improve on, but this is at least a good place to start.
What you will need:
Arduino Uno (an Arduino Nano, or any other ATmega 328p, or Arduino compatible board should work too)
Microchip RN2483 LoRa module245
Step 1: Wiring
Solder wires to the pins marked with red dots in the top view diagram below. It is better to use stranded wire, as solid core wire tends to easily break off when you solder directly to the radio's pins.
You might also want to add a 8.6cm piece of wire to pin 23 (RFH) to act as antenna. Solid core wire does however work better in this case to keep the antenna straight.
Now connect the RN2483's wires to the Arduino like this:
RN2483 pin name <--> Arduino pin number
UART_TX (6) <--> 10
UART_RX (7) <--> 11
RESET (32) <--> 12
VDD (34) <--> 3.3V
GND (33) <--> Gnd
Step 2: Software
Next on to the software side.
Download the zip file containing the code from my github repository: https://github.com/jpmeijers/RN2483-Arduino-Library
Follow the steps to install an Arduino library.
After you installed the library, in your Arduino IDE you can go to File -> Examples -> RN2483 Arduino Library -> ArduinoUnoNano-basic
On the TTN Dashboard which is currently available at https://console.thethingsnetwork.org, register a new application and a new device. Use the Crossing arrow symbol to randomly generate the device EUI.
My advice is to use ABP for your first node. You can change this in the Device settings. I would recommend you to also disable the Framecounter in the Device settings.
Back to Arduino:
Around line 87 in the example sketch you opened earlier you will see lines looking like:
//ABP: initABP("Dev Address", "App Session Key", "Network Session Key");
join_result = myLora.initABP("02017201", "8D7FFEF938589D95AAD928C2E2E7E48F", "AE17E567AECC8787F749A62F5541D522");
//OTAA: initOTAA("App EUI", "App Key");
//join_result = myLora.initOTAA("70B3D57ED00001A6", "A23C96EE13804963F8C2BD6285448198");
In the comments above both lines the values that should be filled in between braces are described. If you registered a node as ABP on the TTN Dashboard, you have to uncomment the initABP line, and copy the correct keys from the dashboard into the Arduino sketch. Note that this is a hexadecimal value, so only numbers (0-9) and the capital letters A-F are valid. The strings should not contain any other characters. Use the example keys in the sketch as guideline what it should look like.
Step 3: First Messages
Now you can upload the script to your Arduino and open the serialmonitor, set the baudrate to 57600 and you should see how it is TXing. In the console you can also see the messages coming in.