The Coffee Cup Stirling Engine in a nutshell:MM-1 Stirling 

When the air inside the engine is warmed it expands and pushes up on the piston. Then when the air is cooled, it contracts and pulls down on the piston. 

Want more details? 
It's easiest to understand how the engine works when it is running on a cup of hot coffee. 

Inside the engine is a piece of canary yellow air filter foam. When the foam moves to the top of the engine, most of the air goes to the bottom where it is warmed by the hot aluminum plate. The plate of course was warmed by the hot coffee... 

The air then expands and pushes up on the piston. The piston pushes on the crankshaft which then rotates and lowers the foam to the bottom of the engine. Most of the air is now at the top of the engine which is at room temperature (the bottom of the engine is still at hot coffee temperature). 

When the air touches the cool aluminum plate (on top of the engine) it cools off and contracts. This pulls down on the piston which pulls down on the crankshaft and moves the foam to the top of the engine. The cycle then starts all over again.

 
 
 

 
Does it make sense yet? 
There are several things that make this hard to understand even when you are looking at an engine. First, the piston assembly is made of about eight tiny parts that don't look like a piston at all. It looks more like a grey synthetic rubber diaphragm. Next, the canary yellow foam that moves back and forth inside the cylinder looks like a piston but it really isn't. The yellow foam "displaces" the air (moves it) between the hot and cold sides of the engine. So the foam is called a displacer. The foam is also warmed and cooled very quickly as the air flows through and around it. 

Why are Stirling engines so efficient? 
When air flows from the bottom to the top of the engine it must flow through and around the foam air filter material. Since the air is a little bit hotter than the foam, thermal energy flows from the air into the foam and is "saved" for the next part of the cycle. 

This allows the air to cool much faster and means that less thermal energy will be wasted into the room. As the cycle continues, the foam moves through the air again giving the air back some of the thermal energy stored in the foam. This means that less thermal energy has to be absorbed from the cup of coffee to make the engine run. 

Regeneration... 
The process of saving some waste thermal energy from one cycle so it can be used in the next cycle is called regeneration. In the Coffee Cup engine the regenerator is a piece of yellow foam. In full power Stirling engines regenerators are often made of stainless steel wool. Regeneration is what makes the Stirling cycle the most efficient engine cycle in the world. 

If allowed, thermal energy naturally flows from a hotter object to a colder one. For example, If you put your hand in a bucket of ice water thermal energy flows from your hand into the water, and your hand feels cold. But if you put your hand in a bucket of hot water, thermal energy flows from the water into your hand and your hand feels warm.