PVC electrical tube D20mm
plastic pipe end plug/cap(floor protection pads for forniture metal legs )
a couple of bolts(in my case M5)
a couple of nuts with the same thread as the bolts
again a couple of additional nuts(better if wingnut) to hold the wire/connector
a helical compression spring
a washer(needed to allow the bolt, that has the head smaller than the spring coil, to hold the spring in place)
1) drill holes in the center of the plugs/caps (some models may already be sold with a hole).
A- Sping Side Cap
2)cut the washer and twist like a helix(turning in the same way as spring coil)it to obtain something similar to a lock washer
3)insert the cut washer in the spring from the side 1 coil far from the end.
4)insert the bolt and let it run trough the spring and the washer, then insert it trough the hole in the plastic plug.
5)screw the nut on the other side(the external side) of the plastic plug
B- Springless Side Cap
6) just insert the bolt trough the hole(with the head in the inner side) and screw the nut on the external side
7) Measure the length of the number of AA batteries you want to place in
the holder, plus the length of the caps/plugs entering the tube consiering of course also the length of the spring(unloaded).
8) reduce the measured length in order to give the spring a suitable compression. I can't tell you how much you have to reduce the length of the pipe because it depends on the spring rigidity and length.
(too much and the force may be able to snap the caps of the tube, not enough and the electrical contact may be unfirm/unsteady especially if the holder will be used dynamically). then cut the pvc tube at the desired length(the "reduced").
9)place the springed plug in the tube, then from the other end insert all the batteries and finally the springless plug.
10) finally you can place the connectors or wires and screw the wing nuts.
This battery holder can also be held in place by plastic pipe clamp/clips and removed and replaced fastly
Removing the excess diameter of the end plugs this battery holder can also be inserted into regular connectors for this kind of tubing including (straight, 45° and 90° bends, tees, cross, and tube-box connectors, etc) some avaiable also in waterproof/watertight version (a standard called IP65)