DIN Rails For… Everything

Cross-section of a 35mm top hat DIN rail.

One of the great things about the Internet is it lets people find out what other people are doing even if they normally wouldn’t have much exposure to each other. For example, in some businesses DIN rails are a part of everyday life. But for a long time, they were not very common in hobby electronics. Although rails are cheap, boxes for rails aren’t always easy or cheap to obtain, but 3D printing offers a solution for that.

So while the industrial world has been using these handy rails for decades, we are starting to see hobby projects incorporate them more often and people like [Makers Mashup] are discovering them and finding ways to use them in projects and demonstrating them in this video, also embedded below.

If you haven’t encountered them yet, DIN rails are a strip of metal, bent into a particular shape with the purpose of mounting equipment like circuit breakers. A typical rail is 35 mm wide and has a hat-like cross-section which leads to the name “top hat” rail. A 25 mm channel lets you hide wiring and the surface has holes to allow you to mount the rail to a wall or a cabinet. These are sometimes called type O or type Ω rails or sections.

There are other profiles, too. A C-rail is shaped like a letter C and you can guess what a G section looks like, too. Rails do come in different heights, as well, but the 35 mm is overwhelmingly common. However, there are 15 mm rails and 75 mm rails, too.

A device attached to a DIN rail.

Devices clamp against the “brim” of the top hat while the top of the hat is affixed to the wall or bulkhead. You’ll sometimes hear the width of a rail expressed in “modules.” A module is 17.5 mm wide, so a three-module device is 52.5 mm wide.

The DIN rail originated in Germany around 1928, with modern versions dating from the 1950s and in some environments they are everywhere. DIN, by the way, is an acronym for the originating German standards organization Deutsches Institut für Normung, but the rails also meet IEC and EN standards, today.

If you want to know more about DIN rails, we’ve looked at them in-depth. Combine them with off-the-shelf extrusions and 3D printing and you can make a variety of very sturdy structures.

58 thoughts on “DIN Rails For… Everything

  1. Actually the channel isn’t very convenient for hiding wires because there is no leeway left for unmouting equipment. Professional modules (in Europe we use DIN rails in electrical switchboards (is that how you call the boxes with fuses switches and RCDs?)) have terminals on the top and bottom. BTW, look for modular din rail enclosures and you will find plenty and cheap.

    1. Was gonna say something similar:

      > A 25 mm channel lets you hide wiring

      Uh no… you don’t want to put wiring inside that channel. Some Modules have some stuff extending into that space (I think) and the flexibility of a rail diminishes when you force yourself to leave room in the middle between neighboring modules because some wires exit the channel there.

      What might be nice are bus bars with a control bus on it (i²c ?) inside the rail. Modules could automatically connect to that control bus when attached to that DIN rail.

      1. So two small gold plated copper strips that the modules connect to with pogo pins?
        While we’re at it, why not attach the din rail itself to earth and have the devices ground to that?

      2. If you won’t be using any modules that extend into that space I doubt that would be a problem. You’re assuming everyone who is using a din rail in their hack job is using it for your presumed purpose. Let’s be a little more creative and less prescriptive.

  2. Pro tip: Don’t buy the flimsy extruded aluminum DIN rail (the stuff in the video) from the usual China shops. Go to your local electrical supply house instead for cheaper and stronger steel (the yellow looking stuff in the still pic).

      1. Not really IMHO. It’s not hardened steel, you can cut it easily with a hacksaw. Yes it takes longer than aluminum, but if it is going to make a difference, than you are building something big and you should probably think about proper tools like angle grinder.

    1. Depends on your use case, but aluminum DIN rail is commonly used in industry, If you are using it correctly it is not considered “flimsy”. Remember its used to hold terminals, relays, small PLCs, etc. It’s not supposed to be structural. If you want a good structure, try Unistrut or similar strut channel.

  3. Congratulations, now that you Americans found our great German DIN rails, why don’t you take the next obvious step and switch to the metric system? Come on, I know you can do it!

    1. We had a chance to switch to Metric is the ’70’s, Even passed a Federal law saying we were gunna do it.. Old habits die hard..
      I still have Machine Tools and Equipment I’ve gotten from My Family of Blacksmiths of the Steam and Gasoline Days.. Unfortunately the Stuff still works and I use it today.. Really hard to cut Metric Threads on an Inch Lathe..

    2. For as much as I’d like to, it is not going to happen anytime soon. Straight out of Wikipedia:

      “…Although U.S. customary units have been defined in terms of metric units since the 19th century, as of 2021 the United States … have not officially adopted the metric system as the primary means of weights and measures.

      *The United States has official legislation for metrication*; however, *conversion was not mandatory* and many industries chose not to convert, and unlike other countries, there is no governmental or major social desire to implement further metrication…”

      In other words, we’re too lazy and can’t be bothered to.

      1. It’s not lazy, it’s a real problem. As @Cap says, “hard to cut metric threads on an inch lathe”. Imagine replacing all machine tools in an industrial nation the size of the US, and doing so at once so that spares can be made, tolerances can be met, etc. That’s a monumental investment, and for little, but not negligible, gain.

        I do see the eventual CNCification of machines pushing the US into a direction where the units simply don’t matter, and so maybe that’s the way it’s going to happen. With computer control, it really is just a matter of flipping the metric/imperial bit in EEPROM and then remembering to convert all of the upstream design work.

        If you’ve ever reached for a 6 mm wrench only to find that it’s 1/4 in, or vice-versa, you know that this is a real hard(ware) problem.

        1. Sure, threads. How about weight? Volume? The last time I bough a pound of something the container already had 454g right next to the 1 pound marking on the package. Just get rid of the 1lb? What about mile markings on odometers? Km are already there, just stop putting miles in there?

          It’s laziness. Maybe not just laziness, but laziness for sure.

    3. If we are going to metric we should go all the way… Metric Time and a Metric Calendar… Time units include millicenton (approximately equivalent to one second), centon (minute), centar (hour), cycle (day), secton (week), sectar (month), quatron (unknown, perhaps a 25 centar day or maybe 1/4 yahren), yahren (Colonial year), centuron (Colonial century)…. Battlestar Galactica

      1. The French tried metric time for a couple of years. Guessing it wasn’t popular as it was dropped whilst all other form of weights and measures were switched to metric.

  4. If you’ve got a choice, buy the aluminum. Much easier to cut if all you’ve got is a hacksaw. I’ve designed PCBs to use the readily available clips he mentions in the video; this month I did my first design intended for the board carriers. CZH-LABS has them in different sizes https://czh-labs.com/collections/din-rail-housing-bracket-742 or you can buy them by the half meter on eBay/aliexpress. Looks like Adafruit has added several DIN rail items to their catalog including a raspberry pi mount https://www.adafruit.com/product/4557

  5. Please. Don´t abuse DIN rails for hiding cables. I know, I know you guys over the ocean have no idea how to correctly build a Stromkasten (90% of any American household electric wiring would not pass the mandatory inspection here), but using the grove of the DIN rail to pass cables is pure horror und absolut nicht fachgerecht. Dummamis.

    1. Luckily we’re not in the home wiring inspection passing business. I can imagine there are plenty of ways German homes wouldn’t pass any inspections in countries with different rules. That isn’t much of a bar to worry about.

      1. Comments like that are why people in the rest of the world facepalm after hearing American comments. ‘Rok’ is totally correct. America loves to project a #1 attitude where all things don’t need to be paid attention to, but in worldwide rankings, America only makes it to #23 for education and #37 for healthcare, which is a long way from #1. The rest of the world understand this.

        1. So you agree that if we don’t use a din rail exactly the way Rok wants us to, it’s wrong. I see. Not much of a hacker, are you? The heart of hacking is using things in ways they were not intended. Rok and you apparently don’t have a creative bone in your body. Follow the rules! Why? Because they’re the rules! Oh, right… I guess I’ll put my soldering iron down. (facepalm)

          1. It’s just cultural differences. I once asked a German guy if he would consider crossing a street at red lights if there were no cars on that street.

            He got vocally angry at me over the prospect, and reasoned that children might see you doing it and it would set a bad example. Of what? Being sensible? Recognizing that rules do not always apply when there is no need for such rules? Moral of the story, if a German dude knows what’s right IT IS ZE RIGHT THING TO DO and no arguments.

      2. Come on, being German myself I always cringe hard at those comments like from Rok in the first place.
        It’s just arrogant behavior. You can tell somebody he’s doing something not as “planned by the inventor” in a non-arrogant nice way, too.

        I really h**e this “nation against nation” BS…

      3. You have to understand that electric wiring is Serious Business ™ over here in Germany. If you tell some electrician that you even just CONSIDER to work on the wiring in our own house(!) they get angry. These folks are annoying af. Because they know beforehhand that you won’t do it “fachgerecht”: m-( Also there are a ton of regulations regarding this business which are in fact just rules to keep the monopoly for electrical wiring and maintenance in place. And that’s why they are so angry. They are afraid to lose their busines.

    2. Dude, are you certain you want to compare NFPA70/79 and ANSI 508x with IEC60384/60204 and IEC pub 204-1? And do not get me started on the dumpster fire (pun intended) that is the IEC60947 series of standards.

      Installations per IEC standards would be considered a freaking fire hazard in North America.

      Most of my family still resides in the ‘old country’, and am professionally familiar with global product compliance. I remain amazed and dumbfounded at the insular attitude, ignorance, and insouciance of the European engineers I deal with on a daily basis.

      1. I’m based in the UK but do electrical designs for machine tools that export globally, the NEC is in my experience quite a rigorous set of standards, often it goes beyond the equivalent EU standards (sometimes too far in my opinion) however as I understand it is a voluntary set of regulations that gets in to a whole mess when it comes to whether a particular state has adopted it, what version they have adopted and how it’s enforced. We have sold many machines into the US market that are just built to ISO/EU standards even though we offer full NFPA and UL508A designs if the customer wishes.

        1. Your understanding is not correct. Workplace equipment falls under OSHA regulations (29CFR1910) and must have NRTL certification and must be installed per AHJ requirements (typically based on current or last two versions of the NEC). Insurance companies routinely abandon clients where equipment does not meet code and scoped safety standards.

          As of yesterday, I can talk about a completed forensic fire investigation where a company used a metal brake “certified” per EN (harmonized IEC) standards and EU code. The control panel, the equipment, and the installation did not meet the scoped North American regulations/standards/building code. The fire put several people in the hospital and the building is a loss. Their underwriter will not offer any coverage, and have been told that the company owner is going after the German vendor’s U.S. sales rep. Good luck with that.

          FWIW, the brake had a declaration of conformity (‘CE’) and TRF, CB report, VDE and BSI certification and is yet another example of poor EU design discipline.

  6. Generally the rail isn’t intended for channeling or running wire through however it is an option. PVC channels with slots and removable covers are much more adept for running the wires and since most DIN mount objects have the connections above or below the rail, and putting objects on the rail is almost always done to make swap out easy and get lots of circuits and accessories in close to each other you wind up with a lot of wires going a lot of places with organization, it makes more sense to not route wires in the channels. I found DIN nice for larger projects such as control panels for high tech stuff like wind turbine controls and production, HMI at large scale. It makes things easy to modify as the project goes in development when you figure out relocating various components works out slightly different better then originally planned. As for buss bars, it’s better if those are placed elsewhere too. Like one fellow stated, it makes for a problem mounting certain rail components and having to have wires going in between components can be counterproductive when it comes to making most efficient use of rail space.

    1. I share your sentiment… although I suspect that my mistrust and ire towards those panels was half caused by DIN rails, and half caused by the horrid plastic wire management that surrounded the DIN rails.

      Once you had everything mounted properly I definitely saw the merits of DIN rails with their easy to follow cabling and convenient test points for everything…
      …I always seemed to have to find a way to mount non-DIN hardware to the rails though due to one customer or another, and it blew the whole clean and convenient idea right out of the water.

      Near the end of that career path I just started requesting my own electrical cabinet mounted beside the control panel to hide my non-standard radio, control, and power equipment away in its own dimly lit shame.

    1. Does hacking require real world work with anything? Cause then I’m hacking wrong. Am I limited to using things only for it’s originally intended purpose? Then we’re all hacking wrong.

  7. For those who prefer laser cut enclosures I made a DIN rail box generator last year: https://festi.info/boxes.py/DinRailBox?language=en
    It’s not super well tested as we only did a few boxes for some hacker space infrastructure and it still misses pictures and assembling instructions. Otoh it is just a box with a latch at the bottom and a lid. May be some of you can figure out how it fits together without written instructions and a flashlight.

    1. To be fair, the article says the rail is for hiding wiring. It isn’t. If you want to do something that will sit on ‘a’ DIN rail, then you need to be aware of that.

      If you want to use a DIN rail for mounting your own stuff, then have at it. If you want to use it as a source of pre-formed metal that you’re going to use as a nosepick, then have at it…

  8. Just started a project where I was allowed to specify DIN rail in the enclosure and use DIN rail housings and clips. It’s soooo tidy.

    I’m also using the simple clips with three holes (usually for bare PCBs) as supports for 50mm standoffs. This means I can ‘float’ a front panel above the electronics.

    1. Let’s not forget the Decabet. Among other simplifications L, M, N, and O are combined to form a single letter, which incidentally is a real boon for those who thought LMNO was one letter already.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.