OpenMarine
arduino on I2C - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: General discussion (https://forum.openmarine.net/forumdisplay.php?fid=2)
+--- Thread: arduino on I2C (/showthread.php?tid=840)

Pages: 1 2 3


RE: arduino on I2C - Sprokkie - 2017-11-26

Some new problems Sad
Openplotter doesn not see the arduino in the serial ports.
i installed the arduino ide on the raspberry, but no ports in usb manager

i tried a mega, a teensy a due and an uno.

any thougths ?


RE: arduino on I2C - e-sailing - 2017-11-28

(2017-11-26, 08:37 PM)Sprokkie Wrote: Some new problems Sad
Openplotter doesn not see the arduino in the serial ports.
i installed the arduino ide on the raspberry, but no ports in usb manager

i tried a mega, a teensy a due and an uno.

any thougths ?
Arduino ide does find the ports?


RE: arduino on I2C - Sprokkie - 2017-11-29

(2017-11-28, 11:28 PM)e-sailing Wrote:
(2017-11-26, 08:37 PM)Sprokkie Wrote: Some new problems Sad
Openplotter doesn not see the arduino in the serial ports.
i installed the arduino ide on the raspberry, but no ports in usb manager

i tried a mega, a teensy a due and an uno.

any thougths ?
Arduino ide does find the ports?
how do i check that or better fix that ?


RE: arduino on I2C - e-sailing - 2017-11-29

(2017-11-29, 12:09 AM)Sprokkie Wrote:
(2017-11-28, 11:28 PM)e-sailing Wrote: Arduino ide does find the ports?
how do i check that or better fix that ?

There is nothing to fix.

Open the arduino ide
TOOLS->Serial Ports. There are the serial ports you have.
Another option is to use the Terminal
ls /dev/tty*
add or disconnect the arduino and see what changed
ls /dev/tty*

Why it is better to use the usb-manager for openplotter look at:
https://sailoog.gitbooks.io/openplotter-documentation/content/en/usb-manager.html


RE: arduino on I2C - insitegeo - 2018-05-21

[quote pid='3517' dateline='1509705309']


u r trying to recreate MPGuino

just reuse proven code with years behind it and many member coders




[Image: n63uskc.png]

Something else worth considering is the ESP32 or ESP8266 and pass the data over wifi. I haven't got a ESP32 to play with yet but the ESP8266 works OK over wifi. Programmed just like an Arduino. This sketch connects to the AIS nmea output of a GX2100 radio and sends the data to openplotter.
The ESP32 looks even more powerful. 
Also, adding a ADS1115 board to Openplotter means you can measure battery voltage so you can keep and eye if all this stuff is draining your bank too much Cool 

You'll need a serial to TTL convertor to get NMEA into an arduino or ESP, cheap on ebay.
Code:
/**  This sketch sends broadcast udp message.
*
*
*/




#include <SoftwareSerial.h>
#include <ESP8266WiFi.h>
#include <WiFiUDP.h>
#include <PubSubClient.h>    // mqtt library


#define mqtt_server "10.10.10.1"
#define mqtt_user "User"
#define mqtt_password "Password"
const char* ssid     = "OpenPlotter";
const char* password = "password";
//const char* ssid     = "*****";
//const char* password = "*******";


IPAddress ipBroadCast(10, 10, 10, 255);
unsigned int udpRemotePort=10112;
unsigned int udplocalPort=2390;
const int UDP_PACKET_SIZE = 70;
char udpBuffer[ UDP_PACKET_SIZE];


String  inData;


WiFiUDP udp;
WiFiClient espClient;
PubSubClient client(espClient);
SoftwareSerial mySerial(14, 12);


void callback(char* topic, byte* payload, unsigned int length) {
Serial.print("Message arrived [");
Serial.print(topic);
Serial.print("] ");
for (int i=0;i<length;i++) {
 char receivedChar = (char)payload[i];
 Serial.print(receivedChar);
 }
 Serial.println();
}


void reconnect() {
 // Loop until we're reconnected
 while (!client.connected()) {
   Serial.print("Attempting MQTT connection...");
   // Attempt to connect
   // If you do not want to use a username and password, change next line to
   // if (client.connect("ESP8266Client")) {
   if (client.connect("ESP8266Client", mqtt_user, mqtt_password)) {
     Serial.println("connected");
     client.subscribe("myfirstin");
   } else {
     Serial.print("failed, rc=");
     Serial.print(client.state());
     Serial.println(" try again in 5 seconds");
     // Wait 5 seconds before retrying
     delay(5000);
   }
 }
}




//================================================================
// Setup hardware, serial port, and connect to wifi.
//================================================================

void setup() {
 Serial.begin(115200);
 mySerial.begin(4800);
 delay(10);
 // We start by connecting to a WiFi network
 Serial.println();
 Serial.println();
 Serial.print("Connecting to ");
 Serial.println(ssid);

 //  Try to connect to wifi access point
 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());
 Serial.println("Starting UDP");

 // set udp port for listen
 udp.begin(udplocalPort);
 Serial.print("Local port: ");
 Serial.println(udp.localPort());


 client.setServer(mqtt_server, 1883);  //start mqtt
 client.setCallback(callback);  // set callback routine to monitor incoming mqtt
 client.subscribe("myfirst");


 
}
//================================================================
// Function to send udp message
//================================================================
void fncUdpSend(String inData)
{
 char temp[50];
 inData.toCharArray(temp, 50) ;
 udp.beginPacket(ipBroadCast, udpRemotePort);
 udp.write(temp, sizeof(temp));
 udp.endPacket();
 Serial.print("sent - ");
 Serial.println(inData);
 }


 
//================================================================
// LOOP MAIN
//================================================================
void loop() {
 
while (mySerial.available() > 0)   {
       char recieved = mySerial.read();
       inData+= recieved;
 
       // Process message when new line character is recieved
       if (recieved == '\n')
       {
           Serial.print("Arduino Received: ");
           Serial.print(inData);


           fncUdpSend(inData);


           char temp[50];
           inData.toCharArray(temp, 50) ;
           client.publish("myfirstout", temp);
           inData = ""; // Clear recieved buffer          
       }
   }
 // if (!client.connected()) {
 //  reconnect();
 //}
//client.loop();
}

[/quote]


RE: arduino on I2C - adriancubs - 2018-06-13

(2017-11-26, 08:37 PM)Sprokkie Wrote: Some new problems Sad
Openplotter doesn not see the arduino in the serial ports.
i installed the arduino ide on the raspberry, but no ports in usb manager

i tried a mega, a teensy a due and an uno.

any thougths ?

Any news? I was planning to have an Arduino Mega connected to the Raspberry via Serial (USB) as well.

Could you connect at the end?


RE: arduino on I2C - PaddyB - 2018-06-13

(2018-06-13, 05:26 AM)adriancubs Wrote:
(2017-11-26, 08:37 PM)Sprokkie Wrote: Some new problems Sad
Openplotter doesn not see the arduino in the serial ports.
i installed the arduino ide on the raspberry, but no ports in usb manager

i tried a mega, a teensy a due and an uno.

any thougths ?

Any news? I was planning to have an Arduino Mega connected to the Raspberry via Serial (USB) as well.

Could you connect at the end?

I just tried an ESP8266 and arduino nano connected with USB cable - both showed up in the serial tab straight away.


RE: arduino on I2C - jim321 - 2018-06-13

i just installed two arduinos USB one nano with pypilot motor sketch the other is a mega firmata standard.
both work ,but if i choose the mega in op's serial tab give it the name "FIRM" in node-red the gpio node screws up N-R.freezes.
without it in op serial and node-red runs smooth.
it seems to keep the same serial ttyACM0 after several reboots

i guess they don't like to share