Voltage sensor grounding Problem

Hello every one
BTS7960 driver is an H-bridge converter, driven by arduino uno, which is used to control the speed and direction of rotation of a dc-motor.
The GND of the arduino is connected to the GND of the power source of the bTS7960 driver (12volts).
The installation works perfectly. Except that if I want to measure the output voltage of the BTS7960 driver, by a B25 voltage sensor, I connect the GND of the sensor to the GND of the arduino as indicated in the sensor manual. Doinf so, the motor operating is disturbed, it cannot change direction. It keeps the same direction of rotation.
Is there any solution for connecting the sensor GND?

Please post a link to the product page or data sheet of the "B25 voltage sensor".

What do you expect to learn by reading the output voltage of the motor driver? The driver is essentially a switch, connecting the motor terminals to the motor power supply (in either orientation), or disconnecting the motor.

Thank you for your response
In fact, I want to use the driver as a H-bridge inverter, and to apply PWM control on it. so i need to visualize the output voltage of the H-bridge.

This is a link to B25 voltage sensor

Use your oscilloscope to visualize the output of the H-bridge.

Whatever method you use, it must be isolated from the Arduino ground, and referenced to the motor power supply ground.

The B25 "voltage sensor" is just a resistive voltage divider, and useless for this task.

Try to understand what PWM is.

With PWM, the motor either gets full supply voltage or no supply voltage.
Switched between those two states in a rapid succesion.

The Arduino generates that PWM signal, so you already know "the average voltage".
Not sure what you want to do with it though.
Motor current could be more informative.
Leo..

When you use an H Bridge to reverse motor rotational direction you are reversing the polarity of the motor. The Arduino is designed for a single ended input on analog in. You want to get to a differential input scheme. You can look at something like an ASD1115 module which will give you two differential inputs. Just make sure you divide the input voltage down. Read about the ADS1115 before you use it. There are also endless links out there for using it with Arduino.

Your B25 is a voltage divider with a common ground. That will not work if you look at the data sheet.

INPUTS

  • GND – This is where you connect the low side of the voltage you are measuring. Caution! : This is the same electrical point as your Arduino ground.
    VCC: The is where you connect the high side of the voltage you are measuring

OUTPUTS

S: This connects to your Arduino analog input.
– (or minus):** This connects to your Arduino ground.

  • This is not connected. It does absolutely nothing… zilch… nada… jack diddly doo doo.

This explains voltage division for a differential input. It's a TI paper and you would adjust the resistor values for your motor voltage. Shown is a 2:1 divider. You want a 3:1 divider. Applying a voltage which is negative with respect to ground to your Arduino analog inputs will result in bad things happening.

Ron

Ron

1 Like

A H-bridge reverses motor polarity, but not polarity with respect to Arduino ground.
You can use two Arduino inputs to measure motor voltage,
if... it would be a varying voltage, which PWM is not.

As said, if you drive the motor with a PWM signal from the Arduino,
then you already know what the average "voltage" will be n/256 of the supply.
What the motor does with it is another story.
Leo..

The voltages on the ADS1115 inputs must be between 0 and ADS1115 Vcc at all times, or it will instantly be destroyed.

Differential mode computes the difference between two positive voltages.

OK, I have read that several times over here. Then explain this to me. Using this code and the ADS 1115 powered by 5 volts off the Arduino Uno.

The Code I use for Diff Mode and default gain:

#include <Wire.h>
#include <Adafruit_ADS1015.h>
#include <LiquidCrystal_I2C.h>

Adafruit_ADS1115 ads;                // Declare an instance of the ADS1115
LiquidCrystal_I2C lcd(0x27, 20, 4);  // set the LCD address to 0x27 for a 20 chars and 4 line display


int16_t rawADCvalue1;  // The is where we store the value we receive from the ADS1115
int16_t rawADCvalue2;
float scalefactor = 0.1875F;  // This is the scale factor for the default +/- 6.144 Volt Range we will use
float volts1 = 0.0;           // The result of applying the scale factor to the raw value
float volts2 = 0.0;


void setup(void)

{
  Serial.begin(9600);

  ads.begin();

  // Initialize LCD screen
  lcd.init();  // initialize the lcd
  lcd.init();
  lcd.backlight();
}

void loop(void) {
  rawADCvalue1 = ads.readADC_Differential_0_1();
  rawADCvalue2 = ads.readADC_Differential_2_3();
  volts1 = (rawADCvalue1 * scalefactor) / 1000.0;
  volts2 = (rawADCvalue2 * scalefactor) / 1000.0;

  //Serial Print Data
  Serial.print("Channel 1 =  ");
  Serial.println((volts1), 3);
  Serial.print("");
  Serial.println(" Volts");
  Serial.print("Channel 2 =  ");
  Serial.println((volts2), 3);
  Serial.println(" Volts");
  Serial.println();

  // LCD Data
  lcd.clear();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Channel 1 = ");
  lcd.print((volts1), 3);  // Using 3:1 Voltage Divider so volts1 * 3
  lcd.print(" V");
  lcd.setCursor(0, 1);
  lcd.print("Channel 2 = ");
  lcd.print((volts2), 3);
  lcd.print(" V");
  lcd.setCursor(0, 2);


  delay(2000);
}

Reversing the leads to the ADS1115 here is what I get using A0 and A1:


Actual applied voltage:

Reversing the A0 and A1 leads:

Actual applied voltage:

I have left setups like this for several days and never had a problem. The input is not between 0 and Vcc applied to the ADS 1115. Yet when reversing the input to the ADS1115 I read negative which is what I would expect?

I also agree with wawa as to using two analog inputs to the Arduino which is like using two vertical inputs to a scope for want of having a differential input probe. Even then don't we need a divider like the one I linked to? Let the scope do the math.

I did fail (miserably) to note the thread starter was using PWM and only read 12 volt reverse motor.

In the example I posted A2 and A3 are just floating. Also my source voltage is an isolated voltage source, no common ground with anything.

Ron

No, they aren't. There are internal and stray impedances from the inputs to ground that MUST be taken into account. Without a clear wiring diagram it is pointless to comment on your results.

I'll add, though that the manufacturer's data sheet is correct, and that I have personally observed the extremely rapid destruction of an ADS1115 input, when presented with a voltage negative with respect to ADS ground. Others have confirmed a similar result for overvoltage on any input.

OK I just went ahead and shorted A2 and A3 so Northey read Zero as expected, Here is how the ADS1115 is wired.

With A2 and A3 shorted as shown they read out 0.000 Volts. Using a battery for source and a DPDT switch wired to reverse polarity to A0 and A1 inputs.

This is how the ADS board is wired. Pretty straight forward. So thoughts on this. I'll just let it run overnight.

Ron

In that case the ADS clamping diodes will try to keep input voltage within the ADS supply limits.
From memory, a fully floating ADS input hovers around 0.7volt.
Leo..

Agree, but considering the microscopic current draw, the ground clamping diode forward voltage could be significantly smaller than 0.7V -- and even safely within the absolute maximum rating of GND-0.3V.

The ADS1115 is intended to be used to measure positive voltages referenced to the ADS1115 ground, and optionally, compute the differences between them.

Any other use violates the basic design and the ratings set forth in the device data sheet. The results are not necessarily predictable.

I don't mean the PWM mode the Arduino. I want to implement a specified PWM algorithm, in which I have to change the output voltage of the H bridge alternativeley between +Vin and -Vin. It works. But when I insert the voltage sensor in the circuit, the output voltage of the H bridge become always positive or nul. The H bridge does not outputs the negative value -Vin. This is the problem.

A common single-supply H-bridge always outputs a positive voltage.
Either on one output pin or on the other output pin.

You don't have to measure that.
Just convert PWM to voltage, and make it negative when the direction pin changes.
Then print that fictional number to a display.

If motor suppy is 12volt...

if (clockwise) float voltage = PWMvalue / 256 * 12.0;
else float voltage = PWMvalue / 256 * -12.0;

Leo..

Apply the motor drive output voltage to the input of an AC opto coupler (PC814), low pass filter the output for an approximate voltage.
PC814X Series.pdf (230.1 KB)

Back in post #6 I explained why your circuit won't work. Your B25 Voltage Sensor is a voltage divider, that is all it is. A few passive components (resistors) on a board. Look at the data sheet. Ground is ground. With 12 volts applied to Vcc and ground the S out will be about 2.4 volts with reference to ground. You reverse the input the S output will be -2.4 (negative) volts with reference to ground. The analog input of your Arduino can't handle or work with a voltage below ground. Again look at the data sheet for what you have.

Ron

Yes. that is . I was able to measure the desired voltage using the ADS1115 circuit. Thank you so much

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.