This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
wifi signalK display
#1
Hi, I'm thinking to build a wifi display capable to show some signalk value (distance to way point, SOG etc. + a 5 min. timer).
I'm thinking to a battery powered esp8266 connected to the openplotter AP, an lcd display and a pushbutton to select the signalk message...

but I really don't know where to start...

every tips will be appreciated.....
Reply
#2
Done similar just as a test briefly >

Get easyESP up and running on the esp8266 > https://www.letscontrolit.com/wiki/index.php/ESPEasy

Then spend a bit of time on the wiki to set up the LCD, not that hard as the setup is all web based, then you need to set up the esp to receive MQTT. Then in signalk node-red set up MQTT there as well, need an account set up in Openplotter.
Then you can use node red to send MQTT messages to the ESP , cn't remember exactly how it worked but lots help on the wiki.
https://www.letscontrolit.com/wiki/index...LCDDisplay

Sorry, bit short on detail but hopefully something to have a look at , setup is mostly menu/graphical, - going to build a real one sometime Cool .
Reply
#3
thanks a lot 
MQTT is the way........
Reply
#4
You can use also the node server MQTT plugin that runs an embedded MQTT broker and automatically publishes all Signal K data there. No Node-RED flows needed, install the plugin from the App Store and enable & configure.

We are in the process of rewriting the plugin and defining more formally the mapping from SK to MQTT and vice versa, so the topic structure will change in the future.


Sent from my iPhone using Tapatalk
Reply
#5
Hi, I installed the signalk-mqtt-gw plug-in, but "Provider & Plugin Status" give me an error:

Failed to start: /home/pi/.signalk/node_modules/mdns/build/Release/dns_sd_bindin...

and I can't enable and configure it.

I'm trying to send simulated signalK from Signal K delta simulator...

on esp8266 side, I'm following this how to, to receive playload. (I really don't know ESPEasy
I'm not so sure about information and credentials of the MQTT server

Code:
const char* mqttServer = "???????????";
const int mqttPort = ??????;
const char* mqttUser = "?????????";
const char* mqttPassword = "???????????";



Huh

tnks
Reply
#6
(2018-12-02, 01:53 AM)cepicscepics Wrote: Hi, I installed the signalk-mqtt-gw plug-in, but "Provider & Plugin Status" give me an error:

Failed to start: /home/pi/.signalk/node_modules/mdns/build/Release/dns_sd_bindin...

and I can't enable and configure it.
Hmm. I thought I fixed the mdns problem in version 1.0.2 - what version do you have?
Once you get to run the local server (see plugin config) you should check first from the command line that everything is working  with mosquitto_sub. Local server does not require username/password.



Code:
mosquitto_sub -h localhost -p 1884 -t 'vessels/self/navigation/speedOverGround'
Reply
#7
(2018-12-02, 05:56 PM)tkurki Wrote:
(2018-12-02, 01:53 AM)cepicscepics Wrote: Hi, I installed the signalk-mqtt-gw plug-in, but "Provider & Plugin Status" give me an error:

Failed to start: /home/pi/.signalk/node_modules/mdns/build/Release/dns_sd_bindin...

and I can't enable and configure it.
Hmm. I thought I fixed the mdns problem in version 1.0.2 - what version do you have?
Once you get to run the local server (see plugin config) you should check first from the command line that everything is working  with mosquitto_sub. Local server does not require username/password.



Code:
mosquitto_sub -h localhost -p 1884 -t 'vessels/self/navigation/speedOverGround'



Quote:what version do you have?

Signal K Server  version 1.7.0

or you where talking about of plug in's version?


thinking to black screen solving, Now I removed the plug in, deleting his line on: ~/.signalk/package.json
Code:
sudo nano ~/.signalk/package.json
cd ~/.signalk/
npm prune

but screen still black

Quote:Once you get to run the local server (see plugin config) you should check first from the command line that everything is working  with mosquitto_sub.

????

Quote:Local server does not require username/password.

I will try the code on esp8266 without username/password. lines...

Quote:[quote pid='7790' dateline='1543769767']
Code:
mosquitto_sub -h localhost -p 1884 -t 'vessels/self/navigation/speedOverGround'

[/quote]
this is to test MQTT with plugin running without errors?

tnks
Reply
#8
(2018-11-26, 11:43 AM)cepicscepics Wrote: Hi, I'm thinking to build a wifi display capable to show some signalk value (distance to way point, SOG etc. + a 5 min. timer).
I'm thinking to a battery powered esp8266 connected to the openplotter AP, an lcd display and a pushbutton to select the signalk message...

but I really don't know where to start...

every tips will be appreciated.....

http://forum.openmarine.net/showthread.php?tid=1390
DIY repeater, readable from 8m away during day/night: built with OpenPlotter/Node-RED
Reply
#9
TEST UPDATE:

I installed and activated MQTT plugin trying to send simulated signalk values (lat, long and deep)
restarted SK

[Image: GetAttachmentThumbnail?id=AQMkADAwATY3Zm...ation=true]
[Image: GetAttachmentThumbnail?id=AQMkADAwATY3Zm...ation=true]

this is the code in the esp8266: (from here)
Code:
#include <ESP8266WiFi.h>
#include <Wire.h>  // Only needed for Arduino 1.6.5 and earlier
//#include "SSD1306.h" // alias for `#include "SSD1306Wire.h"`
#include <ESP8266mDNS.h>
#include <PubSubClient.h>

////////////////////////wifi///////////////////////
const char* ssid = "MyHomeWiFi";
const char* password = "MyHomeWiFiPassWord";

const char* mqtt_server = "IP assigned to RPI"; // ip


//const char* mqtt_server = "rpi-speak.local";

WiFiClient espClient;
PubSubClient client(espClient);
long lastMsg = 0;
char msg[50];
int value = 0;

//SSD1306  display(0x3c, 4, 5); //d1 mini
//SSD1306 display(0x3c, D1, D2); //ESP8266 w/OLED
//SSD1306 display(0x3c, D2, D1); //NodeMCU

#define D1mini 1 //1 - using D1 mini

void setup() {
 
 Serial.begin(9600);
 setup_wifi();
 client.setServer(mqtt_server, 1883);
 client.setCallback(callback);
//  display.init();

//  display.flipScreenVertically();
//  display.setFont(ArialMT_Plain_10);
   reconnect();
}

void setup_wifi() {

 delay(10);
 // We start by connecting to a WiFi network
 Serial.println();
 Serial.print("Connecting to ");
 Serial.println(ssid);

 WiFi.begin(ssid, password);

 while (WiFi.status() != WL_CONNECTED) {
   delay(500);
   Serial.print(".");
 }
Serial.println("");
 Serial.println("WiFi connected");
 Serial.println("IP address: ");
 Serial.println(WiFi.localIP());
}

void callback(char* topic, byte* payload, unsigned int length) {
 Serial.print("Message arrived [");
 Serial.print(topic);
 Serial.print("] ");
//  display.clear();
 String msg;
 for (int i = 0; i < length; i++) {
   Serial.print((char)payload[i]);
   //display.clear();
   msg += (char)payload[i];
 }
  // display.setTextAlignment(TEXT_ALIGN_LEFT);
//    display.setFont(ArialMT_Plain_10);
   if (D1mini) {
//      display.drawStringMaxWidth(35,13,60,msg); //d1 mini
     } else {
//      display.drawStringMaxWidth(0,0,120,msg); //ESP8266 w/OLED   }
     }
//    display.display();
 
 
 Serial.println();

}

void reconnect() {
 // Loop until we're reconnected
 while (!client.connected()) {
   Serial.print("Attempting MQTT connection...");
   // Attempt to connect
   uint32_t chipid=ESP.getChipId();
   char clientid[25];
   snprintf(clientid,25,"WIFI-Display-%08X",chipid); //this adds the mac address to the client for a unique id
   Serial.print("Client ID: ");
   Serial.println(clientid);
   if (client.connect(clientid)) {
     Serial.println("connected");
     // Once connected, publish an announcement...
     //client.publish("Say", "-t 'hello world'");
     // ... and resubscribe
     client.subscribe("display1");
   } else {
     Serial.print("failed, rc=");
     Serial.print(client.state());
     Serial.println(" try again in 5 seconds");
     // Wait 5 seconds before retrying
     delay(5000);
   }
 }
}

void loop() {

// if (!client.connected()) {
 //  reconnect();
// }
 client.loop();
 
}

the esp connect to my home wifi but the serial monitor say:

Code:
Connecting to MyHomeWiFi
............
WiFi connected
IP address:
***.***.*.**
Attempting MQTT connection...Client ID: WIFI-Display-0029DCD7
failed, rc=5 try again in 5 seconds
Attempting MQTT connection...Client ID: WIFI-Display-0029DCD7
failed, rc=5 try again in 5 seconds
Attempting MQTT connection...Client ID: WIFI-Display-0029DCD7
failed, rc=5 try again in 5 seconds
Attempting MQTT connection...Client ID: WIFI-Display-0029DCD7
failed, rc=5 try again in 5 seconds
Attempting MQTT connection...Client ID: WIFI-Display-0029DCD7
failed, rc=5 try again in 5 seconds
Attempting MQTT connection...Client ID: WIFI-Display-0029DCD7
failed, rc=5 try again in 5 seconds
Attempting MQTT connection...Client ID: WIFI-Display-0029DCD7
failed, rc=5 try again in 5 seconds
Attempting MQTT connection...Client ID: WIFI-Display-0029DCD7

what's missing?

tnks a lot
Reply
#10
(2018-12-09, 01:58 AM)cepicscepics Wrote: the esp connect to my home wifi but the serial monitor say:

Connecting to MyHomeWiFi
............
WiFi connected
IP address:
***.***.*.**
Attempting MQTT connection...Client ID: WIFI-Display-0029DCD7
failed, rc=5 try again in 5 seconds

Did you check what state 5 means? https://pubsubclient.knolleary.net/api.html#state

It is 
Code:
MQTT_CONNECT_UNAUTHORIZED
 - the client was not authorized to connect

First I would try to make sure you can connect to the broker from your computer with for example mosquitto_sub.

I suspect you have OpenPlotter's own Mqtt server configured with a username/password and your client is trying to connect to that.

Try changing the SK mqtt gateway's port something else, like 11883 and adjust your esp code accordingly. There should be also error messages in your RPi's syslog complaining about the gateway's mqtt broker (Mosca) not starting, if there is already the OpenPlotter-managed mqtt broker occupying the port 1883.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)