Difference between revisions of "MakaPython Lora"

From MakerFabsWiki
Jump to: navigation, search
(Introduction)
(Usage)
 
(17 intermediate revisions by one other user not shown)
Line 4: Line 4:
 
whilst minimising current consumption.<br>
 
whilst minimising current consumption.<br>
  
[[File:MakePython_Lora_1.jpg|500px]]<br>
+
[[File:MakePython_Lora_01.jpg|500px]]<br>
  
 
Makepython Lora need to be work with Makepython ESP32, can be acted as a Lora Gateway.<br>
 
Makepython Lora need to be work with Makepython ESP32, can be acted as a Lora Gateway.<br>
[[File:MakePython_Lora_2.jpg|500px]]<br>
+
[[File:MakePython_Lora_02.jpg|500px]]<br>
[[File:MakePython_Lora_3.jpg|500px]]<br>
+
<br>
 
[[File:MakePython_Lora_4.jpg|500px]]<br>
 
[[File:MakePython_Lora_4.jpg|500px]]<br>
  
Line 31: Line 31:
 
| align="center" | 915MHz
 
| align="center" | 915MHz
 
|}
 
|}
 +
 +
[[File:MakePython_Lora_5.jpg|500px]]<br>
 +
Free ISM bands world Wide(come from TI)<br>
  
 
== Features ==
 
== Features ==
*Micro SIM connector
+
[[File:MakePython_Lora_6.jpg|700px]]<br>
*Support AT Command
+
 
*Quad-band: 850/900/1800/1900Mz
+
== Pin ==
*Support GPS
 
*Support GPRS data traffic, the maximum data rate, download 85.6Kbps, upload 42.8Kbps
 
*Support SMS text messaging
 
*Support Micro SD Card
 
*Working Temperature: -40 – 85℃
 
*Size: 70*32.6mm
 
  
== Interface Function ==
+
The following diagram shows the pin arrangement , top view.<br>
[[File:MakePython_A9G_2.JPG|700px]]<br>
+
[[File:MakePython_Lora_7.jpg|700px]]<br>
①BAT: 3.7V Lipo battery connector<br>
 
②CHRG: 5V power input<br>
 
③Micro SD Card Holder<br>
 
④Micro SIM Card Holder<br>
 
⑤A9G Module<br>
 
⑥GSM: GSM Antenna IPX Interface<br>
 
⑦GPS: GPS Antenna IPX Interface<br>
 
  
 
==Usage==
 
==Usage==
Warning: Don't operate when in power supply on (That is, don’t plug or unplug the Antenna ,SIM Cars, SD Card , in case of short-circuit that may burn the IC down.)<br>
+
The routine uses MicroPython for programming, and two Lora gateways are used for long-distance communication in the complex environment of the city. The actual test distance reaches 2.8 kilometers. If the interference is small in the suburbs, the distance will be farther.<br>
 
 
===Related instructions===
 
<pre>
 
AT+GPS=1  #1:Turn the GPS on, 0:Turn the GPS off
 
AT+CCID   #Query SIM, unique serial number, can be used to judge whether the card is normal
 
AT+CREG?  #Check the registration status of the network
 
AT+CSQ   #Query signal strength, the first parameter is the signal strength value
 
AT+CGATT=1  #Attach to the network, if you need to access the Internet, this command is mandatory
 
AT+CGDCONT=1,”IP”,”CMNET” #Set PDP parameters
 
AT+CGACT=1,1   #Activate PDP, you can go online after activation
 
AT+GPSRD=N   #N is a number indicating that a NEMA message is read every N seconds
 
AT+GPSRD=0   #Stop reporting
 
AT+LOCATION=2  #Get the address information of GPS, as long as the GPS can see the satellite before returning, otherwise it will return GPS NOT FIX NOW
 
AT+CPMS="SM","SM","SM"  #Set up SMS storage unit
 
AT+CMGF=0/1 #Set the SMS format, 1 for text format reading, 0 for pud format reading
 
AT+CMGR=x #Read SMS content, x is the number of SMS
 
AT+CMGL=4/"ALL"   #View the SMS list. The reading parameter in PUD format is 4, and the reading parameter in txt format is "ALL"
 
AT+CMGD=1 #Delete the text message. If you use AT + CMGD = 1,4 then delete all SMS
 
</pre>
 
 
 
===Project_1: Shows the GPS location on OLED display===
 
Attention: To get GPS location, please ensure you are outdoor, and plug the GPS Antenna. Indoor may get the incorrect location or no location information.<br>
 
 
<br>
 
<br>
This MakePython A9G can do nothing. It needs a microcontroller like ESP32 to drive it. The following two routines are implemented by A9G with MakePython ESP32, they can be directly combined to achieve various functions.<br>
+
You can get ESP32 from here: [https://www.makerfabs.com/makepython-esp32.html Makepython ESP32]<br>
[[File:MakePython_A9G_3.JPG|700px]]<br>
+
[[File:MakePython_Lora_8.jpg|500px]]<br>
You can get MakePython ESP32 from here:  
 
https://www.makerfabs.com/makepython-esp32.html<br>
 
Step:<br>
 
1. Plug in the GPS antenna<br>
 
2. Plug to MakePython ESP32, connect the USB to the PC.<br>
 
[[File:MakePython_A9G_4.JPG|700px]]<br>
 
3. Sample code, or you can get it from here: [https://github.com/Makerfabs/MakePython-A9G A9G_GPS.py]<br>
 
<pre>
 
from machine import UART,Pin,I2C
 
import machine
 
import ssd1306
 
import utime
 
 
 
uart = UART(2, baudrate=115200, rx=16, tx=22,timeout=10)
 
i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000)      #Init i2c
 
lcd=ssd1306.SSD1306_I2C(128,64,i2c)         
 
 
 
A9G_RESET_PIN = Pin(33, Pin.OUT)
 
A9G_RESET_PIN.value(0)            #set pin to low
 
 
 
utime.sleep_ms(2000)
 
A9G_PWR_KEY = Pin(21, Pin.OUT)
 
A9G_PWR_KEY.value(0)
 
utime.sleep_ms(2000)
 
A9G_PWR_KEY.value(1)
 
utime.sleep_ms(20000)
 
 
 
#Display line wrap
 
p=0
 
def text(string,c=0,r=0):
 
    global p
 
    if p>80:
 
        p=0
 
        lcd.fill(0)
 
    colum=int(len(string)/15)+2
 
    i=0
 
    for a in range(0,colum):
 
        lcd.text(string[i:i+15],c,a*8)
 
        i=i+15
 
    lcd.show()
 
 
 
if True:
 
  lcd.fill(0)
 
  uart.write('AT+GPS=1\r\n')#1: turn on GPS  0:Turn off GPS
 
  utime.sleep_ms(1000)
 
  uart.write('AT+GPSRD=10\r\n')
 
  utime.sleep_ms(1000)
 
  uart.write('AT+LOCATION=2\r\n')
 
  utime.sleep_ms(1000)
 
  while True:     
 
    if uart.any():
 
      uart.write('AT+LOCATION=2\r\n') #Get GPS address
 
      bin_data = uart.readline()
 
      print(bin_data)
 
      lcd.fill(0)
 
      text(bin_data,0,0) 
 
      lcd.show()
 
    utime.sleep_ms(2000)
 
</pre>
 
4. The screen displays GPS information.<br>
 
[[File:MakePython_A9G_5.JPG|700px]]<br>
 
 
 
===Project_2: Display SMS message on OLED display===
 
Please note that each text message may require some fees depending on your local GSM operator, make sure the SIM card is active, and leave enough money for this application.<br>
 
 
<br>
 
<br>
This example also requires MakePython ESP32.<br>
 
 
Step:<br>
 
Step:<br>
1. Plug in the GSM antenna<br>
+
1. Plug the antenna and MakePython ESP32 into MakePython Lora, assemble into Lora Gateway, and connect the USB cable.<br>
2. Insert a mini SIM card(GPS does work without a SIM)<br>
+
2. Download the code from here: [https://github.com/Makerfabs/MakePython-Lora/tree/master/Lora%20Gateway/Code_433M Code_433M]. (Note: Please select different files for downloading [https://github.com/Makerfabs/MakePython-Lora/tree/master/Lora%20Gateway Lora] modules in different frequency bands)<br>
[[File:MakePython_A9G_6.JPG|700px]]<br>
+
3. Upload all the xxx.py files in the Code_433M file to two ESP32 Lora Gateeay.<br>
3. Plug to MakePython ESP32, connect the USB to the PC.<br>
+
[[File:MakePython_Lora_9.jpg|700px]]<br>
4. Sample code, or you can get it from here: [https://github.com/Makerfabs/MakePython-A9G A9G_GSM.py]<br>
+
4.After the upload is successful, press the MakePython ESP32 reset button.<br>
<pre>
+
5.Test Results<br>
from machine import UART,Pin,I2C
+
Two people are measuring in a city with a complex environment:<br>
import machine
+
[[File:MakePython_Lora_13.jpg|500px]]<br>
import ssd1306
+
The test distance is 2.8 kilometers, if you go to the suburbs, the distance will be farther.<br>
import utime
+
[[File:MakePython_Lora_12.jpg|500px]]<br>
uart = UART(2, baudrate=115200, rx=16, tx=22,timeout=10)
 
i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000)      #Init i2c
 
lcd=ssd1306.SSD1306_I2C(128,64,i2c)         
 
A9G_RESET_PIN = Pin(33, Pin.OUT)
 
A9G_RESET_PIN.value(0)           
 
utime.sleep_ms(2000)
 
A9G_PWR_KEY = Pin(21, Pin.OUT)
 
A9G_PWR_KEY.value(0)
 
utime.sleep_ms(2000)
 
A9G_PWR_KEY.value(1)
 
utime.sleep_ms(20000)
 
p=0
 
def text(string,c=0,r=0):  
 
    global p
 
    if p>80:  
 
        p=0
 
        lcd.fill(0)
 
    colum=int(len(string)/15)+2
 
    i=0
 
    for a in range(0,colum):
 
        lcd.text(string[i:i+15],c,a*8)
 
        i=i+15
 
    lcd.show()
 
if True:
 
    uart.write('AT+GPS=0\r\n')#1: turn on GPS  0:Turn off GPS
 
    utime.sleep_ms(1000)
 
    uart.write('AT+CCID\r\n')
 
    utime.sleep_ms(1000)
 
    uart.write('AT+CREG?\r\n')
 
    utime.sleep_ms(1000)
 
    uart.write('AT+CGATT=1\r\n')
 
    utime.sleep_ms(1000)
 
    uart.write('AT+CGACT=1,1\r\n')
 
    utime.sleep_ms(1000)
 
    uart.write('AT+CGDCONT=1,\"IP\",\"CMNET\"\r\n')
 
    utime.sleep_ms(1000)
 
    uart.write('AT+CSQ\r\n')
 
    utime.sleep_ms(1000)
 
    uart.write('AT+CPMS="SM","SM","SM"\r\n')
 
    utime.sleep_ms(1000)
 
    uart.write('AT+CMGF=1\r\n')
 
    utime.sleep_ms(1000)
 
    #uart.write('AT+CMGL="ALL"\r\n')
 
    #utime.sleep_ms(1000)
 
    while True:    
 
      if uart.any():
 
        lcd.fill(0)
 
        uart.write('AT+CMGR=1\r\n')
 
        utime.sleep_ms(1000)
 
        bin_data = uart.readline()
 
        print(bin_data)
 
        text(bin_data,0,0)
 
        lcd.show()
 
      utime.sleep_ms(2000)
 
</pre>
 
4. The screen displays the phone number, time and information for sending SMS.<br>
 
[[File:MakePython_A9G_7.JPG|500px]]<br>
 
*Mobile phone to send SMS.<br>
 
[[File:MakePython_A9G_8.JPG|700px]]<br>
 
*Display the phone number and time of sending SMS<br>
 
[[File:MakePython_A9G_10.JPG|700px]]<br>
 
*Show received content
 
  
 
== FAQ  ==
 
== FAQ  ==
Line 224: Line 65:
  
 
== Resources ==
 
== Resources ==
*[https://www.makerfabs.com/wiki/images/a/a0/Gprs_series_module_at_instruction_set_v1.0%28A9_A9G%29.pdf AT Command Set]
 

Latest revision as of 01:51, 18 June 2020

Introduction

The Makepython Lora transceivers feature the LoRaTM long range modem that provides ultra-long range spread spectrum communication and high interference immunity whilst minimising current consumption.

MakePython Lora 01.jpg

Makepython Lora need to be work with Makepython ESP32, can be acted as a Lora Gateway.
MakePython Lora 02.jpg

MakePython Lora 4.jpg

The Makepython Lora offers bandwidth options ranging from 7.8125kHz to 500 kHz with spreading factors ranging from 6 to 12, there are three choice of the working frequency.

Item Lora Moduie Working frequency
MakePython Lora 433M RFM98W-433MHz 433MHz
MakePython Lora 868M RFM98W-868MHz 868MHz
MakePython Lora 915M RFM98W-915MHz 915MHz

MakePython Lora 5.jpg
Free ISM bands world Wide(come from TI)

Features

MakePython Lora 6.jpg

Pin

The following diagram shows the pin arrangement , top view.
MakePython Lora 7.jpg

Usage

The routine uses MicroPython for programming, and two Lora gateways are used for long-distance communication in the complex environment of the city. The actual test distance reaches 2.8 kilometers. If the interference is small in the suburbs, the distance will be farther.

You can get ESP32 from here: Makepython ESP32
MakePython Lora 8.jpg

Step:
1. Plug the antenna and MakePython ESP32 into MakePython Lora, assemble into Lora Gateway, and connect the USB cable.
2. Download the code from here: Code_433M. (Note: Please select different files for downloading Lora modules in different frequency bands)
3. Upload all the xxx.py files in the Code_433M file to two ESP32 Lora Gateeay.
MakePython Lora 9.jpg
4.After the upload is successful, press the MakePython ESP32 reset button.
5.Test Results
Two people are measuring in a city with a complex environment:
MakePython Lora 13.jpg
The test distance is 2.8 kilometers, if you go to the suburbs, the distance will be farther.
MakePython Lora 12.jpg

FAQ

You can list your questions here or contact with support@makerfabs.com for technology support.

Resources