Send sms from an A9G pudding dev board

Yet another article on sending sms!! This time with a A9G pudding dev board. I hope this will be the second in a series of articles on this module. My project is to make a GPS tracking system that can save the coordinates to an SD card and send them by SMS when requested.

This article starts where the previous one left off ( which explains how get set up and upload your first program.

I created a git repo with all the code for this article :

I admit having shamelessly copied the sms example and adapted it to my needs! This code will send an sms on startup to tell us that the module is ready, and then relay all messages recieved to a configured phone number.


The only configuration needed is the phone number to send messages to. We simply need to copy and rename include/app_main_example.h to
include/app_main.h and edit the phone number (I haven’t tried other formats but it works well for me with the “+336xxxxx” format with the country code, 33 being France).

You should be able to compile and upload the code and get a message containing “Ready and able!”

.\build.bat app


We can know what state the module is currently in by observing events. This way we can know when the module is registered on the network and ready to comunicate or when an error occures. For each event, the
EventDispatch function is called with an object that contains more information. For example, when the event’s id corresponds to the
API_EVENT_ID_NETWORK_REGISTER_SEARCHING constant, we know that the board is searching for a network. You can find the list of available event constants in /include/api_inc/api_event.h

void EventDispatch(API_Event_t* pEvent)
            Trace(10,"!!NO SIM CARD%d!!!!",pEvent->param1);

Note: Just when I thought I had something stable and working, the module stoped comunicating… By adding a case uin the switch, I was able to determine that I was getting an error while registering on the network (
API_EVENT_ID_NETWORK_REGISTER_DENIED ). I’m not 100% sure why but I think it was to do with the antena thatgot disconnected, it started working again later, probably because I fiddled about with it in frustration!

Sending messages

I made the SendSMS function (I actually just extracted what I needed from the sms demo and adapted it) that takes a uint8_t message[] parameter and sends the content.

void SendSMS(uint8_t message[])
    uint8_t* unicode = NULL;
    uint32_t unicodeLen;
    Trace(1,"sms start send UTF-8 message");
        Trace(1,"local to unicode fail!");
        Trace(1,"sms send message fail");

SendSMS("Ready and able!");

Receiving messages

When we receive a message, the API_EVENT_ID_SMS_RECEIVED event is fired, we can get the contents of the message in the pParam2
(pEvent->pParam2). In my code, the function messageRecieved extracts the content of the message and relays it to my phone by sms. You could get the phone number of the person that sent the message in the pParam1 attribute that contains the message headers, but I didn’t need to. I would love to know how you go about it though!

void messageRecieved(uint8_t* content)
    char buffer[200];
    snprintf(buffer, sizeof(buffer), "Message received : %s", content);
    Trace(1, buffer);

void EventDispatch(API_Event_t* pEvent)
            Trace(2,"received message");
            uint8_t* content = pEvent->pParam2;

            Trace(2,"message header:%s",header);
            Trace(2,"message content length:%d",contentLength);

One thought on “Send sms from an A9G pudding dev board”

  • HI David,

    nice article. I would like to send GPS coordinates included in SMS message. How is possible to integrate the GPS function with the SMS function? I have integrate the SMS and GPS codes in one code but I don’t know how to include GPS coordinates in:

    bool SMS_SendMessage(const char* phoneNumber, const uint8_t* message, uint8_t length, SIM_ID_t simID);

    Any idea?

    Thank you,


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>