The Adafruit FONA - Mini Cellular GSM SMA Breakout is a versatile and compact breakout board designed to integrate cellular communication into your microcontroller projects. It allows for voice calls, SMS messages, and GPRS data connectivity, making it ideal for a wide range of applications such as remote monitoring, IoT devices, and mobile communication projects.
Pin Number | Name | Description |
---|---|---|
1 | Vio | Power supply for logic level (2.8V to 5V) |
2 | GND | Ground connection |
3 | RST | Reset pin (active low) |
4 | RX | UART receive pin |
5 | TX | UART transmit pin |
6 | Key | Power on/off status pin |
7 | PS | Power status pin |
8 | NS | Network status indicator |
9 | RI | Ring indicator for incoming calls and SMS |
10 | NC | No connection |
#include <SoftwareSerial.h>
SoftwareSerial fonaSerial(2, 3); // RX, TX
uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout = 0);
void setup() {
fonaSerial.begin(4800);
if (!fona.begin(fonaSerial)) {
Serial.println(F("Couldn't find FONA"));
while (1);
}
Serial.println(F("FONA is OK"));
// Make a voice call
fona.callPhone("1234567890");
}
void loop() {
// Check for incoming calls
char callerIDbuffer[32]; // we'll store the SMS sender number in here
if (fona.incomingCallNumber(callerIDbuffer)) {
Serial.print(F("Incoming call from "));
Serial.println(callerIDbuffer);
}
}
// Read a line from the FONA's UART
uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout) {
uint16_t buffidx = 0;
boolean timeoutvalid = true;
if (timeout == 0) timeoutvalid = false;
while (true) {
if (buffidx > maxbuff) {
// Buffer full
break;
}
while (fonaSerial.available()) {
char c = fonaSerial.read();
// End of line character or newline
if (c == '\r' || c == '\n') {
if (buffidx == 0) { // a newline with no data?
continue; // just ignore it
}
timeout = 0; // the end of the line
break;
}
buff[buffidx] = c;
buffidx++;
}
if (timeoutvalid && timeout > 0) {
delay(1);
timeout--;
if (timeout == 0) {
break;
}
}
}
buff[buffidx] = '\0'; // null terminate the string
return buffidx;
}
Q: Can I use the Adafruit FONA with a 5V microcontroller? A: Yes, the FONA is 5V tolerant on the UART pins, but ensure that the Vio pin is supplied with a voltage within the specified range.
Q: How do I send an SMS using the FONA?
A: You can use the fona.sendSMS(char *number, char *message)
function to send an SMS to the specified number.
Q: What should I do if I'm not getting a GSM signal? A: Check the antenna connection, ensure the SIM card is active, and verify that you are in an area with GSM coverage.
Q: How can I reduce power consumption when the module is not in use? A: You can put the FONA into sleep mode by using the appropriate AT command or controlling the power key pin.