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

by Fusion Automate in Circuits > Raspberry Pi

248 Views, 0 Favorites, 0 Comments

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

Untitled design(1).png

This guide explores the seamless integration of a Raspberry Pi Pico W and an A9G board, combining the versatility of the microcontroller with the powerful functionalities of the GSM/GPRS/GPS module. The Raspberry Pi Pico W, based on the RP2040 chip, offers a robust platform for a wide array of projects. Meanwhile, the A9G board empowers projects with capabilities like SMS sending, call making, and GPS tracking. By bridging these two devices, creators can craft innovative solutions ranging from IoT applications to remote monitoring systems.

Supplies

To embark on this journey, ensure you have the following:

  1. Raspberry Pi Pico W

  1. A9G board

  1. USB cables for both devices
  2. Jumper wires
  3. Computer equipped with Thonny IDE or any compatible IDE
  4. Fundamental understanding of Python programming

Setting Up Raspberry Pi Pico W & A9G Board:

Connection of Raspberry Pi Pico W with A9G Board.jpg
  • Connect the Raspberry Pi Pico W to your computer using a USB cable.
  • Power up your A9G Board by Connecting the A9G board to your computer via USB cable.
  • Connect Raspberry Pi Pico with A9G as per attached connection Diagram.
  • Launch Thonny IDE and create a new Python script.
  • Write and upload the requisite code to establish serial communication with the A9G board.

Code to Send AT Command From Raspberry Pi Pico W to A9G Board:

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)

Explanation:

  1. We import the necessary libraries and modules, including the machine module for hardware interface control.
  2. UART pins on the Raspberry Pi Pico W are configured for serial communication with the A9G board.
  3. A function send_at_command() is defined to dispatch AT commands to the A9G board. It transmits the command followed by carriage return and newline characters (\r\n) and awaits a response.
  4. In the provided example code, the AT command "ATI" is dispatched to retrieve module information from the A9G board. The response is then printed to the console.

Conclusion:

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

With the aid of this guide, you can seamlessly establish communication between a Raspberry Pi Pico W and an A9G board, unleashing a plethora of possibilities for IoT and communication projects. Feel free to experiment with various AT commands to unlock the full potential of the A9G module and seamlessly integrate it into your projects for enhanced functionality.