I want to build a model of a complex machine with Lego and Arduino or a Raspberry. The machine model also features several accessories that can be added or removed during operation of the machine which influences its behavior. I plan to glue together the accessory bricks. My goal is to detect if that accessory is present on the machine or not.

Are there any standard bricks with contacts built-in, or do I have to make them myself somehow? (NFC/RFID would also work but the simplest solution will do it)

3 Answers 3


I'll suggest going the Arduino way and relying on magnetic contact switches - fairly inexpensive, and invisible once embedded in a build.

Another commonly used trick is using an ultrasound distance sensor on the receptacle - the distance will be (near) zero if there's anything attached.

Are there any standard bricks with contacts built-in[?]

Yes - the 9V system which started in the late 80s featured 2x2 plates with conductive metal inserts, e.g. part 5306bc011 "Electric, Wire with Brick 2 x 2 x 2/3 Pair, 11 Studs Long" (besides battery packs, train motors and lights):

9V wire with connector plates

Note that:

  • Each wire is connected to both two studs on the top and two antistuds on the bottom, and
  • 9V-compatible parts are not being manufactured anymore, and therefore are only available in the aftermarket
  • Any 9V parts in the aftermarket are at least a decade old, and cables are subject to wear&tear.

Since you are not afraid of using glue, and if you're keen on going the "closing an electric circuit" route, you might instead want to use copper foil tape (which should be readily available at crafts stores), or even conductive ink.

Finally, if you want an unconventional approach with contemporary available parts, you can always use Mario pants.

  • 2
    This is where the "Mario pants technique" was invented. I'm proud to be a witness. :)
    – chicks
    Commented Jan 24, 2023 at 17:14
  • 3
    There were also non-train 9V parts with contact bricks. I have a couple of steady/flashing lights (cleverly, depending which way round you attach them), a siren, and a battery box, plus the bricks. (Late 80s I'd guess). More recently there are Technic sets with wires that use bricks as plugs. We have 42095 for example, and I know there are other more complex uses
    – Chris H
    Commented Jan 24, 2023 at 21:05
  • 3
    Worth mentioning that the 9V wires are also very prone to literally falling apart. The majority of wires on bricklink suffer from deteriorating rubber coatings, to the point where slightly bending the wire is enough for the rubber to chip completely off.
    – Tuzi
    Commented Jan 25, 2023 at 10:09
  • I added some of that into the answer. To be fair, OP asked if there are any parts at all, but didn't ask about the reliability of said parts :-D Commented Jan 25, 2023 at 10:38
  • 1
    Thanks for your comprehensive help! I will try to start with foil tape or magnetic switches.
    – Norbert
    Commented Jan 30, 2023 at 15:14

LEGO Dimensions had NFC tags in the round bases, e.g. part 18602c01 "Dimensions Toy Tag 4 x 4 x 2/3, generic":

round plate with NFC tag

These can be integrated into the accessories. The tag, and therefore the accessory, can be identified using a 3rd party NFC reader.


If you wanted an entirely Lego based solution, Lego Boost has a colour sensor part 6182145 that can detect colour and is, I think, compatible with the EV3 Mindstorms sets controller as well as the Boost controller. The EV3 apparently also has a colour sensor (and an IR sensor) in the basic kit, but I've not used them. I don't know if any of these are compatible with devices like the Arduino (depends on the connectors I would think), but it looks like a modified ethernet-style port for the I/O. You could potentially daisy-chain a Pi and the mindstorms hub, using the Pi to program the mindstorm.

If you have colour coded accessories, these options could tell you if they are present and which ones are present.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.