collapse

Author Topic: Dagu 4 CH motor controller: stall current?  (Read 4736 times)

MEgg

  • Sr. Member
  • *
  • Posts: 262
Dagu 4 CH motor controller: stall current?
« on: September 29, 2015, 03:57:58 PM »
Since all the knowing people left LMR and my question there simply landed in void, I repeat it here:

I connected the current channel of the 4 Ch Motor controller
http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Robotics/4%20Channel%20instruction%20manual.pdf
with the analog input of the Spider controller and measured
with e.g. 90 PWM duty cycle "41".
Did I understand that correctly that this is
41 * (5V/1024 (= 10Bit resolution)) = 0,2001953125A
which means the motor draws 0,20A with this PWM duty cycle?

If the motor runs forward at PWM duty cycle 30
it shows 0.09A this way.
PWM 30 ->  0.10A backward
PWM 200 -> 0.23A forward
PWM 200 -> 0.25A backward

If it stalls it shows max 0.12A with PWM 30.

As far as I understood the whole thing the current measurement
with the 4 Channel Motor controller should go up to 2.5A .
Is the stall current measurement different for different
PWM duty cycles because of PWM?


Thanks in advance
1st project: Dagu 5 Rover + Dagu - 4 Channel DC Motor + Red Back Spider robot controller + Raspberry B+
Chassis + wheels: https://picload.org/image/dggroior/20150831_028.jpg
current: https://www.keepandshare.com/userpics/m/a/r/k/usegg/2016-04/sb/img_3480-79682018.jpg

SixSixSevenSeven

  • Member
  • ****
  • Posts: 31
Re: Dagu 4 CH motor controller: stall current?
« Reply #1 on: September 29, 2015, 05:03:09 PM »
Numbers seem about right.

Current is drawn not forced. While the motor driver can supply a 2.5A max current it does not mean it will force 2.5A through the motors.

PWM value of 30 is only about an 11% duty cycle. a 2.5A stall motor on an 11% duty cycle is probably only going to pull around 0.25A. I've never had a rover 5 motor stall at 2.5A anyway.

Duane Degn

  • Mr. 101
  • Member
  • *
  • Posts: 105
Re: Dagu 4 CH motor controller: stall current?
« Reply #2 on: September 29, 2015, 05:24:37 PM »
It takes a while to get the hang of volts and current. I think you're thinking about this the wrong way.

The motors will not draw the same current with identical PWM values. The amount of current the motor draws is very dependent on the load of the motor. If the motor is free to spin it will draw a small amount of current. As you increase the resistance to motor's motion, it will draw more current.

DC motors are often used as a sort of gearbox for diesel engines. A diesel electric converts the diesel power into electricity which is then used to drive DC motors. The DC motors will automatically draw more current as the load to the motor increases.

When doing calculations, it's really helpful to keep track of units. The units will often let you know if you set up the equation correctly.

In your example "41 * (5V/1024 (= 10Bit resolution)) = 0,2001953125A"
You have Volts on the left side of the equation and Amps on the right. This is one indication you are likely using the wrong equation.

Looking at the manual I see it says the control board outputs 1V for each amp the motor draws. This would be known as a conversion factor. A way of converting one set of units to another (I doubt this is any sort of formal definition). The conversion is 1V per 1A. We can replace the "per" with divided by or 1V output /1A current draw.

Now the ADC is 10-bits which will output from 0 to 1023. When the voltage is 5V the ADC will read 1023. It's always nice to have units on a number when possible so let's say 5V will produce 1023 ADC units. Here we have another conversion factor. 5V/1023ADCunits.
These conversion factors work with either units on the top or bottom. So one could use 5V/1023ADCunits or 1023ADCunits/5V. We want to use whichever one will give us the correct answer. This is a big reason why keeping track of units is so important.

Let's go back to the value you read from the ADC. 41ADCunits
We want to convert 41ADCunits to current.
Current (we hope) = 41ADCunits * (5V/1023ADCunits) * 1A/1V = ((41*5)ADCunits*V*A)/(1023*ADCunits*V)
We multiplied the top of all three fractions together and the bottom of all three fractions together to arrive at the above.
Since we have ACDunits on both the top and bottom these cancel. Same goes for V. We can then reduce the equation to:
205A/1023 or  0.2004A
About 200mA.
Of course you don't us the units in your program. You use the units to make sure the equation you're using in your program makes sense.
Having the units cancel out correctly isn't a guarantee you did the problem correctly, but if the units don't cancel, it's a pretty good indication you've done something wrong.

You can measure the current with the ADC this way but you won't be able to reliable predict what the current will be at a given PWM since the current will also be dependent on the load experienced by the motor.

« Last Edit: September 29, 2015, 05:49:29 PM by Duane Degn »

MEgg

  • Sr. Member
  • *
  • Posts: 262
Re: Dagu 4 CH motor controller: stall current?
« Reply #3 on: September 29, 2015, 05:27:00 PM »
So the question is, how can I measure stall.
If I try to stop one of the motors this is not possible somehow because they are quite strong.

But of course the A are rising from 0.21 to 0.44A with PWM duty cycle 90 for one of the motors.
Is that what I do have to measure: a sharp increase about 100%in a short time - say one loop iteration?

1st project: Dagu 5 Rover + Dagu - 4 Channel DC Motor + Red Back Spider robot controller + Raspberry B+
Chassis + wheels: https://picload.org/image/dggroior/20150831_028.jpg
current: https://www.keepandshare.com/userpics/m/a/r/k/usegg/2016-04/sb/img_3480-79682018.jpg

MEgg

  • Sr. Member
  • *
  • Posts: 262
Re: Dagu 4 CH motor controller: stall current?
« Reply #4 on: September 29, 2015, 05:34:25 PM »
[...]
When doing calculations, it's really helpful to keep track of units. The units will often let you know if you set up the equation correctly.
[...]
Since we have ACDunits on both the top and bottom these cancel. Same goes for V. We can then reduce the equation to:
205A/1023 or  0.2004A
About 200mA.
Of course you don't us the units in your program. You use the units to make sure the equation you're using in your program makes sense.
Having the units cancel out correctly isn't a guarantee you did the problem correctly, but if the units don't cancel, it's a pretty good indication you've done something wrong.

You can measure the current with the ADC this way but you won't be able to reliable predict what the current will be at a given PWM since the current will also be dependent on the load experienced by the motor.

I know that in this case the unit in the equations is important.
:-)
Also I am pleased that you come to the same result.
;-)
1st project: Dagu 5 Rover + Dagu - 4 Channel DC Motor + Red Back Spider robot controller + Raspberry B+
Chassis + wheels: https://picload.org/image/dggroior/20150831_028.jpg
current: https://www.keepandshare.com/userpics/m/a/r/k/usegg/2016-04/sb/img_3480-79682018.jpg

Duane Degn

  • Mr. 101
  • Member
  • *
  • Posts: 105
Re: Dagu 4 CH motor controller: stall current?
« Reply #5 on: September 29, 2015, 05:54:09 PM »
So the question is, how can I measure stall.
If I try to stop one of the motors this is not possible somehow because they are quite strong.

But of course the A are rising from 0.21 to 0.44A with PWM duty cycle 90 for one of the motors.
Is that what I do have to measure: a sharp increase about 100%in a short time - say one loop iteration?

I'd say pick the highest current value you expect to see and have any current higher than that trigger some sort of stall routine.

Duane Degn

  • Mr. 101
  • Member
  • *
  • Posts: 105
Re: Dagu 4 CH motor controller: stall current?
« Reply #6 on: September 29, 2015, 06:04:00 PM »
I know that in this case the unit in the equations is important.
:-)
Also I am pleased that you come to the same result.
;-)

I used to be a high school chemistry/physics teacher. I can't stop myself from talking about the units.  :)

BTW, I our numbers were close but not exactly the same. I'm pretty sure you need to divide by 1023 not 1024.

This becomes more obvious if you imagine a 2-bit ADC with values between 0 and 3.

MEgg

  • Sr. Member
  • *
  • Posts: 262
Re: Dagu 4 CH motor controller: stall current?
« Reply #7 on: September 29, 2015, 08:04:13 PM »


I'd say pick the highest current value you expect to see and have any current higher than that trigger some sort of stall routine.

I tried this and there seem to be intermediate high values like 1.04A which I never realized before because I did not measure motor current all the time.
I filtered them by counting them and only setting action if -say- 50 high-values come in a row, then I assume stall.

I also included a certain amount of non changing encoder values and now I think my stall detection is quite good.
:-)

1st project: Dagu 5 Rover + Dagu - 4 Channel DC Motor + Red Back Spider robot controller + Raspberry B+
Chassis + wheels: https://picload.org/image/dggroior/20150831_028.jpg
current: https://www.keepandshare.com/userpics/m/a/r/k/usegg/2016-04/sb/img_3480-79682018.jpg

MEgg

  • Sr. Member
  • *
  • Posts: 262
Re: Dagu 4 CH motor controller: stall current?
« Reply #8 on: September 29, 2015, 08:08:26 PM »

BTW, I our numbers were close but not exactly the same. I'm pretty sure you need to divide by 1023 not 1024.

This becomes more obvious if you imagine a 2-bit ADC with values between 0 and 3.

2^2=4  => 0...3

2^10 = 1024  => 0...1023
;-)
1st project: Dagu 5 Rover + Dagu - 4 Channel DC Motor + Red Back Spider robot controller + Raspberry B+
Chassis + wheels: https://picload.org/image/dggroior/20150831_028.jpg
current: https://www.keepandshare.com/userpics/m/a/r/k/usegg/2016-04/sb/img_3480-79682018.jpg

Duane Degn

  • Mr. 101
  • Member
  • *
  • Posts: 105
Re: Dagu 4 CH motor controller: stall current?
« Reply #9 on: October 17, 2015, 10:51:59 PM »
BTW, I our numbers were close but not exactly the same. I'm pretty sure you need to divide by 1023 not 1024.

I'm not so sure mu use of 1023 instead of 1024 is correct.

Tracy Allen pointed out my likely error in a similar problem on the Parallax forum.

If Tracy says one thing and I say something else, it's generally a good idea to believe Tracy. I've learned a lot from him on the Parallax forum.

SixSixSevenSeven

  • Member
  • ****
  • Posts: 31
Re: Dagu 4 CH motor controller: stall current?
« Reply #10 on: October 18, 2015, 05:44:41 AM »
The range is 0-1023 but there are 1024 values, so 1024 would be correct.

Duane Degn

  • Mr. 101
  • Member
  • *
  • Posts: 105
Re: Dagu 4 CH motor controller: stall current?
« Reply #11 on: October 18, 2015, 04:31:04 PM »
The range is 0-1023 but there are 1024 values, so 1024 would be correct.

A lot depends on the sort of output you want. If you want to have both a 0V value and 5V value, then I think you need to use 1023. If on the other hand you want the most precise reading possible, then I think you need to make the equation a bit more complicated.

Here's a link to a post describing my present understanding of the situation. I'm not at all sure I presently understand this.

 

* Search


* Recent Topics

The unnamed (yet) quatruped spider project by tinhead
[July 01, 2020, 04:22:11 PM]


"1984 Nixie Time" by 1 what
[May 08, 2020, 01:04:18 AM]


2D Side Scroller Cyberpunk themed by Killer Angel
[February 06, 2020, 06:39:40 AM]


A new wing design for model aircraft / drones by OddBot
[February 06, 2020, 04:42:06 AM]


SDR (Software Defined Radio) by Gareth
[February 02, 2020, 06:15:42 AM]


Circuit Math by ZeroMax
[January 31, 2020, 01:50:18 PM]


NanOMeter by Protowrxs
[January 01, 2020, 12:59:44 PM]


Investigating the VL53L0X Laser Rangefinder by erco
[December 30, 2019, 10:45:44 PM]


PS4 Single Handed Controller Deployed (part 7 of 7) by Gareth
[December 30, 2019, 09:52:29 AM]


"D" -Pad Workio just like Magic (Will Merlin stay or Go) (part 6 of 7) by Gareth
[December 30, 2019, 09:51:27 AM]


PS4 Joystick Digitals 4,5,6,7,10 - Analog's Lx,Ly,Rx,Ry Workio (part 5 of 7) by Gareth
[December 30, 2019, 09:50:37 AM]


Menu Workio ! (part 4 of 7) by Gareth
[December 30, 2019, 09:49:49 AM]


L1 trigger design Workio (Hori controller) (part 3 of 7) by Gareth
[December 30, 2019, 09:48:50 AM]


Hori aka PS4 Joystick Mappings (part 2 of 7) by Gareth
[December 30, 2019, 09:47:17 AM]


PS4 Single Left-Handed Controller (part 1 of 7) by Gareth
[December 30, 2019, 09:44:58 AM]

* Recent Posts

Re: The unnamed (yet) quatruped spider project by tinhead
[July 01, 2020, 04:22:11 PM]


Re: The unnamed (yet) quatruped spider project by jinx
[July 01, 2020, 04:06:19 PM]


Re: "1984 Nixie Time" by 1 what
[May 08, 2020, 01:04:18 AM]


Re: "1984 Nixie Time" by tomasp
[April 13, 2020, 06:03:28 PM]


Re: 2D Side Scroller Cyberpunk themed by Killer Angel
[February 06, 2020, 06:39:40 AM]


A new wing design for model aircraft / drones by OddBot
[February 06, 2020, 04:42:06 AM]


Re: "1984 Nixie Time" by Gareth
[February 02, 2020, 06:23:01 AM]


Re: SDR (Software Defined Radio) by Gareth
[February 02, 2020, 06:15:42 AM]


Re: SDR (Software Defined Radio) by ZeroMax
[January 31, 2020, 01:54:21 PM]


Re: "1984 Nixie Time" by ZeroMax
[January 31, 2020, 01:52:29 PM]


Circuit Math by ZeroMax
[January 31, 2020, 01:50:18 PM]


Re: 2D Side Scroller Cyberpunk themed by ZeroMax
[January 31, 2020, 01:45:33 PM]


NanOMeter by Protowrxs
[January 01, 2020, 12:59:44 PM]


Re: Investigating the VL53L0X Laser Rangefinder by erco
[December 30, 2019, 10:45:44 PM]


PS4 Single Handed Controller Deployed (part 7 of 7) by Gareth
[December 30, 2019, 09:52:29 AM]