United Kingdom
Asked — Edited
Resolved Resolved by Rich!

Setting Max Speed For H-Bridge Motors

Hi there.

So, I have 2 drive motors running through a L298 H-bridge. I have set these up with a "H-bridge with speed control" Movement Panel and all is working well, but here's where I need a little guidance.

At the moment the motors are controlled via joystick 1. I have the variable speed box checked and the sensitivity set right down to the lowest option in the joystick 1 config menu. Problem is it is still quite sensitive so I need to reduce the maximum motor speed by at least half when the joystick is fully pressed. Is this achievable, and if so how do I go about doing this? I'm guessing there is some scripting involved somewhere. I have had a look through the script menu but I don't know what I need to use. I will also need a reduced maximum speed for these motors for when for when things go autonomous when I get round to setting that up.

Many thanks,

Steve.


ARC Pro

Upgrade to ARC Pro

ARC Pro is your passport to a world of endless possibilities in robot programming, waiting for you to explore.

#25  

I haven't had as much free time as I thought, and had some other priorities with my Roli, but this is still on my todo list. I am certain it is solvable with a custom Movement Panel and scripting similar to what we did with the Sabertooth Ramping scripts Rich wrote for Gwen's B9.

Now, since it turns out you need a more powerful H-Bridge, anything I come up with will need to be adapted to the commands for that bridge, but we'll cross that bridge when we get there (or if you decide to bite the bullet and get a Sabertooth, things are much simpler. It turns out Rich's ramping script was superfluous because you can hook the Saberooth up to a TTL adapter and give it a command to tun auto-ramping on, and we can make a custom Movement Panel that has whatever you want as your max speed be the command that gets sent to move in that direction).

Alan

United Kingdom
#26  

I might be looking to get a sabertooth early next year if there's no other way. For now I've just ordered a 10amp H-bridge which should solve my other problem.

I was thinking, all we really need for this is a setting in the Movement Panel config menu, where we move a slider control to where we want it set, and tick a check box next to it saying "use this slider setting for the max speed". Unchecked, the slider/speed would go back to default maximum. Something DJ may consider adding to his to do list. Just a thought to make things a little easier perhaps. ;)

#27  

That tends to be what happens here. Several of us will start discussing how to achieve something with existing features, and just about the time we have it worked out, DJ will add it as a feature.

I think it is one way he judges the priority of things. The more we are willing to work for it, the more likely it is that other customers will want it too.

Alan

United Kingdom
#28  

I'm more than certain that an adaptation of the custom Movement Panel on Gwen's B9 would achieve what is needed here.

Just refresh my memory (without me re-reading the topic). What's the end goal? What must be achieved?

#29  

Goal: Conrinue to allow speed ramping when using a Joystick to control an HB 298n, but be able to set a max speed lower than speed(256) or pwm(100). Today, the Joystick over-rides the speed setting in the Hbridge with PWM movement panel.

Should be modifiable to work with the new H-Bridge steve ordered due to the 298n not being sufficient for his motors.

Alan

United Kingdom
#30  

Well I got my motor controller and have just installed, had a play around with the joystick again trying to finally sort out the max speed issue, and finally solved it with Rich's help in another thread in https://synthiam.com/Community/Questions/6378" target='_blank' rel="nofollow">post 4 .;)

I opened a Modified control panel and inserted the following scripts in to the config menu.


To Stop...

Set(D1, On)
Set(D3, On)
PWM(D0, 0)
PWM(D2, 0)

To go forwards...

Set(D1, On)
Set(D3, On)
PWM(D0, 60)
PWM(D2, 60)

and to go in reverse...
Code:
Set(D1, Off)
Set(D3, Off)
PWM(D0, 60)
PWM(D2, 60)

This works like a charm. I haven't added left of right code as I have a separate servo for this. Hopefully this will help you out too Alan (let me know how you get on), and thanks again to Rich for your help:). I just need to stop the wheels spinning when I power the EZB and waits to make a connection, which I have asked about here in post #15.

#31  

Oh, that was much simpler than I expected.
[edited to remove question that made no sense once I opened ARC and looked at the options]

Alan

United Kingdom
#32  

Much simpler than I expected too:). Only thing is that I have lost vairable speed from the joystick, but Rich did leave a script with some math to deal with this which I may play around with.