PWM controlled DC motor causes disturbances

Hi,

I’m working on a testing rig for measuring braking force from an electromagnetic brake. I am using PWM signals from an Arduino Mega to control a DC motor, and measuring the braking force with a piezoresistive force sensor (as seen in the attached PDF). The system works but I am experiencing disturbances on the force sensor output (analog output) when running the motor. I am using three power supplies in addition to the arduino, 5V to supply the sensors and the AREF pin, 24V to run the dc motor and 20V for the electromagnets. I’m using a separate 5V supply because I needed to change the AREF voltage and to eliminate the chance of an unstable Arduino voltage being the problem. The grounds from all power supplies and the arduino are connected together on a breadboard.

I am guessing that the high current switching is the root of the problem and is affecting the ADC in some way. Any suggestions? :confused:

schematicks_testrig.pdf (102 KB)

Why the resistor connecting 5V to Aref. The default analog reference has Aref internally connected to Vcc (5V). It often helps to connect a 0.1uf cap from the Aref to ground to bypass noise. There is no reason to externally connect Aref to 5V unless the 5V is an external precision reference and external mode is selected, in code, for analog reverence.

Yes I’m using an external reference because I wanted to change the reference voltage for the ADC. I will try to connect a cap from AREF to ground!

A force sensor and a hall current sensor are RATIOMETRIC.
They have to be powered from the same point as Aref to keep their ratiometric properties.
Leo..

Hi,
What are your component values and transistor part numbers?

Have you got your force sensor wiring well away from the PWM output wiring.

The grounds from all power supplies and the arduino are connected together on a breadboard.

Bad move if you are conducting any significant current through the breadboard.

Have you made sure your gnds are star connected to the MEGA and not daisy chained?
This will keep gnd return currents isolated from each other.

Can you post a picture of your project so we can see your component layout please.

Thanks.. Tom... :slight_smile:

Wawa:
A force sensor and a hall current sensor are RATIOMETRIC.
They have to be powered from the same point as Aref to keep their ratiometric properties.
Leo…

And because they ratiometric, so long as the sensors and AREF share the same source, the absolute voltage accuracy and long term stability does not affect calibration/system accuracy. The take-away here is that you really don’t need a separate supply for the sensors.

As TomGearge points out, the errors are likely coming from ground level disturbances caused by T1 and T2 being on a breadboard and their current passing through and disrupting the Arduino ADC ground reference point.

Breadboards where created to prototype digital logic. They can and will fail spectacularly in many ways when subjected to any current beyond a few hundred milliamps, give or take. The common and currently available cheap Chinese breadboard products barely work for logic current levels due to the materials used and the noticeable lack of clamping force.

TomGeorge:
Hi,
What are your component values and transistor part numbers?

  • With the force range I am applying the resistance of the force sensor ranges from 160k to 220k,
  • R6 = 100k
  • C2 = 2uF.
  • C1 = 0.1uF
  • Gate resistors R2 and R3 = 10k
  • transistors: IRLZ44N
  • flyback diodes: BYV79200
  • L1, L2, R4 and R5 are the inductance and resistance of the electromagnets I am using and I haven’t yet measured the values.

Cant quite remember value of the resistor to AREF right now but the reference voltage was measured to be 2.4V.

You can look away from the current sensor wiring as I’ve removed it from the system.

avr_fred:
As TomGearge points out, the errors are likely coming from ground level disturbances caused by T1 and T2 being on a breadboard and their current passing through and disrupting the Arduino ADC ground reference point.

Breadboards where created to prototype digital logic. They can and will fail spectacularly in many ways when subjected to any current beyond a few hundred milliamps, give or take. The common and currently available cheap Chinese breadboard products barely work for logic current levels due to the materials used and the noticeable lack of clamping force.

The transistors are not ON the breadboard and should not be carrying any amount of current through it. The only connections they have to the breadboard are the gates and through a ground wire going from ground on the breadboard to a common point as I’ve tried my best to achieve a star connection :sweat_smile:

I’ve added antother PDF that probably gives a better overview of the system, and a picture of the (quite messy?) layout :sweat_smile: Again, the current sensor is remover from the system.

The reason I am using a separate 5V supply is that I found the Arduinos voltage output to vary between 4.7V-5.1V, affecting the output of the sensors. I therefore wanted to try a more stable supply.

system_overview.pdf (128 KB)

snorrus:
The reason I am using a separate 5V supply is that I found the Arduinos voltage output to vary between 4.7V-5.1V, affecting the output of the sensors. I therefore wanted to try a more stable supply.

Time to learn what ratiometric means.
Leo..

Wawa:
Time to learn what ratiometric means.
Leo..

The output voltage of the sensor is proportional to the input? I was thinking that if I calibrate the force sensor according to one input voltage, and this voltage changes randomly, than this calibration would be wasted. If I understand you correctly, you are thinking that I can use the Arduinos supply to both the sensors and AREF, and calibration will be okay since both the supply voltage AND the reference voltage will vary the same?

Hi,
You are best to post all your diagrams as jpg, rather pdf.
OPs Pics.
IMG_20180518_201435222 (2).jpg
circuit111.jpg

Tom… :slight_smile:

Thanks Tom :slight_smile:

snorrus:
The output voltage of the sensor is proportional to the input?

Try again.

Voltage on a force sensor with fixed pull up resistor depends on TWO things.
Voltage on the output of a current sensor also depends on TWO things.
Final A/D value also depends on two things.
Leo..

Wawa:
Try again.

Voltage on a force sensor with fixed pull up resistor depends on TWO things.
Voltage on the output of a current sensor also depends on TWO things.
Final A/D value also depends on two things.
Leo..

Would be better if you told me what those things are to make sure we're not just misunderstanding eachother here.

Point is that the output of a ratiometric sensor also depends on it's supply voltage.

And the output value of the A/D also depends on it's supply voltage (Aref), but opposite.

They cancel each other out if both are exactly the same.

If you use different supplies, then this is not happening anymore.
Leo..

By input I meant supply voltage :slight_smile: should have specified that better. I get your point :smiley: