I've created a project which uses two Arduino Pro Minis. One takes inputs from various sensors and sends the data to the other over RF link (NRF24L01 2.4 GHz module). The receiver Arduino is connected to the web using an Adafruit FONA cellular module. It is connected to the Blynk servers and forwards to data to a Blynk mobile app on my phone.
The Arduino connects to the cellular network fine but only for about 10 seconds before disconnecting. I'm wondering if the Arduino drops communication with the cellular module while it communicates with the RF module. If so, is there any way around this?
The cellular module uses software serial pins 8 and 9, while the NRF module uses pins 2 and 3.
#define FONA_RX 8
#define FONA_TX 9
RF24 radio(3, 2); // CE, CSN
#define BLYNK_PRINT Serial
#define TINY_GSM_MODEM_SIM800
#define FONA_RX 8
#define FONA_TX 9
#define FONA_RST 4
#include <Adafruit_FONA.h>
#include <TinyGsmClient.h>
#include <BlynkSimpleTinyGSM.h>
#include <Blynk.h>
#include <SPI.h>
#include <SoftwareSerial.h>
#include <RF24.h>
char auth[] = "****************";
char apn[] = "********";
char user[] = "";
char pass[] = "";
uint8_t buf[25];
RF24 radio(3, 2); // CE, CSN
const byte address[6] = "00001";
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;
Adafruit_FONA fona = Adafruit_FONA(FONA_RST);
TinyGsm modem(fonaSS);
void setup()
{
while (!Serial);
Serial.begin(115200);
fonaSerial->begin(4800);
if (! fona.begin(*fonaSerial)) {
Serial.println(F("Couldn't find FONA"));
while (1);
}
Blynk.begin(auth, modem, apn, user, pass);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
}
void loop()
{
Blynk.run();
if (radio.available())
{
radio.read(buf, sizeof(buf));
}
}