HM1 Home Switch triggered by motor overcurrent?

General discussion of using Roboclaw motor controllers
Post Reply
evangifford
Posts: 19
Joined: Tue Jun 09, 2020 11:32 am
HM1 Home Switch triggered by motor overcurrent?

Post by evangifford »

Hello. I have a linear application with a SOLO with the 0 position indexed by a micro-switch. When I drive the motor in reverse toward the micro-switch in Motion Studio PWM control with the motor under no load, everything works as expected - the micro-switch is hit, S3 goes to 0V and HM1 is triggered in Motion Studio - encoder is zeroed, so far so good!

The problem arises when the motor is under load - under certain load, the motor stops and HM1 is triggered - zeroing the encoders, etc as if the micro-switch was hit - but it was not!

To confirm S3 was not hit, I put an oscilloscope on S3 and GND - since there seems to be a pull-down active internally, with my external pull-up - the voltage of S3 is 2.7V when open, 0V when closed. The motor adds about 1.2V Peak-Peak noise ripple during movement, the minimum voltage measured on the scope was 2.2V - well above the logic zero of the micro-controller, which I would guess to be about 0.7V.

Moving the motor up and down does produce noise on S3, but I would think not enough to trigger HM1.

So, what is triggering HM1 then?

If I set S3 to E-Stop instead of Home - this problem goes away - meaning my pull-up is good and motor noise doesn't seem to trigger it - but then it no longer functions as a Home switch.

This leads me to believe it's in the firmware of the SOLO.

My guess is an internal motor protection in the firmware?

Does the SOLO firmware contain some current threshold above which it will consider that the home has been hit, even though S3 is still high? If so, can it be disactivated?

Troubleshooting, I set the M1 max current to something like 1A, this seems to work as blocking the motor only triggers OC1 and no longer seems to trigger HM1 - unfortunately this does not give me enough power for my application.

Configuration:
Power Source: 4S LiOn
Motion Studio has S3 set as Motor Home(User)
S3 has external pull-up to 5V through 4K7
S3 drops to 0V through microswitch
Motor current limit is 2.5A (motor peak is 7A)

Thank You
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: HM1 Home Switch triggered by motor overcurrent?

Post by Basicmicro Support »

Based on your description I would start with a stronger pullup. You can go to 1k safely enough.

However your power levels are low in general. 7amps is nothing. I suspect something else is going on. Put the scope on 5v and see what happens there.

The internal pulldown(I assume you have inverted the pin since normally its a pullup and the switch would pull to ground when triggered) is around 25k ohms. 4.7k to 5v should pullup high than that. There are 3.6v zenor diodes with 100ohm current limiting resistors on each io so I would expect it to be between 3.6v and 4v when pulled up.

What brand and model of Lipo are you using? Is its voltage dipping under load? What is the mah rating? You can assume at least 1C capability with any lipo. so 1 times the mah rating in continous current. If its an RC lipo you can usually assume 10C and most are between 20 and 50C rated.

Also check your grounding. Make it as short as possible. Dont create ground loops. Weird things can happen if you do.
evangifford
Posts: 19
Joined: Tue Jun 09, 2020 11:32 am
Re: HM1 Home Switch triggered by motor overcurrent?

Post by evangifford »

Thanks for your quick reply!

The battery is a rather hefty custom 4S, 30aH 21700 pack so even at 1C and a few other things running off it, I think there is plenty of overhead - as you suggested I'll measure the dip under load to verify my assumption.

The pin does seem to have a pull-down. I haven't inverted it - I don't know how to change it besides Motion Studio - so it makes me think maybe there is an internal pull-down in the microswitch provided to me - something I'll check.

I'll verify the S3 internal pull-up without anything connected to make sure I'm seeing at least 3.6V.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: HM1 Home Switch triggered by motor overcurrent?

Post by Basicmicro Support »

The internal pull-up/downs are weak. You may need to add external ones, up or down dependin gon your settings.

When I say weak I mean weaaaaaaak. :)

If oyu are using that heavy of a battery I expect the motors are not tiny either. The bigger the motors the more likely you will have problems with the internal weak pull-ups/downs so add external instead.
evangifford
Posts: 19
Joined: Tue Jun 09, 2020 11:32 am
Re: HM1 Home Switch triggered by motor overcurrent?

Post by evangifford »

With no switch connected, here's what I got measuring S3 with different pull-ups

Using 4.7K external Pull-Up:

S3 Motor 1 Home(User) inverted? no: 2.833V
S3 Motor 1 Home(User) inverted? yes: 2.754V

Using 1k external Pull-Up:

S3 Motor 1 Home(User) inverted? no: 3.377V
S3 Motor 1 Home(User) inverted? yes: 3.355V

Using No external pull-up (just pins):

S3 Motor 1 Home(User) inverted? no: 2.089V
S3 Motor 1 Home(User) inverted? yes: 0.003V

-

Changing the pull-up from 4.7K to 1K (as suggested above) results in a bump from 2.7V to 3.3V resting voltage - so there is a pull-down fighting with me somewhere ... ?

So why isn't S3 more like 4V resting voltage?
Last edited by evangifford on Wed Jul 15, 2020 1:22 am, edited 1 time in total.
evangifford
Posts: 19
Joined: Tue Jun 09, 2020 11:32 am
Re: HM1 Home Switch triggered by motor overcurrent?

Post by evangifford »

Ok, I was back in the workshop today - I tried the three scenarios above, 1K, 4K7 and No (so, 25K internal) pull-ups - the results are good.

Using Motion Studio, I set the S3 mode to Home (User), Inverted check box not checked.

I moved the motor toward the reverse limit switch at pwm 255 and manually stalled the motor. Max stall current (measured in MotionStudio) - is ~7A. Battery is a 10AH, 15C RC LiPo. Current limit set to 45A. Homing microswitch is disconnected.

No pull-up: Stalling motor can reliably cause HM1 to trigger
4K7 pull-up on S3: Stalling motor does occasionally causes HM1 to trigger somewhat randomly.
1K pull-up on S3: Stalling motor never causes HM1 to trigger

I've never used a 1K pull-up, but testing has showed it is required for reliable operation.

Looks good!
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: HM1 Home Switch triggered by motor overcurrent?

Post by Basicmicro Support »

The internal pullup-downs are activated depending on the inverted/non-inverted state. But your numbers look reasonable. Note when you set the pin to be inverted you should be pulling down. When non-inverted pulling up.

Note when non-inverted a falling edge is triggered, when inverted, a rising edge is triggered.

Also if the motors are not actively being run the limit switches do nothing. You have to send a command to move the motor forward or backward for the limit switches to do anything.
evangifford
Posts: 19
Joined: Tue Jun 09, 2020 11:32 am
Re: HM1 Home Switch triggered by motor overcurrent?

Post by evangifford »

Yes, I confirm this is the behavior I expected and was seeing.

So S3 configured as Home (User) can be triggered both by a micro-switch contact (desired behavior) and by a sudden current draw from the motor (unexpected, undesired).

The work-around is a low-resistance pull-up to 5V - I used 1K
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: HM1 Home Switch triggered by motor overcurrent?

Post by Basicmicro Support »

Any signal could be triggered by noise if the noise is large enough. That is why different pull-up values are used on different systems. The internal pull-ups are convenient but not universal. With any system that can cause a large amount of noise you will need more pull to prevent glitches. It's the difference between real world and textbook electronics.

Post Reply