Look, for a speed control, you could just add a potentiometer in series with the input voltage of the motor... hehe, this sounds stupid, but as soon as I figure out a 'mature' other way....
I believe a motor 540 is a standard RC car motor, the speed controllers used usually have a number of paralleled power FET's, used in a PWM configuration to control motor speed, and possibly a DPDT relay to reverse the motor. Considering the number of FET's required, and the small dimensions of commercial speed controllers, I wouldn't have thought it cost effective to build one yourself - just buy one, they are freely available at RC outlets.