Dear people, i urgently need your help. For my bachelor thesis I build 4 measuring sensors VL53l0x with long cables (each sensor 2 meters) and an acceleration sensor ADXL335. The problem is, the acceleration sensor works very well on its own, but together with the other sensors the measured values get smaller. I think it’s because of resistance from the cables and sensors. The other problem was that I wanted to use a Klamen filter but unfortunately I couldn’t. I will be very grateful if you could help me.
i did not buy the sensors from pololu.
With best regards
code:
//VL53L0x Multi sensor
//Camila Colussi 2020
//Arduino Uno + 4 VL53L0x sensors
//Use SerialMonitor to see the measurements
// reference: https://arduinoproyek.wordpress.com/2019/03/27/vl53l0x-multi-sensor/
#include <Wire.h>
#include <MPU6050_tockn.h>
#include <VL53L0X.h>
MPU6050 mpu6050(Wire);
VL53L0X sensor1;
VL53L0X sensor2;
VL53L0X sensor3;
VL53L0X sensor4;
const int sensor_x_pin = A0;
const int sensor_y_pin = A1;
int sensor_x_value;
int sensor_y_value;
String Plotter = "";
int a;
int b;
int c;
int d;
void setup()
{
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
pinMode(4, OUTPUT);
digitalWrite(7, LOW);
digitalWrite(6, LOW);
digitalWrite(5, LOW);
digitalWrite(4, LOW);
delay(10);
Wire.begin();
Serial.begin (9600);
//sensor1
digitalWrite(7, HIGH);
delay(10);
sensor1.init(true);
delay(10);
sensor1.setAddress((uint8_t)01);
//sensor2
digitalWrite(6, HIGH);
delay(10);
sensor2.init(true);
delay(10);
sensor2.setAddress((uint8_t)02);
//sensor3
digitalWrite(5, HIGH);
delay(10);
sensor3.init(true);
delay(10);
sensor3.setAddress((uint8_t)03);
//sensor4
digitalWrite(4, HIGH);
delay(10);
sensor4.init(true);
delay(10);
sensor4.setAddress((uint8_t)04);
//continuous
sensor1.startContinuous();
sensor2.startContinuous();
sensor3.startContinuous();
sensor4.startContinuous();
mpu6050.begin();
mpu6050.calcGyroOffsets(true);
}
void loop()
{
a = sensor1.readRangeContinuousMillimeters()-25;
b = sensor2.readRangeContinuousMillimeters()-40;
c = sensor3.readRangeContinuousMillimeters();
d = sensor4.readRangeContinuousMillimeters()-5;
Serial.println(" ");
Serial.print(a);
Serial.print(" ");
Serial.print(b);
Serial.print(" ");
Serial.print(c);
Serial.print(" ");
Serial.print(d);
Serial.print(" ");
sensor_x_value = analogRead(sensor_x_pin) ;
sensor_x_value = map (sensor_x_value,355,285,0,90);
sensor_y_value = analogRead(sensor_y_pin) ;
sensor_y_value = map (sensor_y_value,355,285,0,90);
Plotter = (String(sensor_x_value) + "," + String(sensor_y_value));
Serial.println(Plotter);
delay(10);
}