My goal is to control at least 3 SIM800c hats using just one RPi but I'm not quite sure it will work.
- How will Rpi reference each hat?
- Can each hat make a call of their own?
For reference:
My goal is to control at least 3 SIM800c hats using just one RPi but I'm not quite sure it will work.
For reference:
Answer
I tried the following:
Inserted first SIM7600 HAT to Rpi4B and tested basic things OK, using Rpi on board TxD, RxD pins.
Repeated 1. with second SIM7600 HAT.
Tested two HATs at the same time, one inserted to Rpi, using TxD, RxD pins, the other using USB/TTL cable.
Tested both HATs at the same time, each with a separate USB/TTL cable. In other words, the Rpi's 40 pin connector is not used.
I preferred not to use the Rpi's on board 40 pin connector, because it is awkard plug and unplug 40 pins connector, risking bending the pins, causing poor contacts. Of course stacking two HATs together, makes it hard to access the buried pins and therefore troubleshooting messy.
After making sure the HAT's 40 pin connection are OK, then I just use two USB?TTL cables to access the HAT through the HAT's USB to UART micro USB socket. So far so good. I know I can use USB to USB communication, but that is rather complicated, and my first goal is to play with with GPS thing, so I did not try the Rpi USB direct to SIM7600 USB communication method.
You may like to look at a picture of my hardware setup below.
I also attached a sample program of the setup below. As I said, I switched to Neo-8M GPS modules and have not touched SIM7600 since 2020Mar. I am happy to try to do any tests you wish me to verify.
PS - I have also tried the 5 Rpi on board UARTS, but I am playing with SPI/I2C at the same time, so I gave up the multiple on bard UARTs and only use some 4 or 5 USB/UART cables, and found them handy and error free.
References
(2) SIM7X00 Series_GPS_Application Note_V1.00 - SimCom 2016jul12
Appendices
Appendix A - SIM7600 python test program sample
# sim7600_setup_2020mar1904.py tlfong01 2020mar19hkt1920
# ******************************************************************************
# *** Imports ***
from time import sleep
from datetime import datetime
import inspect
import RPi.GPIO as GPIO
import serial
# ******************************************************************************
# *** Serial Port Setup/Config ***
serPortTtyS0 = serial.Serial("/dev/ttyS0", 115200)
serPortTtyS0.flushInput()
# ******************************************************************************
# *** Serial Port Config Functions ***
def setupSerialPort(serialPort, baudRate):
serialPort = serial.Serial(port = serialPort,
baudrate = baudRate,
parity = serial.PARITY_NONE,
stopbits = serial.STOPBITS_ONE,
bytesize = serial.EIGHTBITS,
timeout= 1)
return serialPort
def setSerialPortBaudRate(serialPort, baudrate):
#print(' setting baudrate')
print(' baudRate =', baudrate)
serialPort.baudrate = baudrate
return
# ******************************************************************************
# *** GPIO Setup/Config ***
# *** General Gpio Functions ***
def setGpioPinNumberBCM():
#print('Begin setGpioPinNumberingSchemeBCM(), ...')
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
#print(' Pin numbering now set to BCM.')
#print('End setGpioPinNumberingSchemeBCM().')
#print(' ')
return
def cleanupGpio():
GPIO.cleanup()
return
# *** Setup/Init GPIO pin ***
def setupGpioPinOutputMode(gpioPin):
GPIO.setup(gpioPin, GPIO.OUT)
return
def setGpioPinHigh(gpioPin):
GPIO.output(gpioPin, GPIO.HIGH)
return
def setGpioPinLow(gpioPin):
GPIO.output(gpioPin, GPIO.LOW)
return
def setupGpioPinOutputModeInitLow(gpioPin):
setupGpioPinOutputMode(gpioPin)
setGpioPinLow(gpioPin)
return
# ******************************************************************************
# *** SIM7600 Setup Functions ***
def powerOnSim7600(powerKey):
print('Begin power on Sim7600, ...')
setGpioPinNumberBCM()
setupGpioPinOutputMode(powerKey)
sleep(0.1)
setGpioPinHigh(powerKey)
sleep(2)
setGpioPinLow(powerKey)
sleep(20)
print('End power on Sim7600.')
return
def setupSim7600(serialPort, baudRate, powerKey):
print('Begin setting up Sim7600, ...')
setupSerialPort(serialPort, baudRate)
serialPortTtyS0.flushInput()
powerOnSim7600(powerKey)
print('End setting up Sim7600.')
return
# ******************************************************************************
# *** AT Command Functons ***
def testAtCommands():
print('Begin testing AT commands, ...()')
print('End testing AT commands, ...()')
return
# *** Main ***
setupSim7600(serialPort = serialPortTtyS0, baudRate = 115200, powerKey = 6)
# *** End ***
def power_on(power_key):
print('SIM7600X is starting:')
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(power_key,GPIO.OUT)
time.sleep(0.1)
GPIO.output(power_key,GPIO.HIGH)
time.sleep(2)
GPIO.output(power_key,GPIO.LOW)
time.sleep(20)
ser.flushInput()
print('SIM7600X is ready')
ser = serial.Serial("/dev/ttyS0",115200)
ser.flushInput()
power_key = 6
command_input = ''
rec_buff = ''
def power_on(power_key):
print('SIM7600X is starting:')
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(power_key,GPIO.OUT)
time.sleep(0.1)
GPIO.output(power_key,GPIO.HIGH)
time.sleep(2)
GPIO.output(power_key,GPIO.LOW)
time.sleep(20)
ser.flushInput()
print('SIM7600X is ready')
def power_down(power_key):
print('SIM7600X is loging off:')
GPIO.output(power_key,GPIO.HIGH)
time.sleep(3)
GPIO.output(power_key,GPIO.LOW)
time.sleep(18)
print('Good bye')
try:
power_on(power_key)
while True:
command_input = raw_input('Please input the AT command:')
ser.write((command_input+ '\r\n' ).encode())
time.sleep(0.1)
if ser.inWaiting():
time.sleep(0.01)
rec_buff = ser.read(ser.inWaiting())
if rec_buff != '':
print(rec_buff.decode())
rec_buff = ''
except :
ser.close()
power_down(power_key)
GPIO.cleanup()
# *** End ***
this very long program is snipped, because it over Stack Exchange's 30,000 word limit, ...
/ to continue, ...