Designing the battery compartment:
A template with all the pieces for an AAA battery holder.
An AA battery holder.
The laser cut files for an enclosure:
How the battery compartment looks like
A hex nut piece was used as the first one to allow a small piece of plastic to keep the screws captive in the lid. The actual hex nut is sandwiched further down the stack in between two pieces with small holes.
coupled with a 9V plug, a device can be powered by the built in bateries or an external 9V battery.
A two way power switch selects between the internal and external power sources. Selecting the external source when there is nothing connected or the internal source when the battery box is empty turns off the machine.
Download the design files here: