EP-0105: Difference between revisions
Line 228: | Line 228: | ||
[[File:Add_dt_sc16.png|none|480px]] | [[File:Add_dt_sc16.png|none|480px]] | ||
===How to use GPS Module with | ===How to use GPS Module with gpsd(Raspberry Pi)=== | ||
A)Install gpsd tools. | A)Install gpsd tools. | ||
<pre> | <pre> | ||
Line 259: | Line 259: | ||
ser.open() | ser.open() | ||
try: | try: | ||
print("Turn on GPS | print("Turn on GPS...") | ||
while True: | while True: | ||
ser.write(str.encode("AT+GPS=1\r")) | ser.write(str.encode("AT+GPS=1\r")) | ||
Line 284: | Line 284: | ||
</pre> | </pre> | ||
[[File:Gps-fix.png|none|500px]] | [[File:Gps-fix.png|none|500px]] | ||
===How to use GPS Module with C(Raspberry Pi)=== | |||
===How to use GPS Module with Python(Raspberry Pi)=== | |||
The following code is recommended to be executed using Python 3 and install the '''gpsd-py3''' library and '''GPS 2D/3D Fix''':<br> | |||
<pre> | |||
import gpsd | |||
# Connect to the local gpsd | |||
gpsd.connect() | |||
# Get gps position | |||
packet = gpsd.get_current() | |||
# See the inline docs for GpsResponse for the available data | |||
print(packet.position()) | |||
</pre> | |||
---- | |||
===How to use GPS Module with Java(Raspberry Pi)=== | |||
===How to use GPRS module 错误的,还在改=== | ===How to use GPRS module 错误的,还在改=== |
Revision as of 00:37, 3 July 2019
IoT Node(A)
Descriptions
Iot Node(A) is one of Docker Pi series module.
IOT Node(A) = GPS/BDS + GSM + Lora.
Features
- DockerPi Series
- Programmable
- Control directly(without programming)
- Extend the GPIO Pins
- GPS/BDS Support
- GSM Support
- Lora Support
- Can Stack with other Stack board
- Independent of the mainboard hardware (require I2C support)
Specifications
GPRS section
- 1. Low power consumption, standby sleep current <1mA
- 2. Support GSM/GPRS four frequency bands, including 850, 900, 1800, 1900MHZ;
- 3. GPRS Class 10;
- 4. Support GPRS data service, maximum data rate, download 85.6Kbps, upload 42.8Kbps;
- 5. Support standard GSM07.07, 07.05 AT commands, and access the serial port through I2C interface conversion.
- 6. AT commands support standard AT and TCP/IP command ports
GPS section
- 1. Support BDS/GPS joint positioning
- 2. Support A-GPS, A-BDS
- 3. Support standard SIM card
LORA section
- 1. Transmission distance:500 Meters (RF parameters: 0x50 @ China City)
- 2. Support FSK, GFSK, MSK, GMSK, LoRaTM and OOK modulation methods
- 3. Ultra-high receiver sensitivity as low as -141 dBm
- 4. Support preamble detection
- 5. Packet engine with CRC, up to 256 bytes
- 6. LORA transceiver indicator
- 7. Easy TX/RX by DockerPi
Mechanical Drawings
Gallery
On Board Modules Documentations
- A9G Module Spicification: File:A9g product specification.pdf
- A9G Module AT Command Manual: File:A9G AT COMMAND manual.pdf
- A9G GPRS Instruction Set v1.0 File:A9G gprs series module at instruction set v1.0.pdf
- GPRS C SDK: File:GPRS C SDK-master.zip
Technical Details
A9G Module
- A9G module offers two serial port.
- Use I2C <=> UART bridge for communication.
Serial Port | Module name |
---|---|
/dev/ttySC0 | GSM |
/dev/ttySC1 | GPS/BDS |
Register Map
Register Address | Function | Value |
---|---|---|
0x01 | LORA_TX1 | Lora TX Buffer 1 - User Data |
0x02 | LORA_TX2 | Lora TX Buffer 2 - User Data |
0x03 | LORA_TX3 | Lora TX Buffer 3 - User Data |
0x04 | LORA_TX4 | Lora TX Buffer 4 - User Data |
0x05 | LORA_TX5 | Lora TX Buffer 5 - User Data |
0x06 | LORA_TX6 | Lora TX Buffer 6 - User Data |
0x07 | LORA_TX7 | Lora TX Buffer 7 - User Data |
0x08 | LORA_TX8 | Lora TX Buffer 8 - User Data |
0x09 | LORA_TX9 | Lora TX Buffer 9 - User Data |
0x0a | LORA_TX10 | Lora TX Buffer 10 - User Data |
0x0b | LORA_TX11 | Lora TX Buffer 11 - User Data |
0x0c | LORA_TX12 | Lora TX Buffer 12 - User Data |
0x0d | LORA_TX13 | Lora TX Buffer 13 - User Data |
0x0e | LORA_TX14 | Lora TX Buffer 14 - User Data |
0x0f | LORA_TX15 | Lora TX Buffer 15 - User Data |
0x10 | LORA_TX16 | Lora TX Buffer 16 - User Data |
0x11 | LORA_RX1 | Lora RX Buffer 1 - User Data |
0x12 | LORA_RX2 | Lora RX Buffer 2 - User Data |
0x13 | LORA_RX3 | Lora RX Buffer 3 - User Data |
0x14 | LORA_RX4 | Lora RX Buffer 4 - User Data |
0x15 | LORA_RX5 | Lora RX Buffer 5 - User Data |
0x16 | LORA_RX6 | Lora RX Buffer 6 - User Data |
0x17 | LORA_RX7 | Lora RX Buffer 7 - User Data |
0x18 | LORA_RX8 | Lora RX Buffer 8 - User Data |
0x19 | LORA_RX9 | Lora RX Buffer 9 - User Data |
0x1a | LORA_RX10 | Lora RX Buffer 10 - User Data |
0x1b | LORA_RX11 | Lora RX Buffer 11 - User Data |
0x1c | LORA_RX12 | Lora RX Buffer 12 - User Data |
0x1d | LORA_RX13 | Lora RX Buffer 13 - User Data |
0x1e | LORA_RX14 | Lora RX Buffer 14 - User Data |
0x1f | LORA_RX15 | Lora RX Buffer 15 - User Data |
0x20 | LORA_RX16 | Lora RX Buffer 16 - User Data |
- 0x01 - 0x10 Write Only.
- 0x11 - 0x20 Read Only.
Register Address | 0x22 | |||||||
---|---|---|---|---|---|---|---|---|
Name | - | SpreadingFactor | SignalBandwidth | ErrorCoding | ||||
Default Value | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 |
Description | Reserved | Band range 7-12 | Spread spectrum bandwidth 6-9 | Effective data ratio 1-4 |
- It is recommended to keep the default unless you know the meaning of the LORA parameter.
Register Address | 0x23 | |||||||
---|---|---|---|---|---|---|---|---|
Default Value | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Description | L_SET | G_RESET | Reserved | Reserved | Reserved | Reserved | L_RXNE | L_TX |
- L_SET(Write Only)
- Write 1 to set parameters from 0x22 to LORA Module.
- Write 0 not effect
- G_RESET(Write Only)
- Write 1 to reset A9G Module
- Write 0 not effect
- L_RXNE(Read & Write)
- Write 1 cause error
- Write 0 to clear
- Read 1 means data has been received, please get the data from the register 0x11 - 0x20.
- Read 0 means no data available now.
- L_SET(Write Only)
- Write 1 to send data,please fill in the data in register 0x01 - 0x10 before send.
- Write 0 not effect
How to use
How to assemble
- Mount the Iot Node(A) board to Raspberry Pi
- Hookup GPS antana and Lora antana to IPX port.
- Screws the GPRS antana on the SMA port.
Configuring I2C(Raspberry Pi)
Run sudo raspi-config and follow the prompts to install i2c support for the ARM core and linux kernel
Go to Interfacing Options
then I2C
Enable!
Done!
Replace /boot/overlays/sc16is752-i2c.dtbo(Raspberry Pi)
Replace /boot/overlays/sc16is752-i2c.dtbo file with this file: File:Sc16is752-i2c.zip
Modify /boot/config.txt file and add following parameter:
dtoverlay=sc16is752-i2c
How to use GPS Module with gpsd(Raspberry Pi)
A)Install gpsd tools.
sudo apt install gpsd gpsd-clients
B)Modify /etc/default/gpsd file and add following parameters:
DEVICES="/dev/ttySC1" GPSD_OPTIONS="-F /var/run/gpsd.sock"
C)Enter command i2cset -y 1 0x16 0x23 0x40 to reset the GPRS module.
D)Python Script For Open GPS:
import serial import os import time # Restart gpsd service. os.system("sudo systemctl restart gpsd.socket") # Open serial port ser = serial.Serial('/dev/ttySC0', 115200) i = 0 if ser.isOpen == False: ser.open() try: print("Turn on GPS...") while True: ser.write(str.encode("AT+GPS=1\r")) size = ser.inWaiting() if size != 0: ticks = time.time() response = ser.read(size) gps = str(response,encoding="utf-8") if(gps.find("OK") != -1): os.system("sudo cgps -s") exit() else: i = i + 1 print("Waiting GPS Enable, If the time is too long, Please test outdoors:" + str(i)) ser.flushInput() time.sleep(1) except KeyboardInterrupt: ser.flushInput() ser.close()
E)Save it and execute it:
python3 GPS.py
How to use GPS Module with C(Raspberry Pi)
How to use GPS Module with Python(Raspberry Pi)
The following code is recommended to be executed using Python 3 and install the gpsd-py3 library and GPS 2D/3D Fix:
import gpsd # Connect to the local gpsd gpsd.connect() # Get gps position packet = gpsd.get_current() # See the inline docs for GpsResponse for the available data print(packet.position())
How to use GPS Module with Java(Raspberry Pi)
How to use GPRS module 错误的,还在改
- Insert the SIM card(It may need you purchase from ISP vendor).
- Create a file named gprs.py
- Paste follow code into the file and save it.
#!/usr/bin/env python3 import serial import time import smbus import operator import os print("Waiting for initializing...") bus.write_byte_data(0x16,0x23,0x40) time.sleep(2) bus = smbus.SMBus(1) ser = serial.Serial('/dev/ttySC0', 115200) if ser.isOpen == False: ser.open() try: print('-'*60) print("Initializing A9G GPRS module.") print("GSM connecting...") time.sleep(3) i = 0 while True: ser.write(str.encode("AT+CCID\r")) size = ser.inWaiting() if size != 0: ticks = time.time() response = ser.read(size) ccid = str(response,encoding="utf-8") if(ccid.find("89860") != -1): ccid_result_tmp1 = ccid.splitlines() ccid_result = ccid_result_tmp1[2].split(": ") if len(ccid_result) > 1: print("SIM card OK, Network access testing is normal. Please check whether the card serial number is the same. number:" + ccid_result[1]); time.sleep(3) print('-'*60) else: i = i + 1 print("Waiting network, If the time is too long, it may be a malfunction, or the SIM card is bad.:" + str(i)) ser.flushInput() time.sleep(1) except KeyboardInterrupt: ser.close()
- Add executable rights and run:
chmod +x gprs.py ./gprs.py
GPRS Connect with PPPd(Raspberry Pi)
A) First, replace the /boot/overlays/sc16is752-i2c.dtbo and make sure I2C is working properly.
B)Enter command i2cset -y 1 0x16 0x23 0x40 to reset the GPRS module.
C)Enter command sudo apt install ppp to install ppp tools.
D)Copy /etc/ppp/peers/provider to /etc/ppp/peers/gprs E)Modify /etc/ppp/peers/gprs
- Line 10 : Please consult your service provider for the user (Example:cmnet).
- Line 15 : Please consult your service provider for the apn (Example:cmnet).
- Line 18 - Line 24:Recommended setting
F)Modify /etc/chatscripts/gprs (Change Line 34 to Line 35)
G)Enter command sudo pppd call gprs to dial up.
H)Check your ppp config from your ISP.
I)Enter command ping -I ppp0 8.8.8.8 test your network (If Internet available)
How to use Lora module
- Principle:
<pre. The transmitting device performs data transfermation role by transmitting data to each of the register addresses from 0x01 to 0x10. The receiving device acquires the transmitted data by reading data from each register of 0x11~0x21.
- Data sending example
Create a file named lora_sender.py and then copy and paste following code:
#!/usr/bin/env python3 import time import smbus import os import sys bus = smbus.SMBus(1) try: print("Initialize LORA transmitter open") bus.write_byte_data(0x16,0x23,0x01) # 0x01 means "send user data" # specify the data that you want to send. # for example, if you want to send 4 data to receiver, you put them in a list. # although you can input 10 set of data due to you have 10 register to use. data_list = [170,85,165,90] # define the register list that you want to use. register_list = [0x01,0x02,0x03,0x04] # write data to register and then the data will be send out. for index in range(0, len(data_list)): bus.write_byte_data(0x16,register_list[index],data_list[index]) print("LORA send data to %d register %d data" %(register_list[index], data_list[index]) time.sleep(1) except KeyboardInterrupt: sys.exit() finally: print("Quit the sending data program")
- Save it and run it:
chmod +x lora_sender.py python3 lora_sender.py
- Receiving Data Example:
Create a file named "lora_receiver.py" and then copy and paste following code:
#!/usr/bin/env python3 import time import smbus import os import sys bus = smbus.SMBus(1) try: print("Initialize LORA transmitter open") bus.write_byte_data(0x16,0x23,0x02) # 0x02 means "read user data" # create a list to receive data from sender. resv_data = [] # define the register list that you want to read from. register_list = [0x11,0x12,0x13,0x14] #Read each register's data and append to resv_data list. for index in range(0,len(register_list)): resv_data.append(bus.read_byte_data(0x16, register_list[index]) print("Received data:") print(resv_data) time.sleep(1) except KeyboardInterrupt: sys.exit() finally: print("Quit the receiving data program.")
- Save it and run it:
chmod +x lora_receiver.py python3 lora_receiver.py
Package Include
- 1 x IoT Node(A) Board
- 4 x M2.5*11mm Copper stick
- 4 x M2.5 Nuts
- 1 x Instructions
FAQ
- Q: GPS Status always NO FIX?
A: GPS must be used outdoors,It may take up to 15 minutes for the first use.
- Q: Unable to open serial port?
A: Check permissions, dialout groups, and whether other software is occupying the serial port.
- Q: PPP No internet access,How can I do?
A: Consult your ISP service provider.
- Q: Dose CDMA Support?
A: No.
- Q: I can't use the BDS system.
A: Available only in China and parts of Asia.
- Q: The network speed is too slow.
A: 2G network is unable to compare speed with 5G network.
- Q: Can I use other GPS antennas?
A: Yes, but please be careful not to use antennas that exceed the GPS power limit.
Keywords
- IoT, lora, GPS, GPRS, GSM, antana, Raspberry pi 3B, Node, radio devices