AC (alternating current) can be converted to DC (direct current) by using what is known as a rectifier. WARNING - do not ever attempt to convert mains power - buy a safe and suitable adaptor if this is needed!!

This is safe at low voltages. The clocked output of a Lego RCX was more useful if converted to DC.

The simplest one is to have a diode in series with the supply - which will give a half rectified wave - it simply clips the bottom half of a sine wave leaving only the peaks.

By putting a capacitor in parallel with this - between the diode output and the ground, you start to get a smoother wave form with much shallower dips.

The conventional way of doing this is to use a Diode Bridge - consisting of four diodes, two inputs and two outputs. If you denote one output as positive, and one as negative - as you would expect in DC, then you have one diode from each of the inputs feeding towards the positive, and one diode leading to each of the inputs feeding away from the negative. Placing the capacitor in parallel with give a fairly constant and smooth DC output.