jvoermans / Vibration_Logger

Logger to measure sea ice vibrations
3 stars 1 forks source link

add sensors #13

Open jerabaul29 opened 4 years ago

jerabaul29 commented 4 years ago

@jerabaul29 add an explanation / example about how to add sensors.

jvoermans commented 4 years ago

@jerabaul29 There are two options to include the other environmental sensors. 1) simultaneous recording with the 1000Hz recordings 2) separate from the 1000Hz recording

The first will be difficult, as the I2C sensors take quite a bit of time to be read. I think the maximum speed of reading is about 40 ms. So in that time, I don't think you can actually record the other sensors I guess as the Arduino will be busy?

Alternatively, after each 15 min records of the vibration signals, the sensors get 1 minute to get as many samples as possible, take the average and write it to a file.

I was thinking of adding the exact same to the "LoggerWavesInIce_InSituWithIridium". So first it logs the IMU, after IMU it records for a minute or two the environ. sensors. Then sends the GPS + environ.sensor data through Iridium and continues as normal.

What do you think?

Considering the following probes: Wind anemometer (analog) Temperature 1-3 units (I2C) Pressure (I2C) Sonar (I2C) Only wind might need more than 1 minute to get a good average reading. For the vibration logger, it can be recorded simultaneously with the geophone.

jerabaul29 commented 4 years ago

I think it may / should work with simultaneous logging, because the ADC logging is interrupt based, so it will happen in the background even if the board is busy with something else, that's the beauty of interrupt based actions :) .

For each of your external sensors, can you provide a link to the GitHub repo or other explaining how to use it?

jerabaul29 commented 4 years ago

So regarding these additional sensors:

jvoermans commented 4 years ago

Pressure: https://bluerobotics.com/store/sensors-sonars-cameras/sensors/bar02-sensor-r1-rp/ https://github.com/bluerobotics/BlueRobotics_MS5837_Library

Temperature: https://bluerobotics.com/store/sensors-sonars-cameras/sensors/celsius-sensor-r1/ https://github.com/bluerobotics/BlueRobotics_TSYS01_Library

Sonar: https://bluerobotics.com/store/sensors-sonars-cameras/sonar/ping-sonar-r2-rp/ https://github.com/bluerobotics/ping-arduino

I have a Sonar sensor here, but haven't had time yet to test it yet due to covid. Given that the temperature probes have the same address, I used this one:

https://learn.adafruit.com/adafruit-tca9548a-1-to-8-i2c-multiplexer-breakout

jerabaul29 commented 4 years ago

Great, I will write some software for all of these in the days to come then :) . Do you have some working arduino sketches where you already use these / could you upload it on the repo?

Btw, the sonar looks really nice. Do you think it may be possible to measure ice thickness using it? Do you have any more information about that? Or do you plan for another use? :)

jvoermans commented 4 years ago

I do. It is functional, but looks pretty inefficient. GPS_ArduinoDue_parsing_v6/GPS_ArduinoDue_parsing_v6.ino

I had to re-initialize the sensors in the loop, otherwise I was getting very weird values when using the GPS breakout. I tried to reset the TCA9548A instead but that didn't help.

That is the aim of sonar, but have only been able to try in air (couldn't find the speed of sound setting). It started drifting like crazy when placed under a small angle. Maybe it won't do that in water but have to check that.

jerabaul29 commented 4 years ago

Ok, sounds good! I do not have all the hardware, so may be a bit back and forth getting it to work with code development from my side and test from yours :) .

jerabaul29 commented 4 years ago

Btw, so fun that you choose some equipment from BlueRobotics. We have a ROV from them and we are very happy with it :) We use it to take PIV pictures under the ice to evaluate turbulence. That's still challenging though ^^ .

jvoermans commented 4 years ago

That is impressive, in the field? PIV/PTV is already complex in the laboratory. I've wanted to do the same in the field, but there is no ice around Australia unfortunately ;) ADV's already have difficulties in measuring under the ice due to a lack of particles so PIV must be worse, although you could attempt to inject tiny air bubbles near the measurement window.

I've picked BlueRobotics as they are reasonably cheap, provide good specifications and perhaps most important is that they are waterproof :)

jerabaul29 commented 4 years ago

This is exactly what we have been doing: we use a compressor to generate the bubbles. There are challenges, but we got some images a few months ago. :)

Yes.

Btw, which sensors are having the same address and conflicting? Or do you want to have several temperature sensors in use?

jvoermans commented 4 years ago

Yes, multiple temperature sensors :)

jerabaul29 commented 4 years ago

Ok :) How do you want to read them? One after the other / all at the same time / other?

jerabaul29 commented 4 years ago

And how many temperature sensors do you want to use?

jvoermans commented 4 years ago

What is easiest is good enough. Just need to get an average reading over a given period of time. If it can run simultaneously with vibration measurements, then an average over 15 minutes would be great. Generally one reading a second is already more than enough as we can't use these sensors to measure small scale turbulence anyway...

I was thinking of 3 temperature sensors, but can be 4 as well (I won't be giving every instrument that many sensors though). Two in the air, one in the ice, the other underwater. The length of the I2C wires might be an issue for the water measurements though if the ice thickness is large. I still need to find a good way to protect the air measurements from solar radiation. Given the price, perhaps it is more accurate to just have two probes stuck out of the side of the Pelican case and orientate it in such a way one is always in the shadow. Anyway, those are different types of issues :)

jerabaul29 commented 4 years ago

The temperature sensors should be part of the CHR data now.

I will add pressure / sonar. How many pressure sensors do you plan on adding?

jvoermans commented 4 years ago

CHR data? Btw, how are they connected or did you describe that already somewhere?

One pressure sensor should be enough :)

jerabaul29 commented 4 years ago

CHR = the char data. I.e. this part of the data in the output of the python parser:

https://github.com/jvoermans/Vibration_Logger/blob/c35d6c199e359fc67f17bbc6ea438b2aca2c23ae/material_Jean/BinarySdDataParser/script_perform_parsing.py#L55-L57

jvoermans commented 4 years ago

I just tested the sonar, which works well. Have to ask the BlueRobotics techs for more info how it works exactly.

This one works on serial: https://github.com/bluerobotics/ping-arduino

I used the following sketch to get correct output, only tried it on the mega (didn't bring a due) at 3.3V input voltage:

#include "ping1d.h"

static const uint8_t arduinoRxPin = 19; //Serial1 rx
static const uint8_t arduinoTxPin = 18; //Serial1 tx

static Ping1D ping { Serial1 };

static const uint8_t ledPin = 13;

void setup()
{
  Serial1.begin(9600);
  Serial.begin(115200);
  pinMode(ledPin, OUTPUT);
  Serial.println("Blue Robotics ping1d-simple.ino");
  while (!ping.initialize()) {
    Serial.println("\nPing device failed to initialize!");
    Serial.println("Are the Ping rx/tx wired correctly?");
    Serial.print("Ping rx is the green wire, and should be connected to Arduino pin ");
    Serial.print(arduinoTxPin);
    Serial.println(" (Arduino tx)");
    Serial.print("Ping tx is the white wire, and should be connected to Arduino pin ");
    Serial.print(arduinoRxPin);
    Serial.println(" (Arduino rx)");
    delay(2000);
  }
  ping.set_speed_of_sound(1500000);
}

void loop()
{
  if (ping.update()) {
    Serial.print("Distance: ");
    Serial.print(ping.distance());
    Serial.print("\tConfidence: ");
    Serial.println(ping.confidence());
  } else {
    Serial.println("No update received!");
  }

  // Toggle the LED to show that the program is running
  digitalWrite(ledPin, !digitalRead(ledPin));
}

It consumes quite a bit of power though. Any way to turn it on and off? If so, probably get an average over say few seconds, all data with 'confidence' below 85-90 can be discarded.