2018-06-21, 11:00 PM
I have a Freeboard somewhere and that has nmea seatalk conversion using an arduino so the code exists (never tried it though). I think that rob42 on github knows more.
/M
/M
#include <TinyGPS++.h>
#include "EspSigK.h"
#include <SoftwareSerial.h>
#define BAUD_RATE 115200
#define BAUD_RATE2 4800
SoftwareSerial ss(5, 12, false, 256);
const String hostname = "openplotter"; //Hostname for network discovery
const String ssid = "openplotter"; //SSID to connect to
const String ssidPass = "12345678"; // Password for wifi
EspSigK sigK(hostname, ssid, ssidPass); // create the object
// The TinyGPS++ object
TinyGPSPlus nasa;
TinyGPSCustom mag(nasa, "HCHDG", 1); // $GPGSA sentence, 15th element
void setup() {
Serial.begin(115200);
ss.begin(4800);
sigK.setPrintDebugSerial(true); // default false, causes debug messages to be printed to Serial (connecting etc)
sigK.setPrintDeltaSerial(true); // default false, prints deltas to Serial.
//sigK.setServerHost("10.10.10.1"); // Optional. Sets the ip of the SignalKServer to connect to. If not set we try to discover server with mDNS
//sigK.setServerPort(80); // If manually setting host, this sets the port for the signalK Server (default 80);
sigK.begin(); // Start everything. Connect to wifi, setup services, etc...
}
void loop() {
while (ss.available() > 0){
nasa.encode(ss.read());
}
//Two ways to send deltas, you can do this to send multiple values in the same value.
float randNumber1 = atof(mag.value() );
randNumber1 = randNumber1 * 3.14/180;
sigK.addDeltaValue("navigation.headingMagnetic",randNumber1 );
sigK.sendDelta();
//Or send a single value
//sigK.sendDelta("some.signalk.path2", 3.413);
//try and use this delay function instead of built-in delay()
//this function will continue handling connections etc instead of blocking
sigK.safeDelay(1000);
//if you don't use delays (or the delay function above) call this one every
//loop in order to handle http/websocket connections etc...
//sigK.handle();
}
(2018-06-22, 12:33 PM)PaddyB Wrote: [ -> ]Just a quick one sort of relavent - I've just got an esp sending data from a nasa compass straight to signalk using the tinygps++ library , software serial and and EspSigk with a rs232/ttl adaptor powered from the esp 3.3v pin - I'll leave it on all day to see if it breaks
With HDG selected in the conver to NMEA plugin the data shows up in Opecnn dashboard and gets automatically entered into the logbook.
Turned off the security to allow the data in , but think Sbender is going to sort this -
https://signalk-dev.slack.com/archives/C...1013000074
rough and ready code >
Code:#include <TinyGPS++.h>
#include "EspSigK.h"
#include <SoftwareSerial.h>
#define BAUD_RATE 115200
#define BAUD_RATE2 4800
SoftwareSerial ss(5, 12, false, 256);
const String hostname = "openplotter"; //Hostname for network discovery
const String ssid = "openplotter"; //SSID to connect to
const String ssidPass = "12345678"; // Password for wifi
EspSigK sigK(hostname, ssid, ssidPass); // create the object
// The TinyGPS++ object
TinyGPSPlus nasa;
TinyGPSCustom mag(nasa, "HCHDG", 1); // $GPGSA sentence, 15th element
void setup() {
Serial.begin(115200);
ss.begin(4800);
sigK.setPrintDebugSerial(true); // default false, causes debug messages to be printed to Serial (connecting etc)
sigK.setPrintDeltaSerial(true); // default false, prints deltas to Serial.
//sigK.setServerHost("10.10.10.1"); // Optional. Sets the ip of the SignalKServer to connect to. If not set we try to discover server with mDNS
//sigK.setServerPort(80); // If manually setting host, this sets the port for the signalK Server (default 80);
sigK.begin(); // Start everything. Connect to wifi, setup services, etc...
}
void loop() {
while (ss.available() > 0){
nasa.encode(ss.read());
}
//Two ways to send deltas, you can do this to send multiple values in the same value.
float randNumber1 = atof(mag.value() );
randNumber1 = randNumber1 * 3.14/180;
sigK.addDeltaValue("navigation.headingMagnetic",randNumber1 );
sigK.sendDelta();
//Or send a single value
//sigK.sendDelta("some.signalk.path2", 3.413);
//try and use this delay function instead of built-in delay()
//this function will continue handling connections etc instead of blocking
sigK.safeDelay(1000);
//if you don't use delays (or the delay function above) call this one every
//loop in order to handle http/websocket connections etc...
//sigK.handle();
}
(2018-06-22, 04:50 PM)Smartell Wrote: [ -> ]Doing this wireless? ...wireless Nmea?
(2018-06-26, 06:14 PM)Sailoog Wrote: [ -> ]I guess this post is relevant for this.
https://groups.google.com/forum/#!topic/...LN2K52LN5M
There are 2 solutions on for kplex and one for signal k
(2018-06-30, 04:24 PM)jim321 Wrote: [ -> ]"i tried adding strict=0 in my config file"
where is the config file located?