If I need to generate power at a specified frequency, then I need to make sure that the rotor of the generator rotates at a specified speed (rpm). But when I am rotating it with steam or water how do I control this speed? It seems to me that the mechanical forces that rotate the generator somehow has to balance to achieve this. How exactly is this done?
Some systems do this electrically. The generator either generates DC, or the variable-frequency AC is rectified to make DC, and then an inverter makes the desired AC frequency. Common on more modern small wind turbines.
Other systems are mechanically controlled to get the desired frequency. The mechanism used would be called a governor. Most simple mechanical governors are not very accurate, so this would not be good enough for a grid connected device. It is also possible to make more accurate governors which work mechanically in a similar way to the paragraph below, these are commonly used on internal combustion engines.
Another approach, and probably the most common is to have some form of feedback. A microcontroller monitors the frequency being generated, and adjusts the mechanical system via some form of servo to get the right frequency. For example, it could open and close a sluice gate to adjust the water flow through a turbine. A more complicated system could adjust both a sluice gate and the turbine blades to keep the correct frequency while also varying the output power.
Grid Synchronous operation
In some cases, it might not be necessary at all. If you have a small wind turbine, connected to the mains grid near a coal power station, you could just hook it up and forget about it. The huge turbines in the power station will stabilise the grid frequency, and fix the rotation speed of the wind turbine. If the wind blows harder, you'll just get more current, and a slight power factor shift. Note that as more and more wind turbines get added, the folks who run the power station will get less and less happy about this, so the grid operator will eventually ban it.
If I need to generate power at a specified frequency, then I need to make sure that the rotor of the generator rotates at a specified speed (rpm).
No, that is not necessarily true. A lot of wind generators use a doubly fed induction generator (DFIG) and that can regulate frequency by controlling the rotor winding: -
They can convert power at one frequency to another frequency i.e. they can produce 50/60 Hz even though the rotor may be running too slowly. This is done by injection of an AC current into the rotor coils. The control system that acheives this may also be able to alter pitch angle of the turbine as another means of increasing or decreasing mechanical rotation speed.
For more information please read this EE answer.
But when I am rotating it with steam or water how do I control this speed?
There can be situations when there is too much rotational speed and although the DFIG can deal with this it is best to have a combined approach such as the pitch angle control shown in the above picture.
However, the inevitable bottom line is that if you have a plentiful source of mechanical energy and very little load demand at that moment, then you have to un-hook the generator from the grid. If you don't "have" a grid, then you have to have a back-up supply that can supply the low power demand and this usually means a diesel generator or solar power via an inverter.
That is what a governor is for.
The mechanical version is a device that will use centrifugal force or a blower to actuate the throttle/intake to slow down the engine when the speed climbs too much.
You can make it electronic with an RPM sensor and a electronically controlled throttle/intake.
In my (limited) experience of generator design, you have to look at multiple factors:
Speed of mechanical input (turbine, wheel etc)
Power of mechanical input
Output power (which depends on voltage and current, but you usually want to maximise this, at a peak power point)
In many cases what you want to maintain is a constant voltage output, which will vary with the electrical load; higher current would make the output drop.
In your set up, you only care about the speed of the shaft (for whatever reason that is). There are two ways to do this: control input power or control output power.
If you know that your mechanical power will always be more than the output power, you could use a governor or similar, which will limit the shaft power to keep the speed constant. This will control the input power in a simple manner.
If you can't guarantee that your mechanical input is higher, you'll need to limit your output power in some way. I have done it where we controlled the output current via a PID feedback controller to keep the shaft speed at fixed values. But that was in a DC system, where we had a large battery to push the current into during high supply times, and draw from during lower supply times.
This isn't the way it is done, but it's a way it could be done: vary the load in order to modulate the speed.
You can imagine a (potentially very large) auxiliary load bank in addition to the normal load, with the input power source sized so that it will provide at least enough power for the normal load under all conditions. This isn't completely unthinkable for hydro setups, since the head is the usual determinant. Then, as the load and the input vary, the auxilliary bank is controlled so that the total demand on the generator produces mechanical loading on the input which maintains the output frequency at the desired point.
And no, this isn't a serious suggestion, but it could be done.