I wanted a way to mount my Makita DC18RC charger on my 1-inch metal pegboard, and after much head scratching and false starts, this set of parts is what I've come up with. It's mainly based around 6x3mm neodymium magnets, these are commonly available and I will put a couple of links at the end to a few places selling them. There is a video about this set along with some other 3D printed Makita accessories.
The first part is a replacement for the rubber foot on the base of the charger. This holds the magnet on the charger side. I used self-tapping computer case fan screws as I have a large supply of those and designed the part around them, they are officially M5x10mm and are also commonly available. The screws cause the plastic to expand out and hold the part in place. A magnet is then glued in to the foot. At this point the polarity of the magnet isn't important, this will be confirmed when gluing the magnet in to the base part. I used regular superglue and this worked fine. The foot part has two flattened sides, this is to allow you to grab it with an adjustable wrench or pliers when driving in the self-tapping screw.
There are four bases with cups to accept these feet, app with specific locations in the names. There are also identifying marks on each, with one dot indicating that this side should be facing the centre horizontally and two dots indicating that the side should be facing inwards vertically. It's important to get these right as the foot cups aren't central in the part and the bottom-right part is totally different to account for that foot on the charger being offset. The magnets should be glued in to the centre recess, taking care to ensure that the magnet is the right way up. I found attaching the magnet to its counterpart on the charger, then applying glue and pressing the base part on was the bast way to do this and ensures that the magnet goes in straight. Check the fit of the foot and the magnet in the cup before you do this!
The base parts are then attached to the pegboard, I used plastic trim rivets and 8 x 1/2" pan head screws as these fit nicely. The part is designed with enough clearance for the head of the rivet, however printer tolerances might mean some minor filing is required. The rivets are expanded by the screws and anchor the part in place. I have a thin metal pegboard and these work fine, they should still work with slightly thicker wood or fibreboard pegboards but I don't have any to test with.
With the four feet and good magnets this may be enough to safely hold the charger, however the strength of magnets will vary and in my case there was a chance that the charger would be knocked so I made a final centre part that houses two more magnets. With the charger sat on the pegboard this part will allow a small gap between the magnets and the back of the charger, enough for a thin metal plate commonly supplied with magnetic phone mounts. That's where mine came from. Thicknesses of plate will vary, I had to sand this part down slightly for the charger to sit in the four cups correctly.
The charger should now attach solidly to the magnets and you should be able to add and remove a battery without any risk of it falling. I currently only have 4Ah Makita batteries, according to the Makita website though the 5 and 6Ah batteries weight the same amount.