Using GPy as a SMS module and interfacing with Arduino MEGA 2560
We are a team designing a system that uses sensors and actuators to control a large irrigation system for a farmer in northern Wisconsin. The area is quite rural, and our original plan was to use GSM to send text messaged to the farmer, but we are finding out that 2G and 3G is being dropped across the united states, leaving us with LTE.
We are using an Arduino MEGA 2560 to interface with the irrigation system, and we are finding out that the next option we had (a SIM7600 module) is too large for our enclosure.
I have come across this GPy module. My plan now is to use the GPy to send/receive SMS from the farmer's cellphone, and to use the GPIO to communicate with the arduno (simple HIGH and LOW flags will do it). I cant find any example code anywhere for the module however. Where can I find some example code that shows how to control the GPIO and send/recieve text messages?
All the examples in the documentation should work on all devices (excluding the network examples that are not available on the GPy of course)
As for the text messages, first, you'll have to get a carrier that supports text messages (SMS) over NB-IoT or CAT-M1 (they exist, and around the office I've seen it work in the past, not exactly sure how it works with the phonenumbers though)
In the AT manual, https://docs.pycom.io/gitbook/assets/Monarch-LR5110-ATCmdRefMan-rev6_noConfidential.pdf, around section 6, there is a whole bunch of AT commands listed related to SMS. This is not built-in micropython functionality directly, as its not common to go the SMS route, but for farmes I get that you want to make it as convenient as possible.
You can send the commands using
lte.send_at_cmd('...')from the LTE api
robert-hh last edited by
@Bartosz-Karaban The Pycom documentation has quite a few examples. if you say, that you already use UART, is there a reason why you cannot use it, or are all UART ports of the MEGA already in use? If yes, you might use SPI. The GPY can only act as master, but the Arduino can be used in slave mode. A little bit more tricky than UART. There are also Arduino libs for a software UART, which work reasonably well.
@robert-hh We are already using UART but if there are ways around it it will be considered. Where can I find example code for the GPy though is my main concern?
robert-hh last edited by robert-hh
@Bartosz-Karaban Better user UART. Both the MESG2560 and the GPY have spare UART ports for that purpose. You'll just need three wires, GND, TX <-> RX, RX <-> TX. UART are core features of both platforms and support a buffered communication.