First, let's get this out of the way:
If I supply a constant 5 V to the PWM input of a motor, it would act like PWM with 100% duty (full speed). If this is the case, would I be able to supply 2.5 V to the PWM input to achieve half speed?
Nope. Your motor will interpret the 2.5V on PWM input as a logic '1' and run at 100%
The gear motor you show is a 5-wire type, with a setup similar to a 4-wire PC fan but with an additional direction signal. As such it includes a tachometer output and a logic-level PWM input. 4-wire fans that follow the Intel spec state that PWM '0' is < 0.6V (note also this pin is pulled up internally at the motor to 5V - beware.)
Applying 2.5V to PWM will be interpreted as logic ‘1’, so like the PC fan your motor will be at 100%.
So that’s a nonstarter.
More about 4-wire fans (motor likely follows this spec) here: https://www.electroschematics.com/4-wire-pc-fan/
The right way to control this motor is in fact to use its rated DC voltage (12V), then apply a PWM signal to the PWM line to set its speed. 50% PWM (generated with a 555, say) will give you something in between 0 and 100% of full speed, but not exactly, you will need to adjust your PWM to achieve your target speed.
Related: DC motor speed vs PWM duty cycle
PWM control for 4-wire fan using a 555: 12V to 5V regulator for PWM fan controller
Let’s say you’re stuck with this motor (why?), have to make it work, and you need consistent, repeatable speed. Let’s consider a couple of options.
- Try to run the motor on variable DC
- Use fixed DC, and convert the variable DC to PWM
Option 1 has an issue: with any BLDC (or for that matter, any motor) it’s not a given that you can linearly reduce voltage and get a corresponding linear reduction in speed. With the BLDC there will be some voltage at which the motor ‘drops out’, depending on the controller. In my experience with 2-wire BLDC 12V fans that's roughly 6-8V.
But here, this motor is a 4-wire (+ direction) type. It assumes a constant, unmodulated 12V DC supply. On this motor type the PWM chop is applied internally only the coil voltage, not the controller.
Check the data sheet, but it likely needs 12V +/-10% (like a PC fan), so will be even less tolerant of jacking the DC voltage than a 3-wire or 2-wire BLDC type.
In other words, varying DC the rail just isn’t how this 4-wire motor is designed to work.
Again, for this motor, this is also a nonstarter.
Option 2 requires that you supply a constant 12V DC voltage to the motor, use some kind of voltage-to-PWM conversion to drive the PWM chop. There’s lots of ways to do this; many involve using a 555 timer IC.
But let's go a step further. I’m going to infer that you actually care about the speed because you chose a tachometer motor and have DC speed control from your host. So you probably want it to be closed-loop, right?
To achieve a repeatable target speed I recommend using a microcontroller to read the DC voltage, convert that to PWM, then monitor the tach signal on the microcontroller locally to close the loop. Then you have a linear DC to speed control, regardless of load conditions or motor nonlinearities. You have to do a bit of software on something like an ATTiny, but it will work well with less loading on your host.
This gives an example of DC to PWM with ATTiny: https://www.engineersgarage.com/tutorial-7-dc-motor-speed-control-using-attiny85/
Cheap-and-cheerful, look up any of the myriad voltage to PWM designs, then use your host to monitor the tach signal. This adds more load on the host since it now has to dynamically adjust the DC voltage using a control loop.
Another thought: change your gear ratio.