Easy onboard Raspberry Pi for web boat monitoring?

GHA

Well-known member
Joined
26 Jun 2013
Messages
12,424
Location
Hopefully somewhere warm
Visit site
Came across this last night...

https://www.wyliodrin.com/

Which may well be an easy way into programming a Raspberry Pi mini computer for many who are put off by linux & programming in general. Easy Peasy - a few steps online and it creates an operating system which you load onto the SD card which a Pi uses as a hard drive. Then if the Pi is on the internet you can program with a fairly easy graphical language from anywhere.

It's a shame the Pi can't measure voltage directly, but adding a cheap arduino it could.

What this means is, for example, for a boat in a marina with wifi you could fairly easily have something which would tell you battery voltage on the web. Or many other things once you get into it.

So far it looks like you have to have the web browser open for it to run, otherwise you could get it to email you if the voltage went below a certain level, or the bilge water raised above a switch.

Anyway, interesting stuff and an easy way into a cheap and powerful device.

Enjoy :)

 

mlines

Active member
Joined
31 Aug 2009
Messages
2,038
Location
Finchampstead, Wokingham, Berks
www.sportsboat.org.uk
I went the whole arduino route as it seemed a simpler device for basic automation tasks. Whilst I am happy to work in Linux it seems to me to be overkill to boot a whole OS for some simple monitoring. I have it driving a GSM/GPRS card so it feeds data to a webpage and also SMS messages me. This way the computing power is all on the service with the boat device acting purely as a lightweight client.

I posted this link here recently so apologies for posting it again if you have seen it http://www.sportsboat.org.uk/index.php/live-data - its off air today as I am soldering it up onto stripboard and adding in a real time clock and GPS.
 
Last edited:

GHA

Well-known member
Joined
26 Jun 2013
Messages
12,424
Location
Hopefully somewhere warm
Visit site
I went the whole arduino route as it seemed a simpler device for basic automation tasks. Whilst I am happy to work in Linux it seems to me to be overkill to boot a whole OS for some simple monitoring. I have it driving a GSM/GPRS card so it feeds data to a webpage and also SMS messages me. This way the computing power is all on the service with the boat device acting purely as a lightweight client.

I posted this link here recently so apologies for posting it again if you have seen it http://www.sportsboat.org.uk/index.php/live-data - its off air today as I am soldering it up onto stripboard and adding in a real time clock and GPS.
I'm a big fan of arduino as well,my fridge thermostat is one, with bluetooth and datalogging on 3 thermometers :) Too much fun.

But Wyliodrin caught my eye as an easy way for many people to get data onto the web without having to roll the shirt sleeves up too much. The visual programming looks like if could make jumping that first hurdle into code much easier.

Your project looks interesting, how do you do the graphs & dials?
 
Last edited:

mlines

Active member
Joined
31 Aug 2009
Messages
2,038
Location
Finchampstead, Wokingham, Berks
www.sportsboat.org.uk
For the graphs I use Google Charts - https://developers.google.com/chart/

The Arduino sends a simple HTTP command to my own website which feeds the raw data from the boat (temperature etc) into a MySQL database. Then anyone accessing pages on my website cause data from the database to be fed into a Google Charts plugin.

The temperature, humidity and battery battery monitor are now working on the bench and I want to add in an accelerometer and GPS to detect movement of the boat.

As with all Arduino projects its put together from bits and pieces of other peoples work. Its been heavily influenced by the "Scooterputer" project - http://www.janspace.com/b2evolution/arduino.php/2010/06/26/scooterputer
Google charts are clearly the work of Google, whilst the webpage modules to feed Google Charts are again from the web. These projects become more about gluing the component software parts together to get them working in the way you want.

Martin
 

stownsend

Member
Joined
15 Sep 2006
Messages
455
Location
South Wales
Visit site
Hi Martin

Which temp / hum sensor do you use, I've got a couple DHT11 units which side by side are out by a few degrees against each other and against a DS18S20.

Cheers

Stu
 

gregcope

Well-known member
Joined
21 Aug 2004
Messages
1,621
Visit site
I made a solution using a RPI, USB modem and a few other bits that wakes up occasionally to check stuff;

https://github.com/gregcope/piboatmon

One issue with the original Piboatmon is its power consumption was too high (20mAh+) which would slowly flatten my batteries on the mooring.

However now making a MkII based on an Arduino clone (Moteino Mega) with Mosfets to power on GPS/GSM modem, etc, so that it can be uber lower power. If I get most of it right on the MKII, the power consumption should be tiny (6months?). When it notices the Batt volts going above 13v will kick off a charge of the onboard battery.

Plans are for it to do Anchor watch, Temp, Depth and PIR sensors. System battery and House Battery monitoring (simple Volts).

I have a new found respect for hardware designers. I think the software is the easier part. The Piboatmon is written in Python, and the MKII is C++ due to the Ardunio. I have massively simplified the logic and dropped config by SMS - partly because most SMS providers do not send on SMS to GSM modems that have been off for a while.
 

GHA

Well-known member
Joined
26 Jun 2013
Messages
12,424
Location
Hopefully somewhere warm
Visit site
For the graphs I use Google Charts - https://developers.google.com/chart/

The Arduino sends a simple HTTP command to my own website which feeds the raw data from the boat (temperature etc) into a MySQL database. Then anyone accessing pages on my website cause data from the database to be fed into a Google Charts plugin.

Ta for that :cool: Do you have any pointers to example code for the http upload code?

The wyliodrin seems a great idea for basic stuff but also seems to have not really got off the found. Shame, the graphical programming would probably help a lot of people to get started. However, being at work and far from the boat I brought a pi and an arduino yun to play with, and just came across this..

https://www.basic6.com/b6launch/launch-faq#whatis

For the unaware.. An arduino yun is a little board which has a micro controller on it so you can plug in all sorts of cheap sensors and also a tiny computer which runs a version of linux, plus wifi so you can talk to it.

Basic6 lets you talk to it from anywhere, upload sketches (the micro controller programs) , reboot and start/stop the micro controller.

Downside for boats is the power consumption (showing 0.25a @ 5v) and a need for wifi to communicate.

But exciting stuff :cool: :cool: :cool:
 

simonfe

New member
Joined
1 Feb 2014
Messages
22
Location
Emsworth UK
Visit site

Heckler

Active member
Joined
24 Feb 2003
Messages
15,817
Visit site
Great to see the Arduino (and other micro boards) being used on-board.

Have programmed, tested but not yet installed a new engine alarm monitor for my VP 2003 using the Arduino Micro http://www.ybw.com/forums/showthread.php?406305-Home-Made-Volvo-Penta-2003-Instrument-Panel

In my case I would call it agricultural programming (hacking!) it sounds like there are some pretty advanced applications being dreamt up, keep it coming:encouragement:
I bought a board with a touch screen on it to try and do a YAPP. I failed! it has HY 280_262k on the screen which is screwed to the board which has HY STM32 100P on it. It has two USB connectors and a serial port on it with a JTAG connector.
If you plug a powered USB cable to it it goes thru a loop showing off its capabilities.
Owes me £25, anyone interested in it? PS one of these http://youtu.be/sqg3AJ9PEVg
S
 
Last edited:

GHA

Well-known member
Joined
26 Jun 2013
Messages
12,424
Location
Hopefully somewhere warm
Visit site
Great to see the Arduino (and other micro boards) being used on-board.

Have programmed, tested but not yet installed a new engine alarm monitor for my VP 2003 using the Arduino Micro http://www.ybw.com/forums/showthread.php?406305-Home-Made-Volvo-Penta-2003-Instrument-Panel

In my case I would call it agricultural programming (hacking!) it sounds like there are some pretty advanced applications being dreamt up, keep it coming:encouragement:

I think the internet of things is upon us :cool:
Not so easy on a boat as it's all reliant on wifi, but the processing power and price of some of the tech available now is amazing. Like these things, http://www.ebay.co.uk/itm/ESP8266-S...331?pt=LH_DefaultDomain_3&hash=item20f18ab6f3

Cost next to nothing.
 

mlines

Active member
Joined
31 Aug 2009
Messages
2,038
Location
Finchampstead, Wokingham, Berks
www.sportsboat.org.uk
Hi Martin

Which temp / hum sensor do you use, I've got a couple DHT11 units which side by side are out by a few degrees against each other and against a DS18S20.

Cheers

Stu

I use a DHT22 as it supports negative temperatures which the LS series that came in the Arduino kit does not. I am only interested in approximate accuracy but an article on the internet suggests that the +- 2% manufacturers spec is pretty close in real life.

Martin
 

maby

Well-known member
Joined
12 Jun 2009
Messages
12,783
Visit site
Do be careful of the power consumption of a Raspberry Pi - I was prototyping a boat monitor using one and left it powered up for a couple of weeks while we were away. The shore power failed shortly after we left and the Pi dragged the batteries down low enough to damage them!
 

GHA

Well-known member
Joined
26 Jun 2013
Messages
12,424
Location
Hopefully somewhere warm
Visit site
Do be careful of the power consumption of a Raspberry Pi - I was prototyping a boat monitor using one and left it powered up for a couple of weeks while we were away. The shore power failed shortly after we left and the Pi dragged the batteries down low enough to damage them!

Why didn't it email you to say the voltage was down shortly before turning itself off ;) ;)
 

maby

Well-known member
Joined
12 Jun 2009
Messages
12,783
Visit site
Why didn't it email you to say the voltage was down shortly before turning itself off ;) ;)

'cos I hadn't got that far with the coding! It was just capturing data at the time...

It was a bit ironic that the device I was building to protect the battery ended up destroying it!
 

mlines

Active member
Joined
31 Aug 2009
Messages
2,038
Location
Finchampstead, Wokingham, Berks
www.sportsboat.org.uk
The code to get the Arduino to submit to the website consists of 3 steps below.

Now being a simple device there is little security around this but I have deleted some elements in some attempt to secure it. Everything in CAPS is for you to substitute

The first is the actual HTTP request that needs to be generated (you can type this into a browser to test), this passes the "values" to the website. Value0=temperature etc.

Code:
http://www.WEBSITE.com/DIRECTORY/SCRIPT.php?value0=20&value1=33&value2=12&value3=15&value4=1

You need the Arduino to generate this HTTP GET request.

The Arduino has a GSM modem connected to a serial port, this is commanded with "AT" modems commands

Code:
printLCD(ALERT, "Sending HTTP Get");
  GPRS.println("AT+CSQ");
  delay(100);
  GPRS.println("AT+CGATT?");
  delay(100);
  GPRS.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");//setting the SAPBR, the connection type is using gprs
  delay(1000);
  GPRS.println("AT+SAPBR=3,1,\"APN\",\"prepay.tesco-mobile.com\"");//setting the APN, the second need you fill in your local apn server
  delay(5000);
  GPRS.println("AT+SAPBR=0,1");//setting the SAPBR, for detail you can refer to the AT command mamual
  delay(2000);
  GPRS.println("AT+SAPBR=1,1");//setting the SAPBR, for detail you can refer to the AT command mamual
  delay(2000);
  GPRS.println("AT+HTTPINIT"); //init the HTTP request
  delay(2000);
  String webstring = "AT+HTTPPARA=\"URL\",\"www.WEBSITE.com/DIRECTORY/SCRIPT.php?value0=";
  webstring.concat(t);
  webstring.concat("&value1=");
  webstring.concat(h);
  webstring.concat("&value2=");
  webstring.concat("12");
  webstring.concat("&value3=");
  webstring.concat("15");
  webstring.concat("&value4=");
  webstring.concat("1");
  webstring.concat("\"");
  GPRS.println(webstring); //init the HTTP request
  delay(1000);
  GPRS.println("AT+HTTPACTION=0");//submit the request
  delay(10000);//the delay is very important, the delay time is base on the return from the website, if the return datas are very large, the time required longer.
  //while(!mySerial.available());
  GPRS.println("AT+HTTPREAD");// read the data from the website you access
  delay(300);
  GPRS.println("");

Then at the far end you need the web script to feed it into the website MySQL database, this is the php script you called in the HTTP request

Code:
<?php

echo "connection receiving - ";
$value0=$_GET['value0'];
$value1=$_GET['value1'];
$value2=$_GET['value2'];
$value3=$_GET['value3'];
$value4=$_GET['value4'];


$opendb=mysql_connect("SERVER","DATABASE","PASSWORD") or mysql_error("never come here");
mysql_select_db("TABLE",$opendb);
if ($opendb){
  echo " database open - ";
  $query = "INSERT INTO TABLE VALUES( '', '$value0', '$value1',  '$value2', '$value3', '$value4', UNIX_TIMESTAMP());";
  /* Run the query */
  echo $query;
  $result= MYSQL_QUERY($query) or die( "Failed" );
  mysql_close($opendb);
  echo "values written = $value0 and $value1 and $value2 and $value3 and $value4";
}

?>
 

mlines

Active member
Joined
31 Aug 2009
Messages
2,038
Location
Finchampstead, Wokingham, Berks
www.sportsboat.org.uk
Battery consumption is a possible issue.

1. It will detect the shorepower failure and will text me SMS messages to report the issue.

2. In discussions with a microcontroller expert at work (remember I am a hobbyist stitching other people code together for my solution) the Arduino can be persuaded to go to sleep for low consumption. However I have not tried this yet. I have played with the GSM modem which has a soft control to turn it off and on and this doesn't work which I have taken up with the board supplier.
 

maby

Well-known member
Joined
12 Jun 2009
Messages
12,783
Visit site
Battery consumption is a possible issue.

1. It will detect the shorepower failure and will text me SMS messages to report the issue.

2. In discussions with a microcontroller expert at work (remember I am a hobbyist stitching other people code together for my solution) the Arduino can be persuaded to go to sleep for low consumption. However I have not tried this yet. I have played with the GSM modem which has a soft control to turn it off and on and this doesn't work which I have taken up with the board supplier.

There are various levels of power saving that you can select on an Arduino - at its most extreme, the current consumption is miniscule. To use the most aggressive levels of power saving can add to the complexity of both your code and the electronics.
 
Top