In my project I am using a DC motor as a generator to charge a 12V battery.
I want to be able to control the load torque on the generator, as it is rotating, by controlling the charging current into the battery.
My understanding is that the charging current could be varied by switching a MOSFET using PWM from the Arduino.
I guess what would essentially be happening is that the switching varies the electrical load seen by the generator.
Am I right in assuming this can be done and the MOSFET and PWM is the right way to do it? If so, can I have a suggestion as to what the electrical circuit should look like: e.g. do I need more components, how would the MOSFET be wired etc.?
PWM is a digital way to convey an analog value of between zero and one hundred percent, no more and no less. The PWM signal is either full on (high) or full off (low) at any time. 20 percent time high is 20%. It is a digital not an analog signal.
You should be using a charger specifically designed for the type of battery you are using. Use one that allows you to vary the charging current.
Applying the output of a generator directly to a battery is not a good idea.
Assuming you have a charge controller as you claim then all you need to do is change the charge controller charging current.
A lower current will reduce the load.
Does the motor, which you are using as a generator, have field coils or does it use permanent magnets? I suggest if field coils then you need to control the field current.
I think of the defining characteristic is that it has a permanent magnet rotor. You might have to disconnect some of the control circuitry but it should work as a generator.