Combining Adafruit FONA library with MySensors

  • Hardware Contributor

    Question for @hek : how much dynamic memory needs to be free to be able to run MySensors library (I'm still using 1.5 btw)?

    If I compile my code I now have used 17.198 bytes of program memory and have defined 1532 bytes of global memory.

    I declared MySensor and MyMessage (for S_INFO use) - is part of the 17K code.

    If I do declare the "begin" I end up with 23.244 bytes used in program memory, and using 1571 bytes of global memory (and of course a low memory warning from the IDE).

    The fixed nodeID is intentional. I figure my SMS "gateway" needs a fixed address.

    Anyone with experience combining the FONA (1.1.1 from Adafruit) and MySensor libraries (1.5) ?

  • Admin

    It depends. The linker does a good job removing stuff you don't use. But there seem to be alot of overhead when using C++.

    In the development branch I've tried to keep the C++ class usage to a minimum which result in about 20% smaller library (once again depending on which features you enable).

    Suggest you try dev-brach if you're trying to combine it with a large library.

  • Hardware Contributor

    hi Henrik, I was hoping you would reply.

    So far I found that I need to stay above the 512 bytes of available global memory to allow use of MySensors in combination with the Fona library. I can send all received SMS text to Domoticz via the S_INFO type (I have an SMS800L hooked up to an atmega328p node), so that would allow the controller to take action on an SMS received in the MySensor network. At the same time I would like some more room for standard SMS message (160 bytes). So far I had to limit myself to 60 bytes per message.

    I will try the DEV branch, and I looked for it on GITHUB, but it is not clear to me how I would download the arduino dev-branch library. Some changes in declaration are also needed I see. I was waiting for some more documentation before jumping.

  • Hardware Contributor

    Switching of DEBUG in MyConfig.h did the trick so far, back up to 160 chars for a message 🙂

  • Admin

    To get and keep a fresh copy of the dev-branch I suggest you install git and run

    > git clone

    If you later need to do a update to the latest library version just do

    > git pull

  • Hardware Contributor

    My source code is on Dropbox, so are my libraries (allows me to develop at home on a Mac en at work on a PC). So I assume I will need some form of sync setup to keep in line with the dev branch. As far as I know I can not set up a git on Dropbox from my Mac, right?

  • Hardware Contributor

    Am I correct in assuming the maximum payload of a V_TEXT is 25 characters ?

  • Admin

    As long as you can mount your dopbox in the filsystem (like you can do for google-drive) I see no problem of keeping your clone there.

    Yes, max payload is about 25 characters for the NRF-radio when header has been removed. With RF69 you have a few bytes more.

  • Hardware Contributor

    That simplifies my issue. I was trying (and now succeeded) to handle 160 char SMS messages (with DEBUG off), but the payload of S_INFO is the limiting factor. So now I can use a 30 char buffer AND keep DEBUG on, which is better for development.

    I will try to set up to git on dropbox, it is indeed transparent for my PC, not so sure about the Mac.

    And I still need to do the writeup for connecting the NRF24 directly to the Raspberry as a gateway 🙂