Difference between revisions of "Dragino Lora/GPS HAT"
From ArmadeusWiki
(presentation) |
(presentation) |
||
Line 44: | Line 44: | ||
===Gateway=== | ===Gateway=== | ||
* https://github.com/tftelkamp/single_chan_pkt_fwd | * https://github.com/tftelkamp/single_chan_pkt_fwd | ||
+ | * To compile/install it: | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Buildroot !! Debian | ||
+ | |- | ||
+ | | | ||
<pre class="host"> | <pre class="host"> | ||
− | |||
$ make lora-forwarder | $ make lora-forwarder | ||
− | |||
− | |||
− | |||
− | |||
</pre> | </pre> | ||
+ | || | ||
+ | * [[AsDevices]] library (0.18+) is needed. Then: | ||
+ | <pre class="apf"> | ||
+ | root@opos6ul:~# git clone https://github.com/tftelkamp/single_chan_pkt_fwd.git | ||
+ | root@opos6ul:~# make CFLAGS="-c -Wall -I/usr/include/as_devices/" LIBS="-las_devices" | ||
+ | </pre> | ||
+ | |} | ||
<pre class="apf"> | <pre class="apf"> | ||
Line 62: | Line 70: | ||
# echo in > /sys/class/gpio/gpio9/direction | # echo in > /sys/class/gpio/gpio9/direction | ||
</pre> | </pre> | ||
− | * | + | * To get & printout UDP data received by gateway: |
<source lang="python"> | <source lang="python"> | ||
#!/usr/bin/python | #!/usr/bin/python |
Revision as of 17:36, 29 March 2017
Instructions to use the Dragino Lora/GPS HAT on OPOS6ULDev (thanks to RaspberryPi™ compatible connector).
Contents
LoRa™
Setup
- RESET is connected to RPi GPIO0 which is gpio24 on OPOS6UL set as output
- nSS is connected to RPi GPIO6, which is gpio97 on OPOS6UL set as output
- DIO0 is connected to RPi GPIO7, which is gpio10 on OPOS6UL set as input
- on recent models (like the one we tested) DIO1 is connected to RPi GPIO4, which is gpio18 on OPOS6UL set as input
- on recent models (like the one we tested) DIO1 is connected to RPi GPIO5, which is gpio19 on OPOS6UL set as input
- This Hat/Shield is using HOPERF RFM96W module (clone of Semtech's SX1276 ?) which is controlled through SPI bus.
# modprobe spidev
Testing that chip is recognized with python spidev
- Bring chip out of reset:
# echo 24 > /sys/class/gpio/export # echo out > /sys/class/gpio/gpio24/direction # echo 0 > /sys/class/gpio/gpio24/value # echo 1 > /sys/class/gpio/gpio24/value
- activate it:
# echo 97 > /sys/class/gpio/export # echo out > /sys/class/gpio/gpio97/direction # echo 0 > /sys/class/gpio/gpio97/value
- read ID (register 0x42):
import spidev
spi = spidev.SpiDev()
spi.open(3,0)
to_send=[0x42,0x00]
spi.xfer(to_send)
[255, 255]
Tested Software
Gateway
- https://github.com/tftelkamp/single_chan_pkt_fwd
- To compile/install it:
Buildroot | Debian |
---|---|
$ make lora-forwarder |
root@opos6ul:~# git clone https://github.com/tftelkamp/single_chan_pkt_fwd.git root@opos6ul:~# make CFLAGS="-c -Wall -I/usr/include/as_devices/" LIBS="-las_devices" |
# modprobe spidev # echo 9 > /sys/class/gpio/export # echo 24 > /sys/class/gpio/export # echo 97 > /sys/class/gpio/export # echo out > /sys/class/gpio/gpio97/direction # echo out > /sys/class/gpio/gpio24/direction # echo in > /sys/class/gpio/gpio9/direction
- To get & printout UDP data received by gateway:
#!/usr/bin/python
import socket
UDP_IP = "192.168.1.28"
UDP_PORT = 1700
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.bind((UDP_IP, UDP_PORT))
while True:
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
print "received message:", data
Node
To compile it on Buildroot: $ make lmic-pi To compile it on Debian: # wget https://github.com/ernstdevreede/lmic_pi/archive/master.zip # unzip master.zip # cd lmic_pi-master/lmic # make CFLAGS="-c -Wall -I/usr/include/as_devices/" LIBS="-las_devices" # cd ../examples/thethingsnetwork-send-v1/ # make CFLAGS="-Wall -I/usr/include/as_devices/ -I../../lmic" LDFLAGS="-las_devices" # chmod a+x thethingsnetwork-send-v1
# modprobe spidev # echo 9 > /sys/class/gpio/export # echo 18 > /sys/class/gpio/export # echo 19 > /sys/class/gpio/export # echo 24 > /sys/class/gpio/export # echo 97 > /sys/class/gpio/export # echo out > /sys/class/gpio/gpio97/direction # echo out > /sys/class/gpio/gpio24/direction # echo in > /sys/class/gpio/gpio9/direction # echo in > /sys/class/gpio/gpio18/direction # echo in > /sys/class/gpio/gpio19/direction
GPS
- GPS is connected to UART2 (/dev/ttymxc1)
- Use GPS to get time/date with NTP
Links
- http://www.dragino.com/products/module/item/106-lora-gps-hat.html
- http://wiki.dragino.com/index.php?title=Lora/GPS_HAT
LoRa is a registered trademark of Semtech.
RaspberryPi is a registered trademark of RaspberryPi Foundation.