BLDC Motor, PWM, Circout

Hi together,

I got a project with 3 BLDC Motors. Unfortunately my Code is not working and I’m unsure where the problem is.

I’m guessing that the PWM is the problem because in the Datasheet it says it recommends 20kHz PWM signal for the Speed.

But the complete Motor is not working even if I set the speed adjustment on High.

I attached my Layout, XOD Programm and Datasheet.

If someone could help me with that issue it would be great!

Regards
AarZeon


132b1f415ab6e92f43dee4fc4aebf20b.pdf (3.7 MB)
Motor_BLDC.pdf (815.8 KB)
BLDCMotors.xodball (43.7 KB)

If Brake Motor applies brake so motor doesn’t turn, then your code only allows motor to run in one direction. You probably want to apply break when count is equal to position, but you can only check for equal if position will always be an integer (4.999999999999 is NOT equal to 5, even if watch node displays it as 5.00). You could check for abs(position - count) < 1 instead of using equal.

If you are using a hall sensor, I assume you are counting revolutions. You pulse-on-change, so you will double-count each revolution (once as the sensor is activated & again when it is de-activated). You probably want pulse-on-true, which would be the same as connecting Hall Sensor-SIG directly to count-INC.

This is not needed:
image
since if-else-R will always just be if-else-COND

Adding a delay before changing motor direction means motor will move in the wrong direction during that delay.

I did not try to check your math calculations.

FYI: If you click on a node, the inspector on the left side of your screen will allow you to enter values for the node pins so you don’t need to create so many value nodes.

Thank you gweimer,

I changed the brake logic, and unforutenatly the motor still doesnt turn in any direction.

Even if I just make a regular button to decide the direction it won’t move at all.

In your diagram, you show a red wire running from PCB to GND. This should probably be going to 5V.

I think you will need to connect 24V GND to 5V GND in order for Arduino to accurately communicate with motors. DO NOT connect 24V+ to 5V+ (obviously…)

Looking at the motor spec sheet, the brake wire needs to be HIGH for motor to run; not sure how your updated code is setting it.

A warning once you get the motor spinning, using digital-read feeding a count node may not work if the motor is spinning quickly and generating pulses to quickly for Arduino to see them all. The more code you are running, the more likely this is to be a problem. The work-around would be to use interrupts to count, but that is not trivial, and I don’t think is well supported by XOD.

Another issue you might run into with XOD is that you cannot specify which timers are used for delay and other nodes, so you could run into conflicts with timers used for PWM. I have had to switch which pins I used for PWM to get around this. The more pins you use for PWM, the more this is likely to be a problem. Get XOD working with one motor and no extra delay nodes, etc. before you try to get all three motors working.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.