Newby to Fona & Circuit Python

Adafruit cellular platform - SMS and IoT over celluar

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Brendlinger
 
Posts: 4
Joined: Wed Oct 12, 2022 9:52 am

Newby to Fona & Circuit Python

Post by Brendlinger »

I am trying to create a "no spam" pager using a Pico and a cellular connection

1) There would be a "Sending Server" to send a text and daily password.
2) The "client" would accept the message and display it only if the message contains the daily password.

I am looking for suggestions. Is this already done ? leaning to Mu, Circuit python. Is there a cheaper service that Tmobile for this project ?

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Newby to Fona & Circuit Python

Post by rskup »

Hmmm, sounds like a unique project, curious about the application, but don't want to sound too nosy.

Anyways, since you say "newby to Fona", were you thinking/wondering about using a FONA 3G for this?

User avatar
Brendlinger
 
Posts: 4
Joined: Wed Oct 12, 2022 9:52 am

Re: Newby to Fona & Circuit Python

Post by Brendlinger »

Hello Rskup

I am in an environment where people are oncall and we are responsible for responding to any form of communication including text and voice, any time of the day.

Being woke up 4 times during the night for false alarms is not uncommon.

I just want to be texted at night only by my employer.

The cell network is so I can drop it in my car, keep it simple.

It is just a pager .... with a password. I find it amazing that this is not already done.

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Newby to Fona & Circuit Python

Post by rskup »

Ah,ok, I think I got the general idea.

Well if you were thinking/wondering about using a Fona 3G for this, pretty sure 3G is dead in the US (guessing you're in the US).

You can put the Fona 3G into 2G mode (that's what I do currently) but from my tests and reading it looks like T-Mobile is the only carrier left supporting 2G (EDGE mode it seems), and they have announced they will be shutting it down as some point, see the 4th sentence under "Key Dates" below:

https://www.t-mobile.com/support/covera ... -evolution

So based on that it would probably be better to put your efforts into a cell board that will be good for years.

Adafruit is not making a Fona 4G but they do carry 4G boards. I prefer boards with the SimCom chips, no doubt because the Fona 3G had a SimCom chip and that's how I started learning cell stuff. So any of my 4G recommendations would be biased toward SimCom based boards, like WaveShare and AND-Technologies has.

I don't have a Pico (I have Feathers), but it looks like 3.3v logic, make sure your cell board is good with that as a start. I do like this cell stuff and have a couple 4G breadboards I tinker with, if you have other questions I may be able to help with AT commands or code, etc.... You've got me interested in these Pico's now, I'll probably add one or two to my next Adafruit order.

User avatar
Brendlinger
 
Posts: 4
Joined: Wed Oct 12, 2022 9:52 am

Re: Newby to Fona & Circuit Python

Post by Brendlinger »

Hello Rskup

Thank you so much for the reply.

In a nutshell, I am just trying to make something that works, that I can use.

I looked under "cellular" in the adafruit website and did not seem to find anything new (4g). Do you have any suggestions on what to use ? I dream of a board that works with Circuit Python and costs under 100$

Have a great day

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Newby to Fona & Circuit Python

Post by rskup »

Hi Brendlinger,

Try "LTE" in your Adafruit search, there's a couple boards there.

Board wise, since you mention coding in Python, I've used Thonny Python on a Pi4 wired up to this BK-7000 board to ftp files. I haven't specifically sent/received text messages with it but it should work with the same setup.

As you can see, that BK-7000 board is cheap, but it takes like 5 weeks for shipping, ug. I also have this Waveshare board, it is more but at least shipping isn't an issue.

As a test I'll try this week to wire up and send/receive text messages with both boards using the Pi4/Thonny Python setup. If it works I would think the Pico/Circuit Python would work with either board also. And both boards are 3.3V IO too, so there should be no issue with a Pico.

Update: I should have pointed out, the SimCom chip suffix, "G" for these boards, is for "Global", that may not be the optimal choice based on your location and carrier, but can talk about that later.

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Newby to Fona & Circuit Python

Post by rskup »

Ug, spoke too soon, no luck so far trying to receive text messages on the BK-7000 board, not sure why yet, never had a problem with the Fona and the 5320 chip. Oh well, taking a break and will try again later.

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Newby to Fona & Circuit Python

Post by rskup »

Ok, well, decided to test both boards above using their much easier USB option since I kept running into problems.

Came to the conclusion using a normal sim in an NB-IoT board (like with the SIM7000 chip) doesn't quite work right for texting. I can send texts just fine, receiving them is hit or miss though--and you definitely need to receive them. So, both those boards mentioned in the post above with the SIM7000 chip probably won't work for you. Maybe someone with more experience who knows about the variety of chip settings could get it to work with a normal sim, but I sure can't figure it out.

So I switched to this "regular" LTE board (with a SIM7600 chip) and texting works just fine both ways. However, it's a big board with all kinds of pinouts, and may not be the kind of board you want for your project.

Now I just want to see if I can get this board working with my Pi4/Python setup, then look for and buy a smaller and cheaper cell board with the same SIM7600 chip as I'm really liking your idea of an inexpensive Pico/cellular combo to experiment with.

Soooo...based on my tinkerer knowledge, looks like a normal sim in a NB-IoT device is a no-go for reliable texting. I was hoping that would work as some of those sim plans give you unlimited texts for a low monthly cost. The NB-IoT sim I do have charges by how much data is used, so that didn't seem like a good solution either.

If I get some basic texting Python code working with the SIM7600 board I'll post it, if nothing else, could be a start for your code.

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Newby to Fona & Circuit Python

Post by rskup »

Ok, some very basic (Thonny) Python code below that worked with my above Waveshare SIM7600 board while connected to my Pi4.

Note before this setup worked I had to adjust the default baud rate of the board (while connected with the USB option) using the AT command:
AT+IPREX=9600

The default was set at 115200, and I was getting garbage characters until I lowered the rate and cleaned up my breadboard wiring. So, something to keep in mind depending on your board and setup.

It's not great code, note I'm using "sleep" statements rather than using the Waveshare's reply of "OK" before moving on to the next command.

However, it does at least work and gives a basic overview of the various AT commands for texting functions (note other boards may have the same or slightly different AT commands).

My sim was my "hobby" T-Mobile sim, it's their "Connect" $15/mo plan for unlimited talk/text and 3GB data. There's also a $10/mo similar Connect plan with the data reduced to 1GB.

As I mentioned I'm partial to SimCom chips, so now for fun I'm thinking of getting this or this, along with a Pico someday. Other LTE boards "should" work though. Looks like the Waveshare board only comes in the "G" or global version, but the smaller board by AND Technologies comes in other versions, so I'll have to look that up and see what's best.

Ok, well if you've questions etc... let me know

Code: Select all

import serial
import time

ser = serial.Serial('/dev/ttyS0',9600,timeout=0)

#function for sending general AT commands
def Sim7600_do(AT_command, tsec=1):
    AT_command = AT_command + "\r"
    ser.write(AT_command.encode())
    time.sleep(tsec)
    while (ser.inWaiting() > 0):
        print(ser.readline().strip())
    print()
    
#function to send text message
#differs from general AT commands
#is two part, and uses ctrl-z at end
def Sim7600_CMGS(phonenum, text, tsec=1):
    AT_command = "AT+CMGS=\"+" + phonenum + "\"" + "\r"
    ser.write(AT_command.encode())
    time.sleep(tsec)
    while (ser.inWaiting() > 0):
        print(ser.readline().strip())
    print()
    AT_command = text + "\x1A"
    ser.write(AT_command.encode())
    while (ser.inWaiting() > 0):
        print(ser.readline().strip())
    print()


print("begin...")

print("pause to allow cell board start up ...")
#when paired with Pico will need time for cell board to start
#just using 1 sec for now
time.sleep(1) 

#check if comm good, should see "OK"
Sim7600_do("AT")

#echo on, so you can see commands being sent
Sim7600_do("ATE1")

#see if board is registered to tower, should see "0,1"
Sim7600_do("AT+CREG?")

#want sms format in text mode, not pdu mode
Sim7600_do("AT+CMGF=1")

#print out all texts in memory
Sim7600_do("AT+CMGL=\"all\"")

#print a specific text by index number
#in this case, read text at index 2
Sim7600_do("AT+CMGR=2")

#delete a specific text by index number
#in this case, delete text at index 4
#the trailing 0 means delete just index 4
#see AT manual for other options
Sim7600_do("AT+CMGD=4,0")

#send text
Sim7600_CMGS("12223334444", "Pico/Cell is up")

quit()

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Newby to Fona & Circuit Python

Post by rskup »

Update: Looks like the "-H" on the SimCom chips means CAT4, much higher data rate but uses more power. Their CAT1 version may be a more reasonable choice.

User avatar
rskup
 
Posts: 230
Joined: Sat Aug 01, 2020 9:04 pm

Re: Newby to Fona & Circuit Python

Post by rskup »

Something else I noticed, looking thru Adafruit's "LTE" boards and it looks like they are all LTE-M(CATM1)/NBIoT boards. So if you were thinking of one of those just check out beforehand what sims will work with those.

User avatar
Brendlinger
 
Posts: 4
Joined: Wed Oct 12, 2022 9:52 am

Re: Newby to Fona & Circuit Python

Post by Brendlinger »

Thank you very much. This looks like what I am looking for. Have a great Friday

Locked
Please be positive and constructive with your questions and comments.

Return to “FONA”