Difference between revisions of "MakaPython A9G"

From MakerFabsWiki
Jump to: navigation, search
(AT command)
(AT command)
Line 51: Line 51:
 
AT+CMGR=x #Read SMS content, x is the number of SMS
 
AT+CMGR=x #Read SMS content, x is the number of SMS
  
#View the SMS list. The reading parameter in PUD format is 4, and the reading parameter in txt format #is "ALL"
+
#View the SMS list. The reading parameter in PUD format is 4, and the reading parameter in txt #format is "ALL"
 
AT+CMGL=4/"ALL"  
 
AT+CMGL=4/"ALL"  
 
AT+CMGD=1 #Delete the text message. If you use AT + CMGD = 1,4 then delete all SMS
 
AT+CMGD=1 #Delete the text message. If you use AT + CMGD = 1,4 then delete all SMS

Revision as of 06:21, 21 May 2020

Introduction

MakePython A9G is an IOT for GPRS / GSM + GPS module, users can use MicroPython to program it, which is very easy, especially for non-programmers. There is also a user guide to learn how to use the board to create the first IOT project, which allows beginners to quickly learn hardware and programming skills.

With this board, you will easy to add text, SMS and data to your project. It is good for your smart home project or GPS tracker and so on.

Model: OAC010A9G

Error creating thumbnail: File with dimensions greater than 12.5 MP

Features

  • Micro SIM connector
  • Support AT Command
  • Quad-band: 850/900/1800/1900Mz
  • 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

MakePython A9G 2.JPG
①BAT: 3.7V Lipo battery connector
②CHRG: 5V power input
③Micro SD Card Holder
④Micro SIM Card Holder
⑤A9G Module
⑥GSM: GSM Antenna IPX Interface
⑦GPS: GPS Antenna IPX Interface

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.)

AT command

Related instructions

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

#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+LOCATION=2   
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

#View the SMS list. The reading parameter in PUD format is 4, and the reading parameter in txt #format is "ALL"
AT+CMGL=4/"ALL"	 
AT+CMGD=1		#Delete the text message. If you use AT + CMGD = 1,4 then delete all SMS

Load Demo

#  https://thingspeak.com/channels/920821
from machine import UART,Pin
import utime
import dht
import machine

apiKey="P310JKLFLCY7B09G"
'''
d = dht.DHT11(machine.Pin(26))
d.measure()
d.temperature() # eg. 23 (°C)
d.humidity()    # eg. 41 (% RH)
'''
uart = UART(2, baudrate=115200, rx=16, tx=22,timeout=10)

count = 1

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)

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)
    #d.measure()
    temperature=23.5#d.temperature() # eg. 23 (°C)
    humidity=86.2#d.humidity()    # eg. 41 (% RH)
    print('\n\n===============CNT {}==============='.format(count))
    #cmdString= "AT+HTTPGET=\"http://api.thingspeak.com/update.json?api_key="+apiKey+"&field1="+(str)temperature+"&field2="+((str)humidity)+"&field3=0.0&field4=0.0"+"\""
    cmdString= "AT+HTTPGET=\"http://api.thingspeak.com/update.json?api_key="+apiKey+"&field1=35.5"+"&field2=86.2"+"&field3=0.0&field4=0.0"+"\""
    uart.write(cmdString+'\r\n')

    while True:      
      if uart.any():
        bin_data = uart.readline()
        #data_string=str((bin_data),'utf-8')
        #data_string=bin_data.encode("utf-8")
        print(bin_data)
        uart.write('AT\r\n')
      utime.sleep_ms(2000)

FAQ

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

Resources