Orangutan x2 VNH3SP30 - power consumption on motor port?

Yes, that’s ok. You should not expect to read a meaningful voltage on a floating analog input, because there’s no reason to expect it to be at any particular value. You might read 767 because the ADC capacitor still has some voltage on it from when you had the sensor connected, or the voltage on the pin might be weakly affected by what’s going on with the neighboring lines. If you want an input to have a known default state when nothing is connected to it, you would typically use a pull-up or pull-down resistor (but these are rarely used with analog inputs).

- Ben

ok, i understand. thats going to be no problem for my usage. can you please tell me a last thing: (i hope the question is not too stupid?) when i want tu measure the corrent eg. of motor on motor port 1 of my Orangutan x2, which pins go to te IP+ and IP- connection on my current sensor? i thought i could connect the two motor power cables to the IP+ and IP- pins. Is that an absolute nonsens? (Sorry, i´m an absolute newbie in that area and i´m kearning al ot by making al ot of mistakes at the moment;-)

… and one more question: i saw, that when i call the function x2_get_motor_current(1) i get some values, raising when i increase the motor speed, annd falling until near to zero, when i´m decreasing. are these “phantom values” or is it possible that my orangutan has a built in carrier sensor? i have a X2 VNH3, i thought only the VNH 2 has got this onboard functionality?

Don’t feel bad about asking questions; we were all beginners at some point. Also, it’s good that you’re asking before actually making your connections since connecting things wrong could destroy your board.

You need to put your current sensor so that the current you want to measure flows through it (e.g. in IP+ pin and out the IP- pin). One way to do this would be to connect your system as follows:

one motor driver output (e.g. M1A) to IP+
IP- to one motor terminal
other motor driver output (e.g. M1B) directly to other motor terminal

Does this make sense?

You could also measure the total system current by putting the current sensor between your battery and the board’s VIN:

Positive battery terminal to IP+
IP- to board VIN
battery ground to board ground

- Ben

ok, thank you so much- i´m one step further now;-)

but:

i made the setting exactly like you described (and i also can understand it now!). i´ve got a transformer with 6A, my motor has the following specs:
at 6 V: 33 RPM and 80 mA free-run and 2.2 A stall.

i wrote the following code:

#include <pololu/orangutan.h>

int main()
{
   while(1)
   {
  
set_motors(0,20);
lcd_goto_xy(0, 0);
print_long(analog_read_millivolts(0));
delay_ms(500);
	  
   }
}

at free run at speed 20 it shows up something around 2500
when i suddenly try to stall the motor it goes down to 2350 , but the value increases, even when i still hold the axis.
the problem is, that this value sometimes nearly is also reached without blocking the motor.

the values and this behavior doesn´t change a lot when i try a higher speed. should not increase the current significantly when the motor is stalled?
do you think, my setting is correct?

what i´m trying to get is a secure feedback when my motor is blocked (or nearly blocked), in form of a significant change of some value. i thought it would be possible via the current measuring. what do you think?

Do you have a multimeter? If so, then I’d suggest you use that to measure your current draw and confirm that it matches what your current sensor is reading. In general, it sounds like your current sensor is working (the output is 2.5 V when the current is almost zero, and the output changes significantly when you stall the motor).

Note that the stall current will slowly decrease over time as you hold a motor stalled: as the motor heats up, the resistance increases, and the current drops. It sounds like you are observing this effect when you say “when i suddenly try to stall the motor it goes down to 2350 , but the value increases, even when i still hold the axis.”

The particular sensor you are using has a sensitivity of 167 mV/A if you are powering it at 5 V, so you can program your X2 to output the current in milliamps using the following:

int main()
{
  while(1)
  {
    set_motors(0,20);  // you probably want to use a higher speed here
    clear();
    print_long(((long)analog_read_millivolts(0) - 2500) * 1000 / 167);
    print(" mA");
    delay_ms(200);
  }
}

I haven’t tested it, but I think the above code will work.

- Ben

thank you again. i have a multimeter and i measured the mA: on the multimeter it says -83,2 and during freerun it is sometimes variyng between -83,8 and -82,0. when i start to hold the axis it goes down to -130. motor still not stalled. and the value stays there.
i uploaded your code example to my orangutan, and at the same time as measuring on the multimeter (same mechanical condition!) my lcd on the orangutan says 71 during freerun, BUT jumping around like cracy between -161 and + 161. when i start to stall, it goes down to -200.
as you can see, the values on my amperemeter are quite precise, on the current sensor its very unstable and not secure enough for my usage. do you think the current sensor itself is not precise enough in the value range of 80mA? or am i doing something wrong?

so i still have no secure solution for getting the info, if my motor is (nearly) stalling. i thought, thats one of the standard-challenges for robot builders and not so hart to solve:-(. i tried to get an other solution via the buildt in encoder of this motor, but i´m not firm enough in programming a software based “rpm-sensor”. i posted this question in the software-forum. could you perhaps be so kind and post some hints for me there? thanks a lot!

You should be able to get useful readings from that sensor. Note that you will not be able to measure very small currents accurately, however: your resolution is around 25 mA. Things should get better if you command your motor to move faster and try to stall it, since the stall current will be higher. Also, you should try averaging a few current readings together using:

analog_read_average_millivolts(0, 64);

instead of analog_read_millivolts(0):

print_long(((long)analog_read_average_millivolts(0, 64) - 2500) * 1000 / 167);

- Ben

jippieh!

thanks for your help. with the analog_read_average_millivolts function i get more stable and meaningful values, even at small motor speeds -thats exactly what i was looking for! thank you! so i will also have a more stable night tonight (its 8pm in my home-country now;-)

sorry, one more question about the current sensoring:

because i´m using my motor on a very low voltage this sensor seems to be a bit too inaccurate. (you spoke about a resolution of 25mA). can you tell me something about the onboard current sensor of the orangutan with VNH2? is it compareable to one of the standalone current sensor? or is it “universal” with a controllable range of accuracy? is there a documentation about this onboard sensor?

…but i think, with your help of course, i´m on the right way now…

The built-in current sensor on the VNH2SP30 is worse than the one you have now. It has a sensitivity of 130 mV/A, which would give you a resolution of around 40 mA. You can look at the VNH2SP30 datasheet for more information. Keep in mind that the VNH2SP30 and VNH3SP30 drivers are capable of delivering up to 30 A, so there are very few applications where you would want to use such a powerful driver while being able to accurately measure something as small as a few milliamps.

The highest-sensitivity external current sensor we carry is the ACS714 Current Sensor Carrier -5 to +5A, which provides 185 mV/A (this isn’t a major improvement over the 167 mV/A of the sensor you are using now).

Maybe you could consider using our Orangutan SVP. It has motor drivers that can deliver a continuous 2 A (6 A peak) and integrated current sensors with a sensitivity of 850 mV/A (which corresponds to a resolution of around 6 mA). It also has inputs for two quadrature encoders along with a secondary processor that can read the encoders for you. It sounds like this controller, which happens to be our newest Orangutan, is better suited for your current project.

- Ben

it sounds interesting for me that this carrier sensor is more sensitive. just one question to the SVP: what do you think about the lifecycle of such controllerboards in general? can you imagine that such a board is used over 10 years? and what about the influence of higher current? do you think the board will live longer if the current is lower in relation to the max. A?
for example: i´m using 2 motors on my board, one is quite low-current (thats the one we talked about in the whole last postings). but the other one is driven by 300mA freerun and 5A stall, that would be exact good values for the SVP. i think in real life usage it would run exactly at the 2A the SVP allowes. so what do you think about that? does that influenc the lifetime of the SVP? is it better for the board lifetime having a X2, because its quite low-current for that controller?

We have not characterized the lifecycle of these parts, but I expect them to work for many years as long as you use them in spec. The VNH3SP30 motor drivers are probably more robust than the TB6612FNG drivers used on the Orangutan SVP, so at least the motor driver circuitry of the X2 will likely be more forgiving of mistreatment than the motor driver circuitry of the SVP. However, the SVP may not be appropriate for your application if you really plan on being right at the top of its 2 A continuous current rating. I don’t expect this to significantly shorten the SVPs life; rather, the problem could be that it often inconveniently goes into thermal shutdown because you’ve overtaxed the driver.

- Ben

ok, so perhaps it would be a solution for me to take another motor.
when i have an average current of not more than 1A you could recommend the SVP?
could you please tell me something about the programming procedure? can i say that programming via usb interface and AVR Studio works similar to the X2? in the online documentation there is mentioned a auxiliary processor which can be programmed via usb?

Basically, you should pick a driver that can handle your peak needs. If your motor draws 1A 90% of the time, but occasionally you need to be able to supply 3 A for a minute, the SVP is probably not appropriate, because it will likely overheat during that minute of 3 A draw. I suggest you pick a motor driver that can handle your peak needs and at least gives you a bit of a margin above your typical needs.

Programming the SVP is very similar to programming the X2. Both have integrated programmers, so all you need to do is plug it into USB. While the X2 has a programming mode (you need to hold the reset button for 0.5 s to put it in programming mode), the SVP just has multiple virtual COM ports, one of which can be used for programming and the other for general-purpose serial communication. All you would do is select the SVP’s programming com port from your programming software.

- Ben

hi ben,

here i am again,

finally i have bought and set up a orangutan svp. now i have again problems with reading the current sensor values. i am not really sure about my hardware setting.
i wrote the following code:

int main()                  
{
  while(1) 
  {

    set_motors(30, 0);  
clear();
print_long(analog_read_millivolts(0));
delay_ms(200);
  }
}

motor 1 is running, so the connection and the code is correct. but what about the current sensing? i connected the M1 current sense to the A0 I/O pin. when it is plugged in, i get the value “0”, when i plug it out, the lcd says “1579” , sometimes changing a little bit. i didn’t change any wiring/jumpers on the SVP, it’s like i bought it.

do you know whats going wrong on my setting?

thanks!

Can you post a picture of how you have things connected? Also, can you try it with higher motor speeds or more of a load on your motor?

- Ben

ok, the wiring is correct, because when i try higher motor speeds, it works. the problem is, that i thought, the current sensor of the svp is accurate enough to handle such small differences like stalling my motor at a motor speed of 30. is there a possibility of getting mor sensible measuring with this sensor? when i increase the speed to 60 the sensor goes to “5”, when i stall it, but i really need a meaningful change of its value at a speed of 30…

What motor are you using and what is your power supply?

- Ben

i have a 12 6A DC power supply

the motor is a gear motor with 10 rpm and 12V

the following manufacturer values:

140 mA free run
270 mA nominal current

i measured:

1oo mA free run at motor speed 255

at motor speed 30:

60 mA free run and 200mA stall

at motor speed 60:

70 mA free run and 360mA (nearly) stall → thats exactly the point where the LCD is changing from “0” to “5”. when these values really are millivolts, there must be a value around 60 (according to your description of the onboard current sensor). am i right? what am i doing wrong?

Can you stall your motor at full speed (i.e. 255) and measure the motor current with your multimeter, and then repeat the exact same test except this time use your multimeter to measure the voltage on the appropriate CS output (with the CS pin disconnected). I’d like to get a sense for exactly what voltage the pin is outputing at what current.

- Ben