FONA + Arduino MEGA

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
billf
 
Posts: 51
Joined: Mon Jun 20, 2011 9:58 am

FONA + Arduino MEGA

Post by billf »

I have the FONA module and I have gotten it to work reasonably well with an Arduino UNO. But I recently changed over to an Arduino MEGA because my project uses more pins than I have on an UNO. The library file FONAtest.ino was probably written for an UNO and it uses digital pins 2,3 and 4 like this:


#define FONA_RX 2
#define FONA_TX 3
#define FONA_RST 4


I would like to use different pins on the MEGA. I tried using pins 14, 15 and 22. I modified the FONAtest.ino as follows:

#define FONA_RX 14
#define FONA_TX 15
#define FONA_RST 22

MEGA pin 14 is connected to FONA pin Rx.
MEGA pin 15 is connected to FONA pin Tx.
MEGA pin 22 is connected to FONA pin Rst.

The MEGA can't seem to find the FONA. I get this message in the Serial Window:

FONA basic test
Initializing....(May take 3 seconds)
Couldn't find FONA


The FONA is powered up (blue light is on), the battery is connected and charged and the FONA appears to be connected to the network (based on the blink of the red LED). I can get the same FONA to work on the UNO, but I think I may not be communicating (Tx and Rx) correctly with the FONA from the MEGA.

I realize the FONA code is still being developed, but does anyone know how to connect a FONA to the MEGA?

Thank you for any information you can provide.

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: FONA + Arduino MEGA

Post by Franklin97355 »

Could you post your code as modified?
Please use the code button "</>" or

Code: Select all

 tags when posting code to the forums.

User avatar
billf
 
Posts: 51
Joined: Mon Jun 20, 2011 9:58 am

Re: FONA + Arduino MEGA

Post by billf »

At this point, I have reduced the experiment as much as possible: I have the FONA and the MEGA - nothing else is hooked up.

I started with the following connections:

FONA GND connected to MEGA GND
FONA RST connected to MEGA 4
FONA Key connected to GND
FONA Tx connected to MEGA 3
FONA Rx connected to MEGA 2
FONA Vio connected to MEGA 5V

MEGA powered via USB.
FONA connected to battery, the blue LED is on the red LED is off most of the time but flashes briefly about every three seconds.
External antenna is hooked to FONA

I started with the library file FONAtest without modifications. In the IDE, I made sure I was uploading to a Arduino MEGA 2560.

Here is what the Serial Window displayed:

Code: Select all

FONA basic test
Initializing....(May take 3 seconds)
Couldn't find FONA


I'm guessing that somehow, by using the MEGA, the Tx/Rx connection is not working.

I tried it again with FONA Rst connected to GND and got the same result, so I don't think it is a problem with Rst.

Next, I made the following modification to the code:


This is the original code from FONAtest.ino

Code: Select all

#define FONA_RX 2
#define FONA_TX 3
#define FONA_RST 4
This was my code modification:

Code: Select all

#define FONA_RX 14
#define FONA_TX 15
#define FONA_RST 4
I moved two wires:

FONA Tx connected to MEGA 15
FONA Rx connected to MEGA 14



Here is what I got in the Serial Window:

Code: Select all

FONA basic test
Initializing....(May take 3 seconds)
Couldn't find FONA


I tried using to following connections:

FONA Tx connected to MEGA 20
FONA Rx connected to MEGA 21

And modified the code to be:

Code: Select all

#define FONA_RX 21
#define FONA_TX 20
#define FONA_RST 4
I got the same results:

Code: Select all

FONA basic test
Initializing....(May take 3 seconds)
Couldn't find FONA

If anyone has figured out how to get MEGA to talk to FONA, please let me know. THANKS!!!

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: FONA + Arduino MEGA

Post by tdicola »

Thanks for posting the code, it looks good but I think you're running into a limitation of the software serial library with the Mega:
Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
Try switching RX to one of the pins mentioned above and give it a shot. Let me know if you run into issues, thanks!

User avatar
billf
 
Posts: 51
Joined: Mon Jun 20, 2011 9:58 am

Re: FONA + Arduino MEGA

Post by billf »

Thank you for your response. I tried a few different combinations. Here is one that works (I'm not saying others will not work, but I'm going to use this one for now).

Code: Select all

#define FONA_RX 50
#define FONA_TX 51
#define FONA_RST 22
I have the FONA Rx pin connected to the MEGA pin 50
I have the FONA Tx pin connected to the MEGA pin 51
I have the FONA Rst pin connected to the MEGA pin 22

Thank you for your help!

Next step: I'm going to add back in the other hardware and software that I had working with the MEGA before I added the FONA. I hope they all play well together.

I'll probably have other questions, but we can consider this post closed.

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: FONA + Arduino MEGA

Post by tdicola »

Glad to hear it works, thanks for the followup. Good luck with the project!

User avatar
Prof_Obeng
 
Posts: 2
Joined: Wed Dec 30, 2015 2:33 am

Re: FONA + Arduino MEGA

Post by Prof_Obeng »

Hi,
I bought adafruit Fona 808 and I need help with the following:
1. how do I configure the RI Pin of the FONA 808 to pulse when SMS is received? The tutorial on the site only mentions that the RI pin of the FONA 808 can be configured to pulse when SMS is received.

2. Is it possible to run the FONA808 without the Lipo battery? I tried running the arduino Uno and the Fona 808 shield from an external source. The system power on right but if I try to run the fonaTest example, I get the message "couldn't find fona!" unless I plug in the Lipo battery before it works.

3. Can I toggle the charge and run switch of the FONA 808 shield programmatically?

Thanks for helping in advance.

User avatar
logesh45
 
Posts: 1
Joined: Fri Feb 05, 2016 5:41 am

Re: FONA + Arduino MEGA

Post by logesh45 »

Same problem here, unable to find a solution.
Prof_Obeng wrote:Hi,
I bought adafruit Fona 808 and I need help with the following:
1. how do I configure the RI Pin of the FONA 808 to pulse when SMS is received? The tutorial on the site only mentions that the RI pin of the FONA 808 can be configured to pulse when SMS is received.

2. Is it possible to run the FONA808 without the Lipo battery? I tried running the arduino Uno and the Fona 808 shield from an external source. The system power on right but if I try to run the fonaTest example, I get the message "couldn't find fona!" unless I plug in the Lipo battery before it works.

3. Can I toggle the charge and run switch of the FONA 808 shield programmatically?

Thanks for helping in advance.

User avatar
Prof_Obeng
 
Posts: 2
Joined: Wed Dec 30, 2015 2:33 am

Re: FONA + Arduino MEGA

Post by Prof_Obeng »

Hi!

Finally I got a way around the "couldn't find fona" issue by altering the fonatest code as shown below:

Code: Select all

.
.
.
 Serial.println(F("Initializing....(May take 3 seconds)"));

  fonaSerial->begin(4800);
  if (! fona.begin(*fonaSerial)) {
    Serial.println(F("Couldn't find FONA"));
    pinMode(FONA_RST, OUTPUT);    //set a pin mode on the FONA_RST 
    int attempt = 0;                              // a counter to check the number of times the fona has been reset
    while (! fona.begin(*fonaSerial) && attempt != 5) {   //try to reset the FONA 5 times before giving up
      Serial.print("Resetting FONA...Attempt");      
      Serial.println(++attempt);
      digitalWrite(FONA_RST, LOW);                  //set the FONA_RST pin low (Reset the fona)
    }
  }
 digitalWrite(FONA_RST ,HIGH);        //pull FONA_RST  back to high

  type = fona.type();
.
.
.

And since I made this changes, FONA808 always connects. One more thing! I don't know why it works but it does. haha

User avatar
Emrsen
 
Posts: 2
Joined: Sun Jan 24, 2016 1:46 pm

Re: FONA + Arduino MEGA

Post by Emrsen »

Hi
Just a super simple hack
1. Cut off TX pin in fona shield. (Attention .. You shall need to re-soldier if you want to use it in Uno again...)
2. Changed the example code "#define FONA_TX 3" to "#define FONA_TX 10"
3. Plugged the shield to Arduino Mega
4. Wire short from D10 - TX pins

Everything works fine
Just check the final working pic
Image

User avatar
2014sideline
 
Posts: 10
Joined: Mon Feb 08, 2016 8:20 am

Re: FONA + Arduino MEGA

Post by 2014sideline »

I have bought one unit of FONA - MINI CELLULAR GSM BREAKOUT UFL VERSION it worked fine and I was able to transfer data to the cloud. Then I disconnected FONA and after two weeks tried to check it's still sending data to the cloud but FONA's LED neither the blue nor the red ones does work so simply I can't detect FONA when it's connected to my laptop through USB cable as it did before. The charger is working and its orange LED lit properly and when the battery is charged the green light is lit properly as well as expected.

The question is FONA out of function in this case? ... or do you have any way to get back working as expected?

Please provide you answer today...thanks!

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: FONA + Arduino MEGA

Post by adafruit_support_mike »

Have you pulled the KEY pin low for a couple of seconds to turn it on?

User avatar
2014sideline
 
Posts: 10
Joined: Mon Feb 08, 2016 8:20 am

Re: FONA + Arduino MEGA

Post by 2014sideline »

Thanks for your response.
At the moment I don't have any pin is connected to anything, what I have is just FONA connected to the battery and the USB cable is connected to my laptop. The orange/green LEDs lits on/off properly as expected.
To pull the KEY pin low for a couple of seconds I connected the KEY pin to the ground which's low for a couple of seconds but nothing happened. Is this what you wanted me to test it?

User avatar
2014sideline
 
Posts: 10
Joined: Mon Feb 08, 2016 8:20 am

Re: FONA + Arduino MEGA

Post by 2014sideline »

Thanks again for your information.
I connected Vio pin to 5v and the KEY pin to low permanently and just then both the blue and the red LEDs lit as supposed to do.
I will do more tests on FONA though I consider it so far as the problem is solved.

User avatar
2014sideline
 
Posts: 10
Joined: Mon Feb 08, 2016 8:20 am

Re: FONA + Arduino MEGA

Post by 2014sideline »

It's still problem with the detection of FONA (SIM800L) by my laptop though Arduino is detected as port COM4. When I disconnect Arduino from the laptop then FONA turns off (blue and red LEDs off) although the fully charged battery and the USB cable are connected to FONA. Previously when FONA tested for the first time I noticed it was operated on just the USB cable. My intention now is to run the original adafruit FONA test on the board but FONA is still can't be detected though the blue/red LEDs lit. I don't know what is the problem.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”