Whew, what a struggle.
After 3 days of frustrating trial and error and some ideas from others on the forum, I finally got the hologram sim to work with the Adafruit Feather-FONA in my project to send water quality data every 15 minutes to Ubidots using TCP. The original problem appeared to be that the hologram sim causes a return code of 5 (roaming) rather than a 1 (home) when I issue the Adafruit.fona library function getNetworkStatus() (this function sends AT+CREG? to the fona and gets a return code of 1 - 5 depending on the network status). I’m not sure why there isn’t a simple fix by way of editing the Adafruit_fona library to accept return codes of both 1 and 5, but it’s beyond my skill level. So here is the fix I got to work, based mostly on BaldEngineer’s work (see link below). I’m going into detail here because it was the details that stumped me for 3 days. Hope this helps someone else out.
Steps to a fix were:
Modify the Adafruit_fona library as described by BaldEngineer in his post:
that I mentioned in my 1st message,
and the files at github that show his changes:
i.e. that involved:
adding the code for function “boolean Adafruit_FONA::jamesStart()” found in BaldEngineer’s file “Adafruit_FONA-additions.cpp” to the
Adafruit_fona.cpp file in …\Arduino\libraries\Adafruit_FONA
I put it at the very end of the file, after other functions in that library.
adding the " boolean jamesStart();" found in BaldEngineer’s file “Adafruit_FONA-additions.h” to the Adafruit_fona.h file in …\Arduino\libraries\Adafruit_FONA
I put it after the “class” statement in the library, like this:
...
class Adafruit_FONA : public FONAStreamType {
public:
Adafruit_FONA(int8_t r);
boolean begin(FONAStreamType &port);
uint8_t type();
/* Got the official Adafruit_FONT_Library and then add this to the Adafruit_FONA.h file */
/* James Stuff */
boolean jamesStart();
...
Based on guesswork, I added the fonahelper.cpp file to a tab in the Arduino programming GUI. (I’m not sure what this does but the fonahelper files seems to get compiled into the program, kind of like an #include statement.)
For my sketch I had to edit the fonahelper.cpp file to:
change from hardwareSerial to softwareSerial, i.e. HardwareSerial *fonaSerial = &Serial1; to extern SoftwareSerial fonaSS;
change all references to *fonaSerial to fonaSS
make sure the line while (fona.getNetworkStatus() != 1) { delay(500); } was commented out (this could probably be changed to accept either 1 or 5 but it works with it commented out)
make sure the line if ((n == 1) || (n==5)) success = true; was not commented out so that the routine accepts a network status return code of either 1 or 5
edited my program to:
comment out my old line //while(!setApn(APN, USER, PASS)); which established the connection to the cell network
and replaced it with while (! FONAconnect(F(APN), F(USER), F(PASS))); //BaldEngineer’s connection routine that accepts return codes of: Registered home(1) and registered roaming(5)
It’s a bit of a kludge of a fix but it works consistently, so I’m not going to mess with it.