There are plenty of homebrew Lego sensors and motors floating around, but most use a bisected Lego electric cable or an increasingly sparse electric plates with wire soldered to the bottom.
I, on the other hand, wanted a connector that did not use a preexisting Lego electrical connector. I found a nice (discontinued?) female connector, for the longest time I thought female would be easy to make but then it hit me. Metal studs.
I did find a nice female at http://robotics.benedettelli.com/attachment.htm, but I wanted male For in Brick use
They are unbelievably simple and easy to make, and a large number of Lego electric bricks use male connectors.
I know with the NXT the RCX legacy connectors are all but obsolete, but I prefer them. They look more Lego and are on the RCX, Scout, Code Pilot, Cybermaster, Technic Control Center, Dacta Serial Computer Interface and the 9V train system.
(It is weird a Danish company fits SAE measure better than metric (4.85mm), but it does so I will use only SAE)
3/16 metal rod (I used zinc plated for a good appearance)
A brick that fits the connector or can contain electronics you wish to hook up.
I mainly used 2x4 stud megablocks due to the fact I do not wish to drill into my Legos
Step 1: Pick a Brick
I used 2x4’s because that is all I really had and they work for most simple sensors and converters.
The brick should have at least a 2x2 section of studs if you want a fully rotatable connection (can clip on at any 90 angle) but a 1x2 can be made to work (like the lamp brick).
Of course a 2x2 flat would make a nice standard cable terminal.