The mechanical engineer Ma Jun ( 200 â `` 265 ) once used a waterwheel to power and operate a large mechanical puppet theater for Emperor Ming of Wei . The mechanical engineer Ma Jun ( c. 200 â `` 265 ) from Cao Wei once used a water wheel to power and operate a large mechanical puppet theater for the Emperor Ming of Wei ( r. 226-239 ) .