Centrale de navigation Low Cost sur plateforme Arduino - présentation

Publié le 22 Octobre 2013

Projet: réaliser une centrale de navigation sur base de processeur Arduino qui  diffusera les données NMEA via le Wifi sur Tablette (instruments) et PC portable (navigation).

Outre Arduino, ce projet s'appuiera sur les logiciels:

  • OpenCPN pour la navigation
  • PolarCOM, multiplexeur NMEA, afficheur instruments sur Linux
  • Iregatta, logiciel tactique dédié régate sur tablette Android

La réalisation sera totalement openSource sur ubuntu.

 

Schéma synoptique

Schéma synoptique

Références:

Le site qui a déclenché l'idée et montre les capacités étonnantes des liseuse (encre électronique) pour l'affichage des instruments: http://www.holdentechnology.com/sailing-and-fun

Multiplexeur NMEA sur base Arduino: http://pagesperso.univ-brest.fr/~flye/Instrumentation.html

Iregatta: https://play.google.com/store/apps/details?id=dk.letscreate.aRegatta&hl=fr

GPS Module: http://learn.parallax.com/KickStart/28500

Le routeur WIFI basse consommation: http://wiki.openwrt.org/toh/tp-link/tl-mr3020

Site de référence Arduino: http://www.arduino.cc/

Site d'approvisionnement pour Arduino et batteries Lipo low cost: http://www.hobbyking.com/hobbyking/store/index.asp

La carte Arduino Mega 2560, le mini routeur TP Link, trames NMEA sur OpenCPN et les instruments virtuels de  PolarCOMLa carte Arduino Mega 2560, le mini routeur TP Link, trames NMEA sur OpenCPN et les instruments virtuels de  PolarCOM
La carte Arduino Mega 2560, le mini routeur TP Link, trames NMEA sur OpenCPN et les instruments virtuels de  PolarCOMLa carte Arduino Mega 2560, le mini routeur TP Link, trames NMEA sur OpenCPN et les instruments virtuels de  PolarCOM

La carte Arduino Mega 2560, le mini routeur TP Link, trames NMEA sur OpenCPN et les instruments virtuels de PolarCOM

Les instruments (d'époque !) toujours opérationnels Pen Lann mariner 6

Centrale de navigation Low Cost sur plateforme Arduino - présentation

Spécifications

NMEA multiplexer (Arduino Mega car 4 ports série)

Inputs:

  • GPS (NMEA)

  • Speedo, Wind Angle and Strength sensors

  • AIS (option à étudier)

Outputs:

  • NMEA over Ethernet

  • NMEA over USB and RS232

  • Web server

Other:

  • Datalogger

WiFi Router
Ubuntu Notepad

OpenCPN

Cockpit tablet instrument display

Samsung Galaxy Tab2 10.1

Mast display

Tablet or 7segment led display (to define)

Un POC à la maison qui semble prometteur

Code du POC Arduino

les potentiomètres représentant les capteurs wind angle, wind speed, water speed sont sur les PINs analogiques 5,4 et 3.

Arduino est sur l'adresse 192.168.0.177, port 9999 et transmet trois trames NMEA (MRC, MWV, VHW) toutes les 500 ms.

///////////////////////////////////////////////////////////////////////////////////////////////////////////

include <SPI.h>
#include <Ethernet.h>
//#include <string.h>



char CSSentence[85] = "" ; //string for sentence assembly
char MRCSentence[85] = "" ;
char MWVSentence[85] = "" ; //string for MVW for sentence assembly
char VHWSentence[85] = "" ; //string for VHW sentence assembly
char NMEASentence[85] = "" ; //string for NMEA sentence
int cs ; //checksum

// network configuration. gateway and subnet are optional.

// the media access control (ethernet hardware) address for the shield:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
//the IP address for the shield:
byte ip[] = { 192, 168, 0, 177 };
// the router's gateway address:
byte gateway[] = { 192, 168, 0, 1 };
// the subnet:
byte subnet[] = { 255, 255, 255, 0 };

// telnet defaults to port 9999
EthernetServer server = EthernetServer(9999);

void setup()
{
// initialize the ethernet device
Ethernet.begin(mac, ip, gateway, subnet);
// start listening for clients
server.begin();
}

void loop()
{
// analog pin 5 is wind angle
// analog pin 4 is wind speed
// analog pin 3 is water speed (speedo)

// if an incoming client connects, there will be bytes available to read:
EthernetClient client = server.available();

/////////////////////////////////// Create MRC Sentence (GPS simulation)
strcpy(MRCSentence, "GPRMC,220516,A,5133.82,N,00042.24,W,3.8,4.8,130694,004.2,W"); // MRC sentence is simulated


// /////////////////////////////////Create MWV Sentence - Wind Speed and Angle
char b[50]="0";
char c[50]="0";
int Z = 0;
//Assemble a sentance of the various parts so that we can calculate the proper checksum
strcpy(MWVSentence,"PIMWV,"); //The string could be kept the same as what it came in as, but I chose to use the P (prefix for all proprietary devices) and I for instrument

//read Pin 5 : Relative wind Direction
Z=analogRead(5)/2; // Wind Direction can go from 0 to 360°
sprintf(b,"%d",Z);
strcat(MWVSentence, b);
strcat(MWVSentence, ",R,");

//read Pin 4 : Relative Wind Speed
Z=analogRead(4)/2; // Wind speed can go from 0 to 50 knots
sprintf(b,"%d",Z/10); //b represent the knots
sprintf(c,".%d",(Z-(Z/10)*10)); //c represent the deci knots
strcat(MWVSentence, b);
strcat(MWVSentence, c);
strcat(MWVSentence, ",N,A"); //the atoi command truncated the decimals, might as well stick .0 back on in case something is expecting this field to have a decimal


////////////////////////////////////Create VHW Sentence - Boat speed (water speed)h
//read Pin 3 : Boat Speed
Z=analogRead(3)/5; // Speed from 0 to 20 Knots - resolution of 0.1 Knots
//dtostrf(z, 5, 2, b); //dtostrf(floatVar, minStringWidthIncDecimalPoint, numVarsAfterDecimal, charBuf)
strcpy(VHWSentence, "PIVHW,,T,211,M,");
sprintf(b,"%d",Z/10); //b represent the knots
sprintf(c,".%d",(Z-(Z/10)*10)); //c represent the deci knots
strcat(VHWSentence, b);
strcat(VHWSentence, c);
strcat(VHWSentence, ",N,0.0,K");



////////////////////// NMEA to Ethernet //////////////////////////
EtherNMEA(MRCSentence);
delay (10);
EtherNMEA(MWVSentence);
delay (10);
EtherNMEA(VHWSentence);
delay (300);

}


// ////////////////////// Functions ////////////////////////////////////


String Checksum(char* CSSentence) {
cs=0; //clear any old checksum
char b[50]="0";
//return b;

for (int n=0; n < strlen(CSSentence); n++) {
cs ^= CSSentence[n]; //calculates the checksum
}
sprintf(b,"%02X",cs);
return b;
}

void EtherNMEA (char* NMEASentence) {
server.print("$"); // Assemble the final message and send it out the serial port
server.print(NMEASentence);
server.print("*");
server.print(Checksum(NMEASentence)); // Call Checksum function
server.println();
}

Next Step:

Connexion du module GPS

Rédigé par Jerome Delecour

Publié dans #Instruments

Repost0
Pour être informé des derniers articles, inscrivez vous :
Commenter cet article
Y
thanks for the idea :)<br /> <br /> https://www.youtube.com/watch?v=FXFfLBzqTg0
Répondre
N
Salut, très beau développement ;-) Bravo<br /> <br /> Je développe aussi sur Arduino 2560. J'essaye de récupérer des infos du bus CAN. Pour le moment ça fonctionne <br /> (avec le module libelium https://www.cooking-hacks.com/documentation/tutorials/can-bus-module-<br /> shield-tutorial-for-arduino-raspberry-pi-intel-galileo/)<br /> <br /> Mais je n'arrive pas encore à interpréter les informations, Je n'ai pas de guide de référence des codes.<br /> Voici un exemple de réception : <br /> <br /> id: 37E rtr: 0 => data: 0,22,FF,FF,FF,FF,FF,7<br /> id: 67E rtr: 0 => data: FF,DF,FF,FF,FF,FF,FF,FF<br /> id: 37A rtr: 0 => data: FF,DF,FF,FF,FF,FF,FF,FF<br /> id: 67E rtr: 0 => data: FF,DF,FF,FF,FF,FF,FF,FF<br /> <br /> Bon je n'ai pas beaucoup de données qui circulent car les capteurs Vent, sonde... ne sont pas branchés, j'ai que le routeur pour les essais, je suis en atelier. <br /> <br /> As-tu des informations à me donner?<br /> <br /> Merci d'avance!<br /> <br /> Bon vent<br /> <br /> Nicolas
Répondre
J
Voici plusieurs liens qui peuvent etre utiles pour un développement NMEA 2000 sur Arduino :<br /> http://boatprojects.blogspot.fr/2012/12/beginners-guide-to-nmea-2000-nmea-0183.html<br /> http://bitstream24.com/wp-content/uploads/2013/09/NMEA2K_Network_Design_v2.pdf<br /> http://www.seeedstudio.com/wiki/CAN-BUS_Shield<br /> <br /> bon courage !
O
Je suis en train de commencer un projet un peu similaire ( j'ai toujours les instruments Pen Lann d'il y a 40 ans) . Par contre, au niveau affichage, j'ai prefere un Triton T41. Vu que le triton a besoin de NMEA2000, j'ai choisi une arduino Duo, qui a 2 ports CANS integres en plus des 4 ports serie. Le codage des PGNs va etre un peu complique, et surtout le protocole NMEA2000. Cependant, vu qu'il n'y a pour l'instant que le T41 sur le bus N2K, certaines simplifications sont peut etre possibles...<br /> Regards. Olivier.
Répondre
K
Hi Jerome,<br /> <br /> nice project! Currently I'm looking for something like Seatalk+NMEA reader with wifi extension for iRegatta. :-)<br /> <br /> I found on the web something similar to your project.<br /> <br /> <br /> Maybe it is interesting to you.<br /> <br /> <br /> Regards.<br /> Kon<br /> <br /> http://www.42.co.nz/freeboard/
Répondre