I'm working on a 2-wheeled robot and have connected up a raspberry pi to an L298N motor driver.
I'm sending the enable pin of a particular motor a software-generated PWM signal at 100Hz with a 50% duty cycle. I observe with an osciloscope:
- a fairly clean square wave going into the enable pin as expected.
- a fairly dirty square wave across the output motor terminals.
The motor turns at about 50% speed/torque as expected.
I find myself wondering if it would be better to control the speed of the motor by placing a flat lower constant voltage across its terminals, rather than oscillating a square wave. ie to do 50% speed/torque - instead of oscilating between 0V and 5V - just put a constant 2.5V across the motor terminals. I wonder if the oscillation is a waste of power/energy.
Is this true? Or doesn't it make any difference? Do high-end motor drivers use a variable flat analog voltage to control speed/torque, or do they use a PWM? If a PWM, does the frequency make any difference?