It would be possible to do so, you would need to enable Caller ID Display (CLIP) with the AT command:
AT+CLIP=1
Once that is activated, when you receive a call you should get a response with the following format
RING
+CLIP: "<phonenumber>",<type>,<subaddr>,<satype>
From there you will be able to hang up the call with the AT command
ATH
To separate the number out you would need to put together some code to remove the other stuff from the response that was given by the first AT command.
Thanks Dan. Iâm very new to this - Iâm not sure how I would write code to wait for and receive a call.
I assume where you have written âRINGâ, that is when an incoming call is being made?
What is the â+CLIP:â bit, is that an AT command?
Hi all,
Want to prefece this with the fact that I am a total NOOB with all kinds of coding and electronics.
I was able to follow the tutorial as best I could, besides some hiccups to do with permission. However, when trialing the hat using the Python codes I ran to greater issues. PhoneCall.py worked, however, GPS.py resulted:
AT+CGPSINFO
+CGPSINFO: , , , , , , , ,
Not sure if this is a problem to do with the Pi, GPS or location I am testing it in. Further, I was unable to send a text using SMS.py and waspromptedd with the following:
ERROR
Back:
+CMS ERROR: Unknown error
error
Received Short Message Test:
Please send message to phone *04XXXXXX
Setting SMS modeâŚ
AT+CMGF=1
OK
and this is then followed by the activation date of my sim card. (Optus pre-paid)
I am just wondering if this a purely sim related issue as I was able to make that phone call using it. Any suggestions and comments would be greatly appreciated.
Youâre definitely not alone with these early roadblocks. The fact that PhoneCall.py worked means your HAT, SIM, and AT-command interface are basically healthy, great start.
GPS Issue (+CGPSINFO: , , , , , , , ,)
This response just means the GPS hasnât acquired a satellite fix yet. Common causes:
Youâre indoors or under cover â GPS needs a clear view of the sky. Try placing the GPS receiverâs sticker side face down and outside
Itâs a cold start â first-time or long-unpowered modules can take 5â15 minutes to download satellite data.
Suggestions:
Move the Pi + HAT outdoors with a clear view of the sky.
Before running GPS.py, try sending these manually:
AT+CGPS=1,1 // Enables GPS engine with NMEA output to UART
AT+CGPSINFO // Poll for current GPS fix
Wait 5â10 minutes, then run AT+CGPSINFO again. Once it gets a fix, itâll return something like:
Even if calling works, SMS can be tripped up by SIM or network quirks:
SIM activation â Some Optus prepaid SIMs allow calls but block SMS until activated via the Optus app or website.
Balance/profile â Ensure the SIM has credit and isnât data-only.
Text mode â Confirm the modem is in text mode:
AT+CMGF=1
PIN status â Check that the SIM isnât PIN-locked:
AT+CPIN?
Debug steps:
Insert the SIM into a phone and confirm you can send/receive SMS.
On the Pi, check:
AT+CSQ // Signal strength
AT+CREG? // Network registration status
AT+COPS? // Current operator
If Optus still doesnât behave, try a Telstra or Vodafone SIM to compare.
Post back the results of those commands or any new errors, and weâll help you dig in further. Once GPS has a lock and SMS is sorted, youâll be all set!
Sorry this may be dumb, but where am i imputting these commands? Also thank you so much for the response Ryan, sorry for my delay lifes caught up to me recently.
Additionally, I have been able to replace the SIM card with my personal one. In doing so, I have changed the error code from the previous to
"`AT+CMGR=1 ERROR
AT+CMGR=1 back: AT+CMGR=1
OK
You can input AT commands using a serial terminal program on your Raspberry Pi that connects to the modemâs serial port. Common tools for this are:
minicom
screen
picocom
Theres plenty of online tutorials that can help you learn how to use any one of these.
This error usually means the modem tried to read SMS message number 1, but thereâs no message stored there. Thatâs totally normal if your SMS inbox is empty.
You can check which messages are stored (if any) by running:
AT+CPMS?
(to check message storage status) and
AT+CMGL="ALL"
(to list all messages).
Next steps to confirm SMS and SIM status
Please try these commands (after connecting to the modem via serial terminal):
AT
AT+CPIN?
AT+CSQ
AT+CREG?
AT+COPS?
AT+CMGF=1
They will tell us if:
The modem is responding
The SIM card is ready (not PIN locked)
Signal strength is good
Network registration is successful
SMS text mode is enabled
Once you share the responses from these commands, I can help you troubleshoot further.
I was able to send a message through minicom using AT+CMGS:"+614XXXXXXX"
But I am still running into problems using the provided python code.
The modem is responding, text mode is enabled, and the signal strength is good. However I am receiving:
It looks like your SIM messages are full - if you run into further issues with the scripts would it be possible to specify the file, and errorâs from the REPL?
If you run the commands: AT+CMGL="ALL" to display all of your SMSâs
WARNING AT+CMGD=1,4 Deletes all of your SMSâs (not recommended on your personal SIM)
Then when you think you have emptied them: AT+CPMS? to see the memory status
I used a SIM7600X G4 HAT on my Raspberry but run into an error while initializing. I followed the tutorial, everything fine so far but when I run the init script (which should be part of the rc.local) I run into errors:
Hi there, @Rene306428, and welcome to the forum, glad to have you here.
Thatâs definitely a strange error. Iâm wondering if this might be a permissions issue.The fact that the script is reading âDirectory nonexistentâ makes me think that the script doesnât have necessary permissions to read /sys/class/gpio/.
Can you confirm that you previously ran the command:
sudo chmod 777 -R /home/pi/SIM7600X-4G-HAT-Demo
With a particular attention to that -R option since that would then apply to all folders beneath it.
The output of the below command should indicate its permissions:
Thanks for your reply. Yes I run this without any errors. Since I run the init script manual on the cli in the user context this may a reason. I copied the sh âŚinit into the rc.local but then I donât see any output. The main problem is that I ran into errors while running the next command:
wscadmin@womomon:~/SIM7600X-4G-HAT-Demo/Raspberry/c/bcm2835 $ chmod +x configure && ./configure && sudo make && sudo make install
The out put ends with the following errors:
âŚ
checking whether we are using the GNU C compiler⌠yes checking whether gcc accepts -g⌠yes checking for gcc option to accept ISO C89⌠none needed checking dependency style of gcc⌠gcc3 checking for clock_gettime in -lrt⌠yes checking for doxygen⌠no configure: WARNING: Doxygen not found - continuing without Doxygen support checking for ranlib⌠ranlib checking for gcc⌠(cached) gcc checking whether we are using the GNU C compiler⌠(cached) yes checking whether gcc accepts -g⌠(cached) yes checking for gcc option to accept ISO C89⌠(cached) none needed checking dependency style of gcc⌠(cached) gcc3 checking that generated files are newer than configure⌠done configure: creating ./config.status config.status: creating Makefile config.status: creating src/Makefile config.status: creating doc/Makefile config.status: creating config.h config.status: config.h is unchanged config.status: executing depfiles commands make all-recursive make[1]: Entering directory â/home/wscadmin/SIM7600X-4G-HAT-Demo/Raspberry/c/bcm2835â Making all in src make[2]: Entering directory â/home/wscadmin/SIM7600X-4G-HAT-Demo/Raspberry/c/bcm2835/srcâ gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT bcm2835.o -MD -MP -MF .deps/bcm2835.Tpo -c -o bcm2835.o bcm2835.c bcm2835.c: In function ââŹËbcm2835_peri_readââŹâ˘: bcm2835.c:115:51: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 115 | printf(âbcm2835_peri_read paddr %08X\nâ, (unsigned) paddr); | ^ bcm2835.c: In function ââŹËbcm2835_peri_read_nbââŹâ˘: bcm2835.c:155:54: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 155 | printf(âbcm2835_peri_read_nb paddr %08X\nâ, (unsigned) paddr); | ^ bcm2835.c: In function ââŹËbcm2835_peri_writeââŹâ˘: bcm2835.c:171:63: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 171 | printf(âbcm2835_peri_write paddr %08X, value %08X\nâ, (unsigned) paddr, value); | ^ bcm2835.c: In function ââŹËbcm2835_peri_write_nbââŹâ˘: bcm2835.c:202:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 202 | (unsigned) paddr, value); | ^ bcm2835.c: In function ââŹËbcm2835_gpio_set_pudââŹâ˘: bcm2835.c:531:5: error: implicit declaration of function ââŹËdelayMicrosecondsââŹâ˘; did you mean ââŹËbcm2835_delayMicrosecondsââŹâ˘? [-Wimplicit-function-declaration] 531 | delayMicroseconds(10); | ^~~~~~~~~~~~~~~~~ | bcm2835_delayMicroseconds bcm2835.c: In function ââŹËbcm2835_initââŹâ˘: bcm2835.c:1314:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 1314 | bcm2835_peripherals_base = (uint32_t *)(buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3] << 0); | ^ bcm2835.c:1334:75: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 1334 | bcm2835_peripherals = mapmem(âgpioâ, bcm2835_peripherals_size, memfd, (uint32_t)bcm2835_peripherals_base); | ^ make[2]: *** [Makefile:549: bcm2835.o] Error 1 make[2]: Leaving directory â/home/wscadmin/SIM7600X-4G-HAT-Demo/Raspberry/c/bcm2835/srcâ make[1]: *** [Makefile:352: all-recursive] Error 1 make[1]: Leaving directory â/home/wscadmin/SIM7600X-4G-HAT-Demo/Raspberry/c/bcm2835â make: *** [Makefile:292: all] Error 2