Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
FUSION AUTOMATE
Published © GPL3+

Place Calls from A9G Board using Raspberry Pi Pico W

How to Place Calls from A9G Board by Sending AT Commands from Raspberry Pi Pico W

IntermediateProtip1 hour1,150
Place Calls from A9G Board using Raspberry Pi Pico W

Things used in this project

Hardware components

Raspberry Pi Pico W
Raspberry Pi Pico W
×1

Software apps and online services

MicroPython
MicroPython

Story

Read more

Schematics

connection diagram

Code

main.py

Python
import machine
import time

# Configure UART for communication with the A9G module
uart = machine.UART(0, baudrate=115200, tx=machine.Pin(0), rx=machine.Pin(1)) # UART0 on Pico

# Function to send AT commands and receive responses
def send_at_command(command):
    uart.write(command + '\r\n')       # Send the command
    time.sleep(2)                       # Wait for response
    response = uart.read()              # Read the response
    return response.strip() if response else None  # Return stripped response if available, else None

# Function to make a call
def make_call(phone_number):
    response = send_at_command('ATD{};'.format(phone_number))  # Dial the number
    print("Call response:", response)  # Print response for debugging
    if response and 'OK' not in response:
        print("Failed to make the call.")
        return
    print("Call placed to", phone_number)

# Example usage
phone_number = '+91XXXXXXXXXX'  # Replace with the phone number you want to call
make_call(phone_number)

Credits

FUSION AUTOMATE

FUSION AUTOMATE

25 projects • 3 followers

Comments