1

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:

How to connect SIM800 GSM ADD-ON to RaspberryPi 3

tlfong01
  • 4,384
  • 3
  • 9
  • 23
r2b2
  • 137
  • 6
  • Ah, I am using 2 SIM7600's HATs at the same time, but not stacking together. Usually a HAT has specific control signals at the 26/40 pin bus. For SIM, actually you can do things like DIY your own GPIO pins to control difference HATs. For SIM's you can using multiple USB/TTL adapters, each talking to one HAT. In other words, I don't even use the Rpi on board TxD, RxD. And using USB/TTL adapters, I can easily entertain as many HATs (perhas up to 8 for my 8 port USB Hub). Cheers. – tlfong01 Jul 05 '20 at 01:29
  • 1
    I would like to know how you set this up please.. can you share me your set up ? – r2b2 Jul 06 '20 at 05:55
  • I have compiled a quick and dirty answer, please let me know if you wish to give more details. BTW, 5G has come to my town, but expensive and not fully covered, and so right now I am using 4G and 4.5G. I am waiting for 5G subscription fee to come down, before started trying making 5G calls and SMS texting etc. – tlfong01 Jul 06 '20 at 08:53
  • Right now I am messing around with multiple GPS modules, all using 9600, 8N1, so I guess my GPS skills can readily be transferred to SIM7600. (1) "How can Rpi change Neo-6M GPS update rates?": https://raspberrypi.stackexchange.com/questions/113544/how-can-rpi-change-neo-6m-gps-update-rates/113601?noredirect=1#comment196058_113601. Cheers. – tlfong01 Jul 06 '20 at 08:57
  • BTW, if you are using Rpi4B, you can try the 5 on board UARTS: (1) "Serial Test Program v1.00": https://penzu.com/p/59cdb6cf. Cheers. – tlfong01 Jul 06 '20 at 14:05

1 Answers1

1

Answer

I tried the following:

  1. Inserted first SIM7600 HAT to Rpi4B and tested basic things OK, using Rpi on board TxD, RxD pins.

  2. Repeated 1. with second SIM7600 HAT.

  3. Tested two HATs at the same time, one inserted to Rpi, using TxD, RxD pins, the other using USB/TTL cable.

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

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


sim7600 1


sim7600 2


rpi4b uart


uart check 1


References

(1) How to use Rpi4B's 5 onboard UARTs, with loopback test programs for on board and USB UARTS v1.0 - tlfong01 2020jun

(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, ...

tlfong01
  • 4,384
  • 3
  • 9
  • 23