INTRODUCTION
Our project aims to assist some organizations to send or help homeless people to shelters or let them rest in cars when the weather gets extremely cold. The GSM device I use in this tutorial is used for sent text message to van drivers so that they know which grates homeless people have rest on them. This tutorial is trying to figure out how to let the GSM send text message to phone. In order to make the tutorial more straight forward, push button is used as the input, instead of the pressure sensor we actually will use in the project.
CIRCUIT
PART LIST
1. Adafruit FONA – Mini Cellular GSM Breakout uFL Version
2. GSM 2G SIM Card from Ting & Adafruit – Data/Voice/Text USA Only
3. Adafruit Slim Sticker-type GSM/Cellular Quad-Band Antenna – 3dBi uFL [ADA1991]
- Battery….(Required!!!! NO Exception!)
ASSEMBLY
- Soldering: You have to solder FONA800 to the header strip. By doing this, it will produce a stable electrical contact. If you don’t know how to solder, here is the tutorial.
- Wiring: (on Arduino UNO)
- FONA800 part:
- VIO connects to 5V;
- Key connects to GND;
- GND connects to GND;
- RX connects to digital 2;
- TX connects to digital 3;
- RST connects to digital 4.
(reference: https://learn.adafruit.com/adafruit-fona-mini-gsm-gprs-cellular-phone-module?view=all#handy-commands)- Connectors: (if you have more interests on the hardware, please check the description on Adafruit website.)
- 1. JST 2-pin: the battery input connector.
- 2. MicroUSB connector: the LiPoly/Lilon battery charging port.
- 3. Headset jack: the “standard” TRRS 3.5mm phone headset jack with stereo earphone and mono micro.
- 4. Connect to Antenna port (Either uFL GSM antenna or uFL to SMA adapter and an SMA antenna works).
- 5. SIM Card connector is on the back.
- Connectors: (if you have more interests on the hardware, please check the description on Adafruit website.)
- Button part:
Anode (+) connects to 330 Ohm Resistor and digital 9.
SET-UP
- 2G SIM Card (TING):
Sign up online and select your Text Plan (you do not need to select Data Plan).
We choose Ting here. You can also use other carriers. More options refer to Adafruit here.
2. FONA800:
- Download the Adafruit_FONA Library here and place the Adafruit_FONA library into your Arduino Library folder.
- Using FONAtest Sketch to test your sensor. Here is the suggested checklist:
- Check Battery voltage (If you plug in wrong connector, the voltage will be 0V. Make sure that the returned voltage should be around 3.7V).
- Check SIM CCID
- Check Network Registration!
- FONA will immediately locate and register to a nearby cell tower, if it has a good signal.
- Adafruit suggests to “give it like 5-10 more seconds before trying to send SMS”. However, BE PATIENT! Please give it more than THREE HOURS to successfully register to the cell tower.
- Send and Read SMS test
PROCESS
- NOTE! Please replace the Phone Number that you want the content sends to here:
2. Upload the code below to the Arduino UNO then Open the Serial Monitor.
3. Push the button and Check the SMS text on your phone.
CODE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
#include <Adafruit_FONA.h> #include <Adafruit_FONA.h> #include <SoftwareSerial.h> /*************************************************** Tutorial for sending SMS message Yuchen Zhang 11/20/2018 */ #include "Adafruit_FONA.h" #define FONA_RX 2 #define FONA_TX 3 #define FONA_RST 4 // this is a large buffer for replies char replybuffer[255]; /* We default to using software serial. If you want to use hardware serial (because softserial isnt supported) comment out the following three lines and uncomment the HardwareSerial line */ SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX); SoftwareSerial *fonaSerial = &fonaSS; // Hardware serial is also possible! // HardwareSerial *fonaSerial = &Serial1; // Use this for FONA 800 and 808s (We are using this code, since we use FONA 800 here.) Adafruit_FONA fona = Adafruit_FONA(FONA_RST); // Feel Free to use this one for FONA 3G //Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST); uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout = 0); uint8_t type; const int buttonPin = 9; //pushbutton pin void setup() { while (!Serial); Serial.begin(115200); Serial.println(F("FONA SMS basic test")); Serial.println(F("Initializing....(May take 3 seconds)")); //make it slow, read it easier. fonaSerial->begin(4800); if (! fona.begin(*fonaSerial)) { Serial.println(F("Couldn't find FONA")); while (1); } type = fona.type(); Serial.println(F("FONA is READY.")); } void loop() { int pushbutton; pushbutton = digitalRead(buttonPin); //push down button (pretend its someone resting on the grateX and trigger the pressure sensor.) if (pushbutton == LOW){ //send SMS message char message[141]; sprintf(message,"Person is resting on Grate #X. LocationX: 32 ST across Chestnut St."); Serial.println(message);//print message on serial monitor char sendto[10] = "**********" ; // replace ** to the phone number that you want to send. fona.sendSMS(sendto,message); //send the message via SMS delay(1000); } } |
DEMO-SMS text
DEMO-VIDEO
Thanks for your attention. Hope you enjoy this tutorial!
One reply on “Receive SMS Message after Pushing Button (FONA800 – Mini Cellular GSM Breakout uFL version)”
Hello,
I’m trying to recreate this project but I’m a bit confused about the wiring–it looks like a leg of the resistor is in the same hole as digital pin 9 on the breadboard. Can you help? Thanks!