Regulating voltage and PWM

I have a project where I control a small DC motor and I am powering the motor with a 9 volt battery. Now I want to regulate the external power source (9Volt battery) using an adjustable linear voltage regulator to a constant voltage say 8 volts. And then I want to control the speed of the motor from the computer using PWM. Since according to my limited knowledge, PWM doesn’t maintain a “constant” speed for my motor as the battery voltage decreases.

Is this viable? Or is there a better way to do this?

You should provide feedback from the motor using an encoder of some kind. Read the actual speed from the encoder, and adjust the pwm up or down.

You could, for instance, have a tiny magnet passing a Hall effect sensor, and the frequency of the pulses will give yoou the speed.

You are correct. PWM gives you a percentage of the supply voltage, so the motor will slow-down if the battery voltage drops to the point where the 8V regulator drops-out of regulation.

I think you'd have to build a feedback system that reads the (filtered) PWM voltage and adjusts the PWM to hit your target. (Basically like a software-controlled switching voltage regulator.)

That was actually my first idea. I thought of using a slot type photo interrupter to get a reading of RPM and then using some control loop to maintain the RPM at a set level. Might be a little complicated.

However, I've built a circuit right now that uses an adjustable linear voltage regulator and I've connected that to a MOSFET but the problem is, the motor isn't working. I'm thinking that I'm not getting a "clean" signal per say from someone in my circuit.

The voltage will drop and the current will too.

The hall sensor is a good way to maintain speed, since you have feedback as suggested.

A 9v battery sucks, simply not enough current, swap to say aa batteries then you have the option of using a boost circuit snd step up from say 3v (2aa in series) to 9v, vastly superior runtime.

A linear voltage regulator will not maintain a constant speed either, under load.

You actually do need to use PWM, where you measure the voltage from the motor during the period the "pulse" is turned off, which voltage is proportional to the motor speed and which you then use to control the PWM.

That's how the better motor speed controllers work!

HI, to help with and suggest options and modifications, can you post a copy of the circuit you have at the moment that doesn't appear to work.

That way it will make it easier to help you.

Tom.... :)