GPS speedometer and clock
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Shop by category
Shop all componentsThe A7670E is a 4G Cat-1 modem with GNSS. On Waveshare's HAT it connects to the Pi over USB (and the GPIO UART), and you talk to it with AT commands. A short Python script with pyserial sends SMS alerts and answers incoming messages. It uses a normal SIM card with an SMS pack; check the SIM works on 4G in your area.
Power off before fitting or removing the HAT or SIM.
Tick anything you already have and the total updates.
Waveshare A7670E Cat-1 4G HAT
Follow the colours: red is power, dark grey is ground, blue is a signal.
Official Pi supply; the modem draws peaks of up to 2 A while registering.
sms_gateway.pyimport serial, time
PORT, MY_PHONE = "/dev/ttyUSB2", "+91XXXXXXXXXX"
m = serial.Serial(PORT, 115200, timeout=2)
def at(cmd, wait=1):
m.write((cmd + "\r").encode()); time.sleep(wait)
return m.read(m.in_waiting or 1).decode(errors="ignore")
def send_sms(to, text):
at('AT+CMGF=1'); at(f'AT+CMGS="{to}"')
m.write(text.encode() + b"\x1a"); time.sleep(3)
def cpu_temp():
return int(open("/sys/class/thermal/thermal_zone0/temp").read()) / 1000
at("AT"); at('AT+CMGF=1')
alerted = False
while True:
t = cpu_temp()
if t > 75 and not alerted:
send_sms(MY_PHONE, f"Pi is hot: {t:.0f} C"); alerted = True
if t < 65:
alerted = False
msgs = at('AT+CMGL="REC UNREAD"', 2)
if "STATUS" in msgs.upper():
send_sms(MY_PHONE, f"Pi OK. CPU {t:.0f} C")
at("AT+CMGD=1,3") # delete read messages
time.sleep(10)
Use the AT port from the wiki; the others carry data or GNSS.
The SIM is searching; check the antenna and that the SIM supports 4G here.
Check the SIM has SMS balance and the number has the country code.
Yes, the A7670E supports a USB network mode; follow the wiki's RNDIS/ECM steps.
The HAT can be driven from any board's UART with the same AT commands.
Yes, with the GNSS antenna and the GNSS AT commands in SIMCom's manual.
4 parts: Waveshare A7670E Cat-1 GSM GPRS GNSS HAT for Raspberry Pi, Raspberry Pi 4 Model B 2GB RAM Single Board Computer, Official Raspberry Pi 32GB A2 Class Micro SD Card and Official Raspberry Pi 4 USB-C Power Supply – 15.3W. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 2 hours. The build on this page has 7 steps.
No. This page has the complete, tested code (sms_gateway.py).
About ₹11,896 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
AT commands for SMS; Talking to a USB modem from Python; Reading and deleting incoming SMS.
Power off before fitting or removing the HAT or SIM.
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Records where you went every five seconds, ready to open on a map.
Two boards, two radios: press the button at the gate and it rings indoors.
Check temperature, humidity and pressure from any phone on your Wi-Fi.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.