Open pkdjsolo opened 3 years ago
With simple search "Wind" on N2kMessages.h you will find:
//*****************************************************************************
// Wind Speed
// Input:
// - SID Sequence ID. If your device is e.g. boat speed and wind at same time, you can set same SID for different messages
// to indicate that they are measured at same time.
// - WindSpeed Measured wind speed in m/s
// - WindAngle Measured wind angle in radians. If you have value in degrees, use function DegToRad(myval) in call.
// - WindReference Wind reference, see definition of tN2kWindReference
// Output:
// - N2kMsg NMEA2000 message ready to be send.
void SetN2kPGN130306(tN2kMsg &N2kMsg, unsigned char SID, double WindSpeed, double WindAngle, tN2kWindReference WindReference);
inline void SetN2kWindSpeed(tN2kMsg &N2kMsg, unsigned char SID, double WindSpeed, double WindAngle, tN2kWindReference WindReference) {
SetN2kPGN130306(N2kMsg,SID,WindSpeed,WindAngle,WindReference);
}
bool ParseN2kPGN130306(const tN2kMsg &N2kMsg, unsigned char &SID, double &WindSpeed, double &WindAngle, tN2kWindReference &WindReference);
inline bool ParseN2kWindSpeed(const tN2kMsg &N2kMsg, unsigned char &SID, double &WindSpeed, double &WindAngle, tN2kWindReference &WindReference) {
return ParseN2kPGN130306(N2kMsg,SID,WindSpeed,WindAngle,WindReference);
}
Then you just handle read values as you like. E.G. Serial.print(msToKnots(WindSpeed)); Serial.print(" kn"); Serial.print(RadToDeg(WindAngle)); Serial.print(" deg");
Fantastic. Thank you for such a quick response. Just waiting for a can bus interface module and an Arduino Mega to arrive and will give it a go.
Thank you
Paul
Sent from my iPhone
On 31 Aug 2021, at 05:08, Timo Lappalainen @.***> wrote:
With simple search "Wind" on N2kMessages.h you will find:
//***** // Wind Speed // Input: // - SID Sequence ID. If your device is e.g. boat speed and wind at same time, you can set same SID for different messages // to indicate that they are measured at same time. // - WindSpeed Measured wind speed in m/s // - WindAngle Measured wind angle in radians. If you have value in degrees, use function DegToRad(myval) in call. // - WindReference Wind reference, see definition of tN2kWindReference // Output: // - N2kMsg NMEA2000 message ready to be send. void SetN2kPGN130306(tN2kMsg &N2kMsg, unsigned char SID, double WindSpeed, double WindAngle, tN2kWindReference WindReference);
inline void SetN2kWindSpeed(tN2kMsg &N2kMsg, unsigned char SID, double WindSpeed, double WindAngle, tN2kWindReference WindReference) { SetN2kPGN130306(N2kMsg,SID,WindSpeed,WindAngle,WindReference); }
bool ParseN2kPGN130306(const tN2kMsg &N2kMsg, unsigned char &SID, double &WindSpeed, double &WindAngle, tN2kWindReference &WindReference);
inline bool ParseN2kWindSpeed(const tN2kMsg &N2kMsg, unsigned char &SID, double &WindSpeed, double &WindAngle, tN2kWindReference &WindReference) { return ParseN2kPGN130306(N2kMsg,SID,WindSpeed,WindAngle,WindReference); }
Then you just handle read values as you like. E.G. Serial.print(msToKnots(WindSpeed)); Serial.print(" kn"); Serial.print(RadToDeg(WindAngle)); Serial.print(" deg");
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
OK.
At what point in documents or anywhere I should add that I prefer to use either Teensy 3.2 and up or ESP32 boards? Arduino Mega can just handle small projects. Arduino DUE is better. Both anyway are slower, has less memory and eats more power than Teensy or ESP32.
Your documentation is spot on regards preferred boards. Was going to use Mega as I have used before but will use DUE instead.
Its my lack of reading your documentation that was the problem not your documentation.
Really appreciate your help and super fast responses.
Regards
Paul
Sent from my iPhone
On 31 Aug 2021, at 08:45, Timo Lappalainen @.***> wrote:
OK.
At what point in documents or anywhere I should add that I prefer to use either Teensy 3.2 and up or ESP32 boards? Arduino Mega can just handle small projects. Arduino DUE is better. Both anyway are slower, has less memory and eats more power than Teensy or ESP32.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
As I said I prefer to use Teensy 3.2 ... 4.1 or ESP32. Teensy 3.2 is smaller sized and faster than DUE. You just need MCP2562 or ISO1050 can tranceiver.
Many thanks, will look at teensy 3.2 or esp32
Thanks
Paul
Sent from my iPhone
On 31 Aug 2021, at 12:33, Timo Lappalainen @.***> wrote:
As I said I prefer to use Teensy 3.2 ... 4.1 or ESP32. Teensy 3.2 is smaller sized and faster than DUE. You just need MCP2562 or ISO1050 can tranceiver.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
This is easy, but very expensive: https://copperhilltech.com/teensy-3-2-with-can-bus-breakout-board/
Also note that if you do not use isolated tranceiver, you need to have your board near of NMEA2000 power feed to avoid ground loops.
Thank you again, your support is fantastic. ESP32 ordered. Will let you know how I get on.
Paul
Sent from my iPhone
On 31 Aug 2021, at 13:51, Timo Lappalainen @.***> wrote:
This is easy, but very expensive: https://copperhilltech.com/teensy-3-2-with-can-bus-breakout-board/
Also note that if you do not use isolated tranceiver, you need to have your board near of NMEA2000 power feed to avoid ground loops.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
Hi Again,
I am using a Arduino Due and MCP2562 transceiver and have got the actisense and display examples working but am struggling to display wind data despite the information you have previously provided due to my lack of Arduino programming skills.
Could you explain how to modify the data display example to include wind speed/direction. I've tried modifying but just get zero readings for speed and direction. I have my anemometer connected to an NMEA 2000 backbone with a plotter which is displaying the wind information so I know the anemomneter is working OK.
Really appreciate your help
Paul
You write your listener function similar as WaterDepth
void WindSpeed(const tN2kMsg &N2kMsg) {
unsigned char SID;
double WindSpeed;
double WindAngle;
tN2kWindReference WindReference;
if (ParseN2kWindSpeed(N2kMsg,SID,WindSpeed,WindAngle,WindReference) ) {
Serial.print("Wind speed: ");
Serial.print(WindSpeed);
Serial.print("m/s, angle: ");
Serial.print(RadToDeg(WindAngle));
Serial.print(" deg, reference: ");
Serial.println(uint8_t(WindReference));
}
}
Then modify:
void WindSpeed(const tN2kMsg &N2kMsg);
tNMEA2000Handler NMEA2000Handlers[]={
{130306L,&WindSpeed},
{128267L,&WaterDepth},
{0,0}
};
Timo you are a star.
Thankyou so much for your help.
Your support is fantastic in terms of content and speed of response. Have used the modifications you kindly provided and have exactly the output I required and can now progress with my project.
Many many thanks
Paul
Hello,
I try to follow the immense work you continue to do by expanding your system and also supporting all it-fumblers such as myself. The post below reminds me of an aborted effort I ventured into some time ago: The NMEA2000 rules do not allow devises to transmit their info on true wind speed&angle. It wants each device to calculate this based on info on apparent measures of wind and water speed. Calculating true wind can be done both roughly using the basic date and more refined by also taking into consideration info such boat heel and deviation. Have you ventured into this type of calculations? Github has several offerings, by laziness dictates me to ask you before I get back into the coding. Best regards, Jorgen Christensen, Denmark.
-----Original Message----- From: Timo Lappalainen @.> Sent: Wednesday, September 22, 2021 6:26 PM To: ttlappalainen/NMEA2000 @.> Cc: Subscribed @.***> Subject: Re: [ttlappalainen/NMEA2000] Wind Data (#233)
You write your listener function similar as WaterDepth
void WindSpeed(const tN2kMsg &N2kMsg) { unsigned char SID; double WindSpeed; double WindAngle; tN2kWindReference WindReference;
if (ParseN2kWindSpeed(N2kMsg,SID,WindSpeed,WindAngle,WindReference) ) {
Serial.print("Wind speed: ");
Serial.print(WindSpeed);
Serial.print("m/s, angle: ");
Serial.print(RadToDeg(WindAngle));
Serial.print(" deg, reference: ");
Serial.println(uint8_t(WindReference));
}
}
Then modify:
void WindSpeed(const tN2kMsg &N2kMsg);
tNMEA2000Handler NMEA2000Handlers[]={ {130306L,&WindSpeed}, {128267L,&WaterDepth}, {0,0} };
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fttlappalainen%2FNMEA2000%2Fissues%2F233%23issuecomment-925087827&data=04%7C01%7C%7Cfb67fd62f3e74ce8d1b108d97de59c92%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637679247387914413%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=24umDNIRGDiXMzIe9Pvw9zY8%2Fb4XigHLixaJAkio1vE%3D&reserved=0 , or unsubscribe https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FACOHSAD5422XTDP73FNB6SDUDH7QDANCNFSM5DCXLFXA&data=04%7C01%7C%7Cfb67fd62f3e74ce8d1b108d97de59c92%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637679247387914413%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8vrdB31Tqnfa%2FuMGCHxJH88OK2n4bc%2FpbkVH1uXnDV8%3D&reserved=0 . Triage notifications on the go with GitHub Mobile for iOS https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7C%7Cfb67fd62f3e74ce8d1b108d97de59c92%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637679247387924407%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=q4QLo1OnVI4UGQu7jxGMsQnAQ93TKnBcWsqmuwu9WaY%3D&reserved=0 or Android https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7C%7Cfb67fd62f3e74ce8d1b108d97de59c92%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637679247387934399%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4MFIFtf25ManlHqHRrctKTG9Fyyplhq7J0mx0PyFyMo%3D&reserved=0 . https://github.com/notifications/beacon/ACOHSAB7GQJ63MTN73X7IK3UDH7QDA5CNFSM5DCXLFXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG4R3QUY.gif
Never seen that rule. Where it has been defined? If I have device measuring apparent wind and either using data from bus or having itself necessary data, why it could not send information to the bus as calculated. Sounds like NMEA2000 logic to have setting to provide true wind and then not allow to use it. I wonder why, but not the only stupid definition on N2k.
Calculation is simple vector calculation and I do it on NMEA Simulator (without heel), where I then provide true wind information to the bus. Maybe should remove that.
Hi I am working on communication with anenometer sensor and NucleoBoard H743ZI2 , this communication with NMEA2000 , I just wanna read the wind data(direction,speed) from the anenometer sensor and i read this data with NucleoBoard , I am coding with mbed studio OS ,so i wanna know if i need NMEA2000_CAN.h librairy ,or how can I modify it in this case ? Thank you
I ca not answer for that without fully investigating your board and I do not have time for that. The board seem to contain internal CAN controller. If you are using MBED, it may be supported by MBED driver https://github.com/thomasonw/NMEA2000_mbed. Module NMEA2000_CAN.h idea is to automatically select driver depending of processor or environment. It simply include necessary libraries and is easy way for beginners with commonly supported CAN controllers. MBED is listed as supported, but if you read thomasonw comment about MBED you find that it may not work.
I have never tested MBED and I think thomasonw gave up, since there was no support or interest from MBED side to fix MBED CAN drivers.
In generally there are different ways to select driver:
#include <NMEA2000_CAN.h>
Note that there may be extra settings needed like SPI_CS wire for mcp_can etc.#define USE_N2K_CAN 6 // for use with MBED (ARM) systems
#include <NMEA2000_CAN.h>
#include <N2kMsg.h>
#include <NMEA2000.h>
#include <NMEA2000_mbed.h> // https://github.com/thomasonw/NMEA2000_mbed
tNMEA2000 &NMEA2000=*(new tNMEA2000_mbed());
tmbedStream serStream;
Hi,
Can the library be used to convert NMEA 2000 wind data to clear text?
Is the wind data PGN already in the list?
Thanks
Paul