Simple FOC in Combat Robot Aplication

Hi all, i’m Luiz and i am the captain of a small combat robot team in Brazil. I was searching about ways to control brushless motor on “low rpm” range and found these awesome library.

In combat robots we gone the brushless route too, but we have some problems, because we need high torque at start up, we can’t just connect the motor to the wheel because the motor jitter and don’t spin. We need to couple with some gearboxes, but it have problems like (pinion slipping, gears stripping, and others).

On the higher weight classes 250lb, like on the show Battlebots, some people use hoverboard motors with Vesc, but for small weight classes like 3lb, an Vesc is impossible to fit.
A guy made a 3lb bot that the can of the brushless motor is the wheel, but his code and electronics is for PhD so he can’t publish. But by that i know that it’s doable, and very high performance.

Long story short, don’t need angle control or very precise position. Just need to have full torque at start. And one fight is about 3min long, it need to work on very high performance for 3min.

My last point is as the name of the sport might sound, sometimes robots get smashed or caught on fire, so major part of us builders don’t want to put high costs components that can break on fight.
Or bulky parts that take huge amount of our weight “budget”.

I want to hear your thoughts about what sensors to put in a application like that, i was thinking about the very cheap arduino encoders, like this one: https://www.amazon.com/Willwin-Measuring-Comparator-Optocoupler-Arduino/dp/B0776RHKB1/ref=sr_1_12?dchild=1&keywords=arduino+encoder&qid=1594698479&sr=8-12

I’m more a Mechanic guy, but understand a little about code and electronic. As for the board to control this, i’m thinking about designing my own. For Beetleweights (3lb) usually 5-10A can handle.

Thanks in advance, i would love to hear from you guys. If you guys want too see what’s like a combat robot here are one video of mine from design to battle, on less than 3min video: https://www.youtube.com/watch?v=7vYH10aP6so

2 Likes

Someone can tell me if this encoder type would work with the SimpleFOC, thanks.

https://www.amazon.com/Willwin-Measuring-Comparator-Optocoupler-Arduino/dp/B0776RHKB1/ref=sr_1_12?dchild=1&keywords=arduino+encoder&qid=1594698479&sr=8-12

Hey Luiz,

You need an encoder with higher CPR, for your application your safest bet is probably a magnetic encoder, such as the AS5047. Magnetic encoders are not that expensive and you should be able to protect it as you just have to have the magnet nearby. Alternatively, I believe Antun is going to develop hall sensor support which might just be what you need.

Fun proyect!

Cheers,

David

Thank’s. I was searching for magnetic encoder, they are rare to find here in Brazil, just found the AS5040. Which seams to just output this types of signals “Digital angle (interface) / ABI / UVW / PWM”
For what i read about the library, magnetic encoders just work with SPI signals, right? (But i didn’t dive too much )

About hall sensors, i think for a small bot like 3lb it will be challenging, but worth a try, definitely a option for 12 and 30lb bots.

As i have progress i will post here.

Thanks again David :slight_smile:

Hey @Luiz_Eng_Rev and @David_Gonzalez!

@Luiz_Eng_Rev your project is so cool!

And the question you’re asking is well placed. We have not really discussed the minimal encoder resolution you need to have in order for the FOC to work (at least the off-the-shelf SimpleFOClibrary).
In theory, this depends of your motor.
I would say that you need to have at least:
cpr = motor_pole_pairs * 3
This would be enough to determine when to switch on which phase.

But for smooth operation on lower velocities you would need much more. I don’t really have a good number on my hands at the moment. But I would say if you have 10pp motor you’ll need 100 cpr encoder.
So your encoder from the link doesn’t have a encoder wheel so I don’t know the CPR or the pp number of your motor but you can calculate it from the equation above.

I see that you also discussed the hall sensors ( which are essentially encoder with minimal number of CPR possible).
I do not believe that there is a big reason why they would not work on small robots as well. They are used also for the small drone motors and similar setup. Am I wrong @Luiz_Eng_Rev?

Finally, I am not sure what do you mean that you need the full force on the start/beginning and why the simplefoc would not be able to deal with it, could you please just clarify it a bit, thanks!

Hi @Antun_Skuric .
The encoder i put a link usually have 20 “holes” on the disc. And it’s very low i guess.

About hall sensors, in 3lb class we usually use motors like the DYS1806, to put 3 hall sensors maybe will have some difficult, but doable.

I think it’s more simple to put a magnetic encoder than a hall sensor, because one magnetic encoder could fit various motors, and the hall sensor need and specific distance and radius from the can of the motor, but hall sensors is much more cheap, that’s a reason to try.

So Drones motors don’t usually have any type of sensor, the tend to be as compact and cheap as possible. The motors that i see coupled with sensors are gimball ones, but the ones with sensors are higher costs than buy a magnetic encoder and a motor.

About the full force at the beginning a was trying to say that with the motor off at the start the motor need to move the full weight of the robot, and when putting load on a brushless with simple drone escs they tend to jitter and don’t move. The drones escs have very difficult time handling the start up at low rpm.

Not my video but on minute 5:09 you can see some example off jitter on this test platform : https://www.youtube.com/watch?v=O0NjT8ICq0s

Note that the motors run but at the beginning they have difficulty and this is with only the weight of the bot, not pushing other with the same weight.

And about the simple FOC library maybe i do not express well, i think it’s the best solution for this problem, and i highly think it’s the next big step in combat robot. We dream about stop using gearboxes, using just the brushless motor would be awesome, less places to fail.

If there is more questions please tell me, my English is very limited.

Hey Luiz,

The jittering you’re seeing using a regular ESC and brushless motors is most likely happening because most ESCs use back EMF to measure the rotor’s position. With big loads it’s hard for the motor to start turning and the ESC goes out of sync with the rotor.

I agree that a magnetic encoder is the easiest to adapt, using those in combination with SimpleFOC you’re going to get great results. Don’t worry about SPI, I’ve used magnetic encoders with ABI signals and that is already implemented in the library.

Thanks for your thoughts @David_Gonzalez, yes the rc esc for this application is not an option.

Awesome, i will start developing the board for testing. I’m pretty sure if it works well i will open source the schematics and all of that, and maybe sell for some fellows here in Brazil. But everything opensource.

I just need to gather some materials for the physical part as encoder, motor, etc. The pcb i will make in china for cost reasons, it will be very compact and handle some combat needed features.

Any suggestions would be appreciated, thanks all.

Someone already use the magnet encoder AS5600 ? Apparently it have a pwm output.

Hey @Luiz_Eng_Rev I think @Adam_Donovan used one of these sensors with I2C communication. I am planning to implement both PWM and I2C for the Magnetic sensors very soon.

At the moment, the standard library supports magnetic encoders using SPI or ABI interface.

I am a bit late, but just to clarify. Hall sensors will not give you smooth operation on low velocities, so that is out of question. Encoder with 20 impulses per revolution is not good enough either. Magnetic sensors could be your solution, but I am honestly not sure that either I2C or PWM mode will be good enough for your application. I2C has a lot of trouble with electromagnetic noise, I suppose for your application this might be an issue. And PWM signal is pretty noisy as measurement as well, due to the timing of the microcontrollers. So I would suggest you to get a sensor with the ABI or SPI mode.

Let me know how it goes, I’ll keep you updated when I implement the PWM and I2C.

Cool to hear @Antun_Skuric , but i will try to find one with SPI or ABI interface for now as you describe. Interference it’s a big problem, and a combat robot have lot’s of signals at the same time, so better avoid.
I’m on the quest to find a Three Phase Motor controller that JLC SMT have for assembly, not very simple but on the way.

On my aliexpress research i found that AS5048A Magnetic Encoder is the most cost effective one so far, not as cheap as i would like but i think it will not brake as a motor or something like that.

For motors for the Beetleweight (1.36kg) looking for some 2204 Gimbal Motors 12N14P 260kv, very cheap

Hi @Antun_Skuric Are you thinking on implementing SSI magnetic encoders on the library? i found some cheap encoders but just have SSI and PWM outputs.

Hey @Luiz_Eng_Rev I was thinking about it yes. But I do not have a sensor that supports it at the moment. But all that I need to start is an Arduino code which reads the sensor position and I will figure out the rest. If someone has a working code please let me know and I will include it to the library.