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
I2C without Connections tab
#1
Hi all, getting somewhere with the Davis windvane. I have it as accurately pointing at the correct numbers. However when reboot the settings aren’t saving as Signal K.

I noticed on an older version of this there was a connections tab but the version i’m using there isn’t.

I tried looking in the Signal K setting and data connections etc but not sure where i should be looking

Any ideas?

    .
Reply
#2
"I noticed on an older version of this there was a settings tab but the version i’m using there isn’t."

The screenshot shows I2C version 4.2.0 and it does have the Settings tab as you can see. Which version are you using that doesn't show the tab?
Reply
#3
Oops my mistake, it’s the connections tab I’m looking for. 

I’ve edited the original post now

W

Oops my mistake, it’s the connections tab I’m looking for. 

I’ve edited the original post now

W
Reply
#4
Ah OK, no problem.

Are you sure you're not getting confused with the Serial app which does have a connections tab? I've just looked at I2C version 3.4.2 and there isn't one there either.

Anyway I think that is a red herring.

What happens when you press the OK button on the Edit ADS1115-A0 panel in your original screenshot?

What should happen (and did until OPpv4 was that the A0 line (top one of the four in the I2C 4.2.0 panel) should turn yellow. You then see the data in signal K.

What happens in OPV4 is that all the lines in the I2C panel (A0-A3) are wiped out, however the data is still available in signal K.

This is a thread https://forum.openmarine.net/showthread....ht=ads1115 which I can see you have contributed to.

If that isn't your problem then it would help if you could describe it more fully, forgetting the "connections" tab thing.
Reply
#5
(2025-01-30, 10:49 AM)baltika_no_9 Wrote: Ah OK, no problem.

Are you sure you're not getting confused with the Serial app which does have a connections tab? I've just looked at I2C version 3.4.2 and there isn't one there either.

Anyway I think that is a red herring.

What happens when you press the OK button on the Edit  ADS1115-A0 panel in your original screenshot?

What should happen (and did until OPpv4 was that the A0 line (top one of the four in the I2C 4.2.0 panel) should turn yellow. You then see the data in signal K.

What happens in OPV4 is that all the lines in the I2C panel (A0-A3) are wiped out, however the data is still available in signal K.

This is a thread  https://forum.openmarine.net/showthread....ht=ads1115 which I can see you have contributed to.

If that isn't your problem then it would help if you could describe it more fully, forgetting the "connections" tab thing.

Hey baltika_no_9 thanks for feedback and questions..

When I click OK, I2C goes blank (nothing red, yellow or green) but the instrument panel shows the wind as expected and SKs show the I2C present as read/write in devices.

The problem comes next time I reboot, it’s not there any more so will be a bit of a pain adding it every time it looses power or . I read on another thread in the bug report with title “editing I2C value clears all sensors”, that when adding the ADS1115 it seems to wipe other I2C sensors.

Love to know what I’m doing wrong, because this comment by another member has urged me to go down another path but stalling on this. This method is using ESP32 Arduino (a Lilygo T3 Lora) sending the data over wifi using websockets but although the arduino reads the sensor and display this as a print out, I’m struggling to get SK to accept the JSON script, token or something else none of which I am even past novice in.

I have time as the boat is on dry land and can always just put up the wind sensor (a Davis vane and anemometer) then play later.

Here’s what I’m using and have wind and temperature working on RPI zero W but outside of SK to check they’re working:
- RPi4
- ST2000 autotiller
- Davis Instrument wind vane/anemometer
 >>>ADC to read vane
- DHT11 temperature & humidity sensor
- L298N motor controller
- GPS module
- MPU 9255 Gyro
Reply
#6
(2025-02-02, 07:05 PM)Ormingtrude Wrote:
(2025-01-30, 10:49 AM)baltika_no_9 Wrote: Ah OK, no problem.

Are you sure you're not getting confused with the Serial app which does have a connections tab? I've just looked at I2C version 3.4.2 and there isn't one there either.

Anyway I think that is a red herring.

What happens when you press the OK button on the Edit  ADS1115-A0 panel in your original screenshot?

What should happen (and did until OPpv4 was that the A0 line (top one of the four in the I2C 4.2.0 panel) should turn yellow. You then see the data in signal K.

What happens in OPV4 is that all the lines in the I2C panel (A0-A3) are wiped out, however the data is still available in signal K.

This is a thread  https://forum.openmarine.net/showthread....ht=ads1115 which I can see you have contributed to.

If that isn't your problem then it would help if you could describe it more fully, forgetting the "connections" tab thing.

Hey baltika_no_9 thanks for feedback and questions..

When I click OK, I2C goes blank (nothing red, yellow or green) but the instrument panel shows the wind as expected and SKs show the I2C present as read/write in devices.

The problem comes next time I reboot, it’s not there any more so will be a bit of a pain adding it every time it looses power or . I read on another thread in the bug report with title “editing I2C value clears all sensors”, that when adding the ADS1115 it seems to wipe other I2C sensors.

Love to know what I’m doing wrong, 

Then your problem is exactly the same as the thread in Bug Reports that I provided the link to and to which you referred. It is as yet unresolved in OPV4. I've not developed a workaround I'm afraid.
Reply
#7
(2025-02-03, 01:33 PM)baltika_no_9 Wrote:
(2025-02-02, 07:05 PM)Ormingtrude Wrote:
(2025-01-30, 10:49 AM)baltika_no_9 Wrote: Ah OK, no problem.

Are you sure you're not getting confused with the Serial app which does have a connections tab? I've just looked at I2C version 3.4.2 and there isn't one there either.

Anyway I think that is a red herring.

What happens when you press the OK button on the Edit  ADS1115-A0 panel in your original screenshot?

What should happen (and did until OPpv4 was that the A0 line (top one of the four in the I2C 4.2.0 panel) should turn yellow. You then see the data in signal K.

What happens in OPV4 is that all the lines in the I2C panel (A0-A3) are wiped out, however the data is still available in signal K.

This is a thread  https://forum.openmarine.net/showthread....ht=ads1115 which I can see you have contributed to.

If that isn't your problem then it would help if you could describe it more fully, forgetting the "connections" tab thing.

Hey baltika_no_9 thanks for feedback and questions..

When I click OK, I2C goes blank (nothing red, yellow or green) but the instrument panel shows the wind as expected and SKs show the I2C present as read/write in devices.

The problem comes next time I reboot, it’s not there any more so will be a bit of a pain adding it every time it looses power or . I read on another thread in the bug report with title “editing I2C value clears all sensors”, that when adding the ADS1115 it seems to wipe other I2C sensors.

Love to know what I’m doing wrong, 

Then your problem is exactly the same as the thread in Bug Reports that I provided the link to and to which you referred. It is as yet unresolved in OPV4. I've not developed a workaround I'm afraid.
Thanks for letting me know.
On the plus side I’m having some success with SensESP but its just the early stages of this. If this works out well I’ll provide details.
Reply
#8
Best of luck!
Reply
#9
(2025-02-04, 02:31 PM)baltika_no_9 Wrote: Best of luck!

Got something working using SensESP good enough for me using snippets from other codes I found mostly using windsens.zip by @MigGat here: https://forum.openmarine.net/showthread....9#pid26499. There's a bit of a gap in mine around 350-2deg zone but I'm ok with that for now.

Here is the Main.cpp for anyone looking in the future or if they want to suggest edits.
Code:
#include <memory>

#include "sensesp.h"
#include "sensesp/sensors/analog_input.h"
#include "sensesp/sensors/digital_input.h"
#include "sensesp/signalk/signalk_output.h"
#include "sensesp/transforms/curveinterpolator.h"
#include "sensesp_app_builder.h"

using namespace sensesp;

// --- Wind Angle related ---
class AngleInterpreter : public CurveInterpolator {
public:
  AngleInterpreter(String config_path = "") : CurveInterpolator(NULL, config_path) {
    clear_samples();
    add_sample(CurveInterpolator::Sample(0.14, 0));
    add_sample(CurveInterpolator::Sample(0.56, 0.785));
    add_sample(CurveInterpolator::Sample(0.85, 1.57));
    add_sample(CurveInterpolator::Sample(1.228, 2.355));
    add_sample(CurveInterpolator::Sample(1.668, 3.14));
    add_sample(CurveInterpolator::Sample(2.15, 3.925));
    add_sample(CurveInterpolator::Sample(2.551, 4.71));
    add_sample(CurveInterpolator::Sample(2.932, 5.495));
    add_sample(CurveInterpolator::Sample(3.15, 6.28));
  }
};

const uint8_t kAnalogInputPin = 36;
std::shared_ptr<AnalogInput> analog_input;
std::shared_ptr<AngleInterpreter> angle_interpreter;
std::shared_ptr<SKOutput<float>> aiv_sk_output; // Angle SK output


// --- Wind Speed related ---
const uint8_t WIND_SPEED_PIN = 25;
unsigned int AWS_READ_DELAY = 1000;
unsigned int AWS_DEBOUNCE_DELAY = 10;
const int SPEED_READ_BUFFER_SIZE = 10;

std::shared_ptr<SKOutput<float>> wind_speed_sk_output; // Speed SK output
int speedReadBuffer[SPEED_READ_BUFFER_SIZE] = {};

float speedAveragedValue(int lastValues[], int size, int newValue) { // Averaging function
  int total = 0;
  for (int i = 0; i < size - 1; i++) {
    lastValues[i] = lastValues[i + 1];
    total += lastValues[i + 1];
  }
  lastValues[size - 1] = newValue;
  total += newValue;
  return (float)total / (float)size;
}

volatile unsigned long pulse_count = 0;
void IRAM_ATTR countPulses() {
  pulse_count++;
}



void setup() {
  SetupLogging(ESP_LOG_DEBUG);

  SensESPAppBuilder builder;
  sensesp_app = (&builder)
              ->set_hostname("my-sensesp-project")
              ->get_app();

  // --- Wind Angle Setup ---
  const unsigned int kAnalogInputReadInterval = 2000;
  const float kAnalogInputScale = 3.3;

  analog_input = std::make_shared<AnalogInput>(
      kAnalogInputPin, kAnalogInputReadInterval, "", kAnalogInputScale);

  angle_interpreter = std::make_shared<AngleInterpreter>("/angle_curve");
  analog_input->connect_to(angle_interpreter);

  auto aiv_metadata = std::make_shared<SKMetadata>("Deg", "Apparent Wind Angle");
  aiv_sk_output = std::make_shared<SKOutput<float>>(
      "environment.wind.angleApparent", "/environment/wind/angleApparent", aiv_metadata);

  ConfigItem(aiv_sk_output)
      ->set_title("Apparent Wind Angle SK Output Path")
      ->set_description("The SK path to publish the apparent wind angle")
      ->set_sort_order(100);

  angle_interpreter->connect_to(aiv_sk_output);


  // --- Wind Speed Setup ---
  pinMode(WIND_SPEED_PIN, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(WIND_SPEED_PIN), countPulses, RISING);

  String wind_speed_sk_path = "environment.wind.speedApparent";
  String wind_speed_sk_path_config_path = "/windSpeedApparent/skKey";
  auto wind_speed_metadata = std::make_shared<SKMetadata>("m/s", "Apparent Wind Speed");
  wind_speed_sk_output = std::make_shared<SKOutput<float>>(
      wind_speed_sk_path, wind_speed_sk_path_config_path, wind_speed_metadata);

  ConfigItem(wind_speed_sk_output)
      ->set_title("Apparent Wind Speed")
      ->set_description("Apparent wind speed in meters per second")
      ->set_sort_order(200);

  for (int i = 0; i < SPEED_READ_BUFFER_SIZE; i++) {
    speedReadBuffer[i] = 0;
  }

  sensesp_app->start();
}

void loop() {
  event_loop()->tick();

  // --- Wind Angle Loop ---
  int raw_adc = analogRead(kAnalogInputPin);
  float interpreted_angle = angle_interpreter->get();
  Serial.print("Raw ADC: "); Serial.print(raw_adc);
  Serial.print(", Interpreted Angle: "); Serial.println(interpreted_angle);

  // --- Wind Speed Loop ---
  static unsigned long previous_time = millis();
  unsigned long current_time = millis();
  unsigned long time_elapsed = current_time - previous_time;

  if (time_elapsed >= AWS_READ_DELAY) {
    noInterrupts();
    unsigned int current_pulse_count = pulse_count;
    pulse_count = 0;
    interrupts();

    float mph = current_pulse_count * (2.25f / (AWS_READ_DELAY / 1000.0f));
    float m_s = mph * 0.44704f;

    float averaged_speed = speedAveragedValue(speedReadBuffer, SPEED_READ_BUFFER_SIZE, m_s);

    wind_speed_sk_output->set(averaged_speed);
    debugD("Wind Speed: %f m/s", averaged_speed);

    previous_time = current_time;
  }
}
Reply
#10
(2025-01-24, 02:06 AM)Ormingtrude Wrote: Hi all, getting somewhere with the Davis windvane. I have it as accurately pointing at the correct numbers. However when reboot the settings aren’t saving as Signal K.

I noticed on an older version of this there was a connections tab but the version i’m using there isn’t.

I tried looking in the Signal K setting and data connections etc but not sure where i should be looking

Any ideas?

.

Hello Ormingtrude,


Did you found a solution? I'm having exactly the same problem.

Regards
Marioi
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)