Steps to connect to TheThingsnetwork with simple LoRaWAN setup

This are my simple steps to setup my "personal gateway" and my simple node and connect them to TheThingsNetwork LoRaWAN network.

I bought in the local component,s shop (chipcad.hu) a HopeRF RF92W LoRa module and a Microchip RN2483 LoRaWAN module.
I put on a small pice of PCB the RF92W modul, connected the wires to the RaspberryPi connector pins, following the instruction in the Readme of  Thomas Telkamp,s git repo:
https://github.com/tftelkamp/single_chan_pkt_fwd

Connections
-----------
SX1272 - Raspberry

3.3V   - 3.3V (header pin #1)
GND       - GND (pin #6)
MISO   - MISO (pin #21)
MOSI   - MOSI (pin #19)
SCK    - CLK (pin #23)
NSS    - GPIO6 (pin #22)
DIO0   - GPIO7 (pin #7)
RST    - GPIO0 (pin #11)

Download the code to a fresh raspbian, configure the main.cpp section with my data:

// Set location
float lat=0.0;
float lon=0.0;
int   alt=0;

/* Informal status fields */
static char platform[24]    = "Single Channel Gateway";  /* platform definition */
static char email[40]       = "";                        /* used for contact email */
static char description[64] = "";                        /* used for free form description */

Compile the program, and run it. It send back this broadcast messages in every minutes:

Gateway ID: b8:27:eb:ff:ff:b2:3b:90
Listening at SF7 on 868.100000 Mhz.
------------------
stat update: {"stat":{"time":"2016-02-08 15:11:36 GMT","lati":47.48000,"long":19.07000,"alti":110,"rxnb":0,"rxok":0,"rxfw":0,"ackr":0.0,"dwnb":0,"txnb":0,"pfrm":"Single Channel Gateway","mail":"hg5apz@gmail.com","desc":"Budapest, Jozsef krt"}}

After some minutes it appeared on the ttn network,s map page (if my Raspberry is running)
http://www.ttnmap.org/
and you can check its status here:
http://thethingsnetwork.org/api/v0/gateways/B827EBFFFFB23B90/



Next step was to navigate to the ttn network,s registration page, registering myself. After this I went to the wiki,s AddressSpace page, allocate a small address block for my nodes. This was the last available block:
02:D1:DA:xx     Budapest Jozsef krt (HU)
http://thethingsnetwork.org/wiki/AddressSpace

After this I started to deal with my simple, experimental node setup.
This is very poor, I put the Microchip LoRaWAN module to a small piece of PCB too, extended it a small coax cabel and piece of wire approx length is 8 cm at the end on the coax.
I made connections on the modules RX and TX pins, use a small 5V to 3.3 V stab, to produces the power to the module from an USB source.
I connected it through a 3.3 Volt level FTDI serial to usb cabel to my desktop.
After this I get the Marten,s python code from here:
http://svn.martenvijn.nl/svn/lora/microchip-mote-tx.py
Change a little, applay the first registered address from my address block, as my node devaddress, change the usb serial port to /dev/ttyUSB0, where my "cabel" appeares.
Change the msg variable:
 msg="aa"
to my callsign, encoded the text into hex, with a simple python line:
>>> "hg5apz".encode("hex")
'68673561707a'
>>>
msg="68673561707a"
and I started the python prog.
Some minutes later I explored on my RaspberryPi monitoring window in-between the beacon texts the received data packet from my node.
The transmitted data appeared on the ttn network API too, under my node ID-s, here:
http://thethingsnetwork.org/api/v0/nodes/02D1DA01/



After this I decided to put together a very simple sensor assembly:
I have laying around some DHT22 temp. and humidity sensor. I connected it to an Arduino Nano, chosed a library to it, compile it with the more simple output: print to the serial line only the value of the measured temp. and the humidity values.

One record looks like: 20.50 45.00
I inserted this values to the msg variable on the python script, configured the /dev/ttyUSB1 serial port for the arduino,s serial line.
Some minutes later I checked the transmitted data on the ttn API. Here is one sample record:

    {
        "rssi": -48,
        "data": "MjAuNTAgNDUuMDAgDQ==",
        "gateway_eui": "B827EBFFFFB23B90",
        "frequency": 868.1,
        "node_eui": "02D1DA01",
        "time": "2016-02-11T20:22:27.513Z",
        "snr": 10.0,
        "data_plain": "20.50 45.00 \r",
        "data_raw": "QAHa0QIA/AAFniFSXc5sAEQFcV70HCX13Fs=",
        "datarate": "SF7BW125"
    },




The next step:
I found a nice sensor visualizer page from Reading,s group here:
http://someconsultants.com/ttn/
It use the jquery.js and jquery.sparkline.js javascript to make the online chart on the web page.
It uses this websocket call, access to the node data:
 url = "http://thethingsnetwork.org/api/v0/nodes/02D1DA01/?format=json&limit=500";
and process them, and put them on the chart. This step isnot ready yet for my data...
Thats all.

Sat Feb 13 18:59:24 CET 2016

Janos Tolgyesi
hg5apz at gmail dot com

---------------------------------------------------------------------------------------------------------------------------------------------------------
We, here in Budapest are in a lucky position: in the last two months grow up a LoRaWAN network covered majority parts of the city. Many thanks to the boss of the ChipCad company, Tamas Holman, who is supported and installed 4 Kerlink gateways in the city, and allowed us to start to study and use this new technology too. Based on this knowledge we decided to start to organize another, voluntary based LoRaWAN network and would like to connect to TheThingsNetwork. We search and try to collect the activists, who dont want to build businnes on this technology, only use its advantages, offered as an open source and community resources. We would like to develop some unique, interesting use cases on our public places, in or community gardens and other collective points.


Some short notes about my first, small, "mobile" node:
Following the concept of JP Meijers, I built a "minimalist" node, to try to measure the coverage area of my single channel gateway, with the help of an android phone.
https://github.com/jpmeijers/ttnmapperarduino
This small device consists of a Microchip RN2483 LoRaWAN module and an Arduino Mini Pro 3.3 V version.
The practical problem was, how to turn the both PCB-s "face-to-face", to solder the necessary wires on the edges on the boards.
I use two small pieces of PCB-s to keep the 4 mm distances between the modules. You can follow this small tricks on the pictures.
It size is 18x38x12 mm (without battery), and weight is 8 gram.

( Click to see the original size of the images)

Tue Mar 15 09:42:23 CET 2016