Remote monitoring via GSM/SMS Arduino or Pi

skyflyer

Active member
Joined
26 Jan 2011
Messages
1,433
Location
Worcester, UK
Visit site
This topic raises its head from time to time and I see some previous solutions based on wifi availability but I'm hoping to find someone who has managed to set up either an Arduono or a Raspberry Pi, with it's own cellular simcard to permit remote monitoring of parameters like battery voltage and power generated by the solar panels.

I have already managed to design an 'alert' system, adapting one of those cheap car alarm systems which sends an SMS text message when a threshold is exceeded, (as well as geofencing by GPS) but this doesnt permit any realtime monitoring or historical data download.

There is some open source PI based software on www.emoncms which permits historic data interrogation for household mains voltage solar installations which might be adaptable but my coding knowledge is pretty limited and to have any hope of success, what I really need is someone who has succeeded with this and I can then modify or adapt something that is already close to what I need.
 

GHA

Well-known member
Joined
26 Jun 2013
Messages
12,517
Location
Hopefully somewhere warm
Visit site
With Internet access you can operate openplotter on a pi out of the box through realvnc from anywhere , so use the desktop as if you were there. Then signalk will make it easy to view the data or save it to a database to view pretty graphs.
 

skyflyer

Active member
Joined
26 Jan 2011
Messages
1,433
Location
Worcester, UK
Visit site
With Internet access you can operate openplotter on a pi out of the box through realvnc from anywhere , so use the desktop as if you were there. Then signalk will make it easy to view the data or save it to a database to view pretty graphs.
Thats the point - internet access via wifi is a non starter so my problem is how to interface with a gsm module two allow mobile data access. I cans ee stuff online about how to send and receive SMS messages and make voice calls, but struggling to find how you connect to data network for internet access using a module with sim card
 

GHA

Well-known member
Joined
26 Jun 2013
Messages
12,517
Location
Hopefully somewhere warm
Visit site
Thats the point - internet access via wifi is a non starter so my problem is how to interface with a gsm module two allow mobile data access. I cans ee stuff online about how to send and receive SMS messages and make voice calls, but struggling to find how you connect to data network for internet access using a module with sim card
Is a cheap smartphone & data sim an option?
 

AngusMcDoon

Well-known member
Joined
20 Oct 2004
Messages
8,857
Location
Up some Hebridean loch
Visit site
Thats the point - internet access via wifi is a non starter so my problem is how to interface with a gsm module two allow mobile data access. I cans ee stuff online about how to send and receive SMS messages and make voice calls, but struggling to find how you connect to data network for internet access using a module with sim card

Get a GSM module with a data connection capability & a MQTT client. Quectel for one do one. You will need to find a dev board with the modem already mounted, a SIM card holder & an aerial socket.

Connect the modem's Tx & Rx lines to the same on your processor board. Write some code to configure the modem via AT commands to connect to the network data service. There are plenty of examples on the interweb.

Create a free account on a MQTT server. These typically allow about 5 connections simultaneously in the free packages.

On your processor write AT commands to publish MQTT messages with your data in to your chosen topics.

From anywhere in the world from a MQTT browser on an internet connected device subscribe to your topics to read your data. You could create your own Android, Windows or Linux app to do the same thing but showing it in a nice user interface.

Bish-bosh, you just connected your boat to the internet of things. The above is basically how it's done for mobile IoT devices.
 

lw395

Well-known member
Joined
16 May 2007
Messages
41,949
Visit site
I suggest starting by thinking long and hard about exactly what you want to achieve.
There is a lot of knowledge in the Arduino community if you chose to go that way.
If you only want to access a few dozen or so key parameters, then sending a text either at regular intervals or in response to a command is one approach.
I dabbled in that some years ago. It has the advantage that it's relatively simple to understand at 'nut and bolt level' and can work robustly with only a 2G network.
The other extreme is to be able to remotely log in to a computer-like system and explore it, re-program it, make it do what you want, limited only by the peripheral IO and the frustration of being 50 miles away when you break it.
At which point you might want to send it a crude text saying CTRL-ALT-DEL or something...
 

skyflyer

Active member
Joined
26 Jan 2011
Messages
1,433
Location
Worcester, UK
Visit site
As usual it becomes evident that I probably asked the wrong question!

What I am trying to achieve is to be able to monitor battery voltage (effectively capacity, if a resting voltage) and solar power input and current draw, from over 250 miles away.

Ideally I would like to be able to review the history so that should an issue occur I can get an idea of what has gone into and out of the battery over the previous X minutes, hours or even days. The aforementioned emoncms open source software does this brilliantly for domestic installations and I have a mate who is reasonably familiar with the configuration and set-up so if we can make that work for a 12v system (which surely is only a matter of selecting the correct type of sensors?) then why not.

The issue is to connect to the internet over the cellular network. On a smartphone this is a wholly transparent process. You open up your browser app, or your messaging app and the data flows.

I can s find, easily on the internet, how to set up an Arduino or a Pi with a GSM/GPRS field that takes a phone sim card. I can see how to send AT commands and other commands that wil enable it to send and receive SMS texts. It would be relatively easy to code the microprocessor to send an SMS whenever a limit (eg battery voltage) is reached. I could also code it to log some data send me a text every day with that data.

But texting like that is not an efficient way to transmit data. Text messages are expensive compared to equivalent data transmission over the mobile data network. A PAYG sim card that I would use in such device will almost certainly have a limited number orf text messages or a cost per message.

So my knowledge gap relates specifically to how I "make a connection" from a Pi or Arduino to the mobile data network.

Sadly "you can find it on the inter web" rarely helps. I have been truing for pretty much two days solid to find it on the internee which is why i end up here! The problem is knowing what to search for. So far my chosen search terms have only ever yielded information about sending text messages.

The long term answer is of course to start at page 1 of "the Pi manual" and work through it but I was hoping someone here could shortcut that for me!

GHA - could you bit a bit more specific than "Write some code to configure the modem via AT commands to connect to the network data service. There are plenty of examples on the interweb."

Final point; this is not only about my boat. A friend runs a charity that installs solar powered inTRAnet systems in remote african villages. The entire educational knowledge base is on a memory card and the network runs on a Pi running its own wifi network.. The kids then use recycled laptops on wifi to access the knowledgeable, save their work and so on. He would like to be remotely warned if the battery voltage drops below a threshold (because the locals have a habit of assuming that the never-before-seen electrical power is unlimited and start plugging in freezers) and ideally to review the data. Bizarrely although these villages have no power, they are nearly all within cellular phone coverage! I sugegsted that if I could get a system up and running on my boat, it could very easily transpose to his various installations.
 

AngusMcDoon

Well-known member
Joined
20 Oct 2004
Messages
8,857
Location
Up some Hebridean loch
Visit site
As usual it becomes evident that I probably asked the wrong question!

What I am trying to achieve is to be able to monitor battery voltage (effectively capacity, if a resting voltage) and solar power input and current draw, from over 250 miles away.

Ideally I would like to be able to review the history so that should an issue occur I can get an idea of what has gone into and out of the battery over the previous X minutes, hours or even days. The aforementioned emoncms open source software does this brilliantly for domestic installations and I have a mate who is reasonably familiar with the configuration and set-up so if we can make that work for a 12v system (which surely is only a matter of selecting the correct type of sensors?) then why not.

The issue is to connect to the internet over the cellular network. On a smartphone this is a wholly transparent process. You open up your browser app, or your messaging app and the data flows.

I can s find, easily on the internet, how to set up an Arduino or a Pi with a GSM/GPRS field that takes a phone sim card. I can see how to send AT commands and other commands that wil enable it to send and receive SMS texts. It would be relatively easy to code the microprocessor to send an SMS whenever a limit (eg battery voltage) is reached. I could also code it to log some data send me a text every day with that data.

But texting like that is not an efficient way to transmit data. Text messages are expensive compared to equivalent data transmission over the mobile data network. A PAYG sim card that I would use in such device will almost certainly have a limited number orf text messages or a cost per message.

So my knowledge gap relates specifically to how I "make a connection" from a Pi or Arduino to the mobile data network.

Sadly "you can find it on the inter web" rarely helps. I have been truing for pretty much two days solid to find it on the internee which is why i end up here! The problem is knowing what to search for. So far my chosen search terms have only ever yielded information about sending text messages.

The long term answer is of course to start at page 1 of "the Pi manual" and work through it but I was hoping someone here could shortcut that for me!

GHA - could you bit a bit more specific than "Write some code to configure the modem via AT commands to connect to the network data service. There are plenty of examples on the interweb."

Final point; this is not only about my boat. A friend runs a charity that installs solar powered inTRAnet systems in remote african villages. The entire educational knowledge base is on a memory card and the network runs on a Pi running its own wifi network.. The kids then use recycled laptops on wifi to access the knowledgeable, save their work and so on. He would like to be remotely warned if the battery voltage drops below a threshold (because the locals have a habit of assuming that the never-before-seen electrical power is unlimited and start plugging in freezers) and ideally to review the data. Bizarrely although these villages have no power, they are nearly all within cellular phone coverage! I sugegsted that if I could get a system up and running on my boat, it could very easily transpose to his various installations.

My opinion is that MQTT really is the way to go for this if you don't want to use text messages. The MQTT protocol at its lowest level really is very simple (& the African example you give is very similar to what it was originally designed for). You can explore MQTT without making any decisions. Create a free account here...

CloudMQTT - Hosted message broker for the Internet of Things

Get a MQTT client for your computer like mqtt.fx...

Home

and start exploring. There are plenty of tutorials & descriptions out there. You will be able to use it at its simplest, QOS 0. The messages are trivially simple at this level.

If you decide this is the way to go (it is for pretty much all small IoT devices) then start looking for a GSM modem that implements it to make life easy.

Alternatively if you want to use a RPi there will be oodles of examples that use MQTT via a GSM modem from Linux. All the modem stuff will be built in - you'll never see an AT command. A MQTT library like mosquitto will be available already. You just write the data to the topic you want via its API & it all magically works.
 
Last edited:

AngusMcDoon

Well-known member
Joined
20 Oct 2004
Messages
8,857
Location
Up some Hebridean loch
Visit site
I don't know where you plan to get your data from that you want to monitor remotely but my Epever MPPT controller has a serial data port for which I have a cable where I can read out all the things you talk about. Your controller may have the same.
 

GHA

Well-known member
Joined
26 Jun 2013
Messages
12,517
Location
Hopefully somewhere warm
Visit site
This might be of interest -
boatybits/boatymonpy

Very much work in progress but it works, well the voltage/current/barometer have been up and running. Sends the data to an access point (Pi) as signalk.

Boards were about 40 quid for 5 from JLCPCB. So that would be the complicated option but very low power, next to nothing if some deep sleep time was programmed I to the esp32. Still need a cheap mobile creating a wifi network to get data to the Web. Then you'd (someone would) need to get the esp to send data as Angus says, mqtt. There are plenty of Internet of things sites, some will accept data as mqtt. Then display the data in plots or a dashboard etc.
IoT Analytics - ThingSpeak Internet of Things
Adafruit IO
Easy way would be a pi running openplotter. It should have apps to connect to Ads1115 voltage sensors by now or will soon, though you'd need a resistor network to lower the voltage range to 5v or less for the Ads1115. Once the data is in SignalK it has various apps, there's a cloud signalk website, or send it as as mqtt, or look at the Pi desktop over realvnc. For sailing the boat a Pi would be a much better choice, run opencpn and get all the nmea data in there. Works great :cool:

Someone might design a Pi hat from jlcpcb.com with the sensors to plug into the Pi one day, make it even easier :cool:
 
Last edited:

ryanroberts

Well-known member
Joined
25 Jul 2019
Messages
894
Visit site
Prototype kits are a hassle free if slightly expensive way of getting started. If you are really after low power + cheap connectivity then it might be worth looking at NbIot. NB-IoT Rapid Development Kit.

Pi is not really a low power embedded device, it's a pretty powerful single board computer. If you need very low power consumption then you are looking at bare metal programming on lower power chipsets.
 

ryanroberts

Well-known member
Joined
25 Jul 2019
Messages
894
Visit site
Ah, Africa. Scrap the NbIot plan. Domestic power readings can be compressed / encoded quite efficiently using a slight variant of facebook's gorilla encoding technique Gorilla: A fast, scalable, in-memory time series database. Accumulated solar Ah would probably behave similarly, raw voltage / amps would be a bit of a bugger though.

A friend of mine has a project for fuel payments in Kenya, this is all SMS based but doesn't require anything near real time.
 
Last edited:

pessimist

Well-known member
Joined
7 May 2003
Messages
3,185
Location
Exmoor. Boat in Dartmuff.
Visit site
This topic raises its head from time to time and I see some previous solutions based on wifi availability but I'm hoping to find someone who has managed to set up either an Arduono or a Raspberry Pi, with it's own cellular simcard to permit remote monitoring of parameters like battery voltage and power generated by the solar panels.

I have already managed to design an 'alert' system, adapting one of those cheap car alarm systems which sends an SMS text message when a threshold is exceeded, (as well as geofencing by GPS) but this doesnt permit any realtime monitoring or historical data download.

There is some open source PI based software on www.emoncms which permits historic data interrogation for household mains voltage solar installations which might be adaptable but my coding knowledge is pretty limited and to have any hope of success, what I really need is someone who has succeeded with this and I can then modify or adapt something that is already close to what I need.

Something like this? http://skippersmate.co.uk:7073/pcl/monitoring/index.html. Runs happily over a GSM connection.
 
Top