Afterglow controller

Hi, I have just tried using my Monsterborg with an afterglow controller. It connected without any problem and was detected by the runMonsterJoy.sh code right away.

Problem 1: I could only go backwards and forwards. No other controls had any effect.

Problem 2: After a a few seconds, when going back or forwards the motors would lock on to a continuous run and there would be no response from the controller at all. the motors would run until I pressed ctrl-c.

This is the first time I have used a controller with a Pi and have absolutely no idea what I am doing with it. If you have any ideas how I can fix the problem of the motors locking on or being able to do more than backwards and forwards, they would be greatly appreciated.

Thanks,
Pablo

Ok, I have found how I can turn and the solution was stop being an idiot. I hadn't realised that turning also required moving forwards or backwards. Unfortunately, the motors are still locking on which makes the whole thing pretty useless. Don't know if this is just related to the afterglow controller.

The motors seemed to lock on every time the controller knob goes full back or full forwards. I have tried with two different controllers now. This appears a little similar to an issue that someone else was having.

I changed the batteries and now it works fine. Definitely an issue that occurs due to voltage.

piborg's picture

Glad to hear you got the problem sorted :)

It just goes to show how much effect the batteries actually have on a robot.

Yes, does leave me with a concern though... if I was using it in a park or somewhere and the batteries run low it means the robot might lock motors on and just run away into the sunset! Is there any way of limiting it so that below a certain level it just stops power to the motors to avoid this?

Also, any ideas on how I can get tank turns working with afterglow?

Thanks,
Pablo

piborg's picture

There is actually a failsafe in the ThunderBorg which is turned on by the script. This should shut the motors down in the event the Raspberry Pi itself gets reset which will happen when the batteries are nearly flat.

The failsafe can also be used to stop the MonsterBorg if he is out of range of the controller. Simply comment out the # Change LEDs to purple to show motor faults section in the script and it will only talk to the ThunderBorg when it receives an update from the controller. If the ThunderBorg has not had a message for more than half a second it will engage the failsafe and shut the motors off.

As for tank steering you might need to change the value of buttonFastTurn in the script to match the correct button on your controller. Check our guide here for more details.

I have commented out that section and stopping dead is far better than motors locking on. Thank you.

Just so you know, the 'locking on' issue is happening a lot even on not very much used batteries. It seems like every time the motors strain at all they go through this issue, and the program effectively crashes. The code is still running but the controller has no longer any control. I have to type ctrl-c and then run it again every few minutes. That means I could not use this without a device on hand with which to ctrl-c and restart the code. At no point in this is the Pi ever reset, just the motors under strain locks it up and code stops responding to the controller.

Is there any way to make the motor cut as commenting out that section does, but then resetting the code? Inall the situations I have come across, the strain is a momentary thing.

Thanks.

piborg's picture

It sounds like the controller is loosing connection when the power blips. It should be possible to get the script to restart the connection, but it is not quite as straight forward as the other changes.

In truth the fact this keeps happening is a bad sign, it makes me think that the battery change has reduced the amount of trouble but not solved the problem completely. What batteries are you using in your MonsterBorg?

Hi, I was using Industrial by Duracell (not new) and then put in a brand new set of Duracell Procell.

piborg's picture

This might sound counter-intuitive, but MonsterBorg will work better with rechargeable batteries.

Normal alkaline batteries (like you are using) would last longer, however they have trouble delivering short bursts of high power. The consequence is that they are not keeping up with the power required by the motor in some cases.

I would recommend getting some quality NiMH rechargeable AAs instead. These will also have the advantage that they can be reused :)

We have found that GP 2700 work very well for about 3 hours of actual driving time. We also use Eneloop AAs (1900 mAh) which do not last as long but they retain their charge when sat on the shelf.

piborg's picture

I just realised that the GP 2700 link is out of date. Use this one instead: https://www.amazon.co.uk/Rechargeable-2600mAh-Batteries-Charges-Pre-char...

They have changed the name to GP 2600 at some point, however as far as we can tell the batteries are identical. We actually have quite a collection of both in the office :)

Thanks, it looks like GP have rebranded and started calling these ReCyko+ with minimal design packaging. Have you tried the ReCyko+pro? Sounds like they might be a bit like the eneloops.

What about lipo? Would be a lot easier to charge than 10 AAs for me. Have you tried them? Should I expect any issues with them?

I have just fully charged and tried out 2150mAh 7dayshop rechargeables. They did seem to work better than the Alkalines, counter intuitively as you said. I have not tried them for so long yet but have had no motor lock ons as I was getting before, though I am getting momentary losses of power.

piborg's picture

We have not tried the ReCyko+ Pro batteries, however they do sound like they are similar to Enerloops as they retain charge and have a lower capacity (2000 vs 2600 mAh).

A 3S or 4S LiPo would work, but there are some things you will need to be careful of. I suggest reading this thread on the forum: Alternative batteries for Monsterborg.

Glad to hear your rechargeables have improved things. Let us know if they work out fine in the long run or if you are still having trouble.

Interesting thread.
I too have an afterglow PS3 controller and experienced some of the same issues. LIke you, it turned out that the battery source is critical. First I was using a 3A 12v mains supply, and I got the errors occuring. I then tried some older NiMH but they didn't work too wel. Now have brand new 2600's mentioned above and all is well. No more glitches.

How odd. All seems to be a little sensitive but glad you got it all sorted in the end. I would have thought the 3A 12v mains would be the most stable of all.
I have forward back and turns working with the afterglow but non other functions such as tank turns. I haven't had a chance to look at changing the code to fix that yet. Are you getting tank turns and move slowly?

piborg's picture

While I can understand that the 12V mains supply sounds like the best, it is actually the worst of all. Basically 3A is nowhere near enough for all four motors depending on the situation. Batteries can actually deliver quick bursts of current very well, the NiMH rechargeables are particularly good at doing this.

I just did a quick measurement of the stall current from a single motor on our 3A bench supply at 12V. The current used with the motor stalled is around 2.3A. This means in the worst case of all four motors the robot may need 9.2A for the motors plus any current the Raspberry Pi is using. The batteries cope fine because the current is only this high for a brief moment while the motors respond to the sudden change in power input.

The tank steering and move slowly buttons probably need changing to match your controller. The values in the script to change are buttonFastTurn and buttonSlow. Check our guide here for a quick explanation on how to find the right numbers for your controller buttons.

Just for the record, and anyone else using an afterglow controller, the values for buttonSlow and buttonFastTurn are 6 and 7 respectively.

I am using eneloop batteries now. A big improvement. I have found the biggest problem being the battery pack catching on something and resetting the Pi. This happens pretty regularly. Most of the time I run the Borg upside down to avoid this but it flips pretty rgularly and if the flip doesn't cause a reset then it'll happen pretty regulalry.

piborg's picture

It is great to hear you have the controller working now, I will point anyone else using an Afterglow controller at your results :)

The battery pack can be easy to knock, we have seen this in the Formula Pi racing. I would suggest making sure the cable tie around the pack is nice and tight. If that is not enough some double sided tape under the battery pack will secure it in place firmer, but it does make changing the batteries a bit less convenient.

Subscribe to Comments for "Afterglow controller"