I’m just guessing, but initFOC() is the first function that moves the motor. So I think the motor is drawing too much current, overloading the PSU, voltage drops, and then you get a reset…
If the PSU can handle the current and its just a transient problem you can solve it with some capacitance… if the PSU is too weak, you need a stronger one…
Thank you rndbit.
I tried “motor.voltage_limit = 5;” with actual 12V supply.
But I got the same result.
(Also, “motor.voltage_limit = 24;” caused the same result.)
Thank you runger.
I’m using Wanptek WPS300. I think it is sufficient to drive the motor.
I used an oscilloscope to monitor the supply voltage. At least the voltage never dropped below 10V.
The PSU should be ok, the question is whether it can handle the sudden change in current - have you tried adding an electrolytic capacitor, maybe 200uF or so, across the power input of the SimpleFOC shield? If you have one with “legs” you can just stick it in with the power cables (watch the polarity).
Voltage limits should always be set lower or equal to the PSU voltage. To set them higher makes no sense, and may confuse the algorithm (I have to check the code if we check for it).
But with this motor at 12V, the current should not rise above 1.2A or so… it has 11Ω resistance.
Can you carefully check your cable connections? How about the solder bridges? And the USB connector of the Arduino, it is not touching any of the simpleFOC shield on the bottom?
The best solution to the problem. Attach bulk capacitance, one or more 1000uF/25V would do it if you target 12V. Solder them right next to the board input voltage leads. Make sure you get the polarity correctly. You may also want to attach 1MegaO resistor in parallel to guarantee full discharge when the board is not in use.
I don’t know the detailed root cause, but I replaced the Arduino UNO with a legitimate one from a compatible one and everything works fine now.
Thanks to your advice, I was able to arrive at the correct answer.