A handy 3D script and guide to adjusting the parameters to make a custom tray to store your batteries or other cylindrical objects in a compact manner.
Openscad is a very interesting piece of open source software that lets you create 3D objects with a raw scripting language, allowing complex results from very tight code.
The openscad software can be downloaded here:-
https://openscad.org/
The script for this project is included at the bottom of this description. You literally just copy and paste it into the text box of openscad to adjust it as desired, and create your own custom STL file for your 3D printing system.
The six variables you can adjust are:-
Width - The number of battery cups wide.
Height - The number of battery cups high.
Depth - The depth of the battery cups.
Diameter - The internal diameter of the cups - slightly wider than your battery.
Thickness - The thickness of the cup walls.
Base - The thickness of the base.
When adjusting the values, be careful not to remove the "=" and ";" as they are part of the script.
To see your changes quickly, press the box with two arrows.
To build the final object press the box with an hourglass in it.
To save your custom STL file press STL. (After building with the hourglass button.)
The STL file can then be used with your preferred slicer (I use Cura) to make the gcode file for your choice of 3D printer.
I recommend making a single test cup (1X1) to test sizes before making a bigger tray of them.
You can also just choose a width and height of 1 to make a single large cup for other purposes.
If you enjoy these videos you can help support the channel with a dollar for coffee, cookies and random gadgets for disassembly at:-
http://www.bigclive.com/coffee.htm
This also keeps the channel independent of YouTube's advertising algorithms allowing it to be a bit more dangerous and naughty.
#ElectronicsCreators
Here's the openscad script. Copy and paste the text below into openscad to use it.
//Custom battery tray - bigclivedotcom
$fn=50;
//You can adjust these variables.
width=4; //number of horizontal cups
height=4; //number of vertical cups
depth=10; //internal depth of cups
diameter=15; //diameter of cylinder AA=15 AAA=11
thickness=1; //thickness of wall
base=1; //thickness of cup bases
//don't adjust stuff below here
columns=width-1;
rows=height-1;
wall=thickness*2;
dia=diameter+thickness;
cup=depth+base;
difference(){
union(){
//main body
for (x=[0:columns]){
for (y=[0:rows]){
translate([x*dia,y*dia,0])
cylinder(h=cup,d=diameter+wall);
}
}
}
//hollow cores
for (x=[0:columns]){
for (y=[0:rows]){
translate([x*dia,y*dia,base])
cylinder(h=cup,d=diameter);
}
}
}

This video is about these battery trays that you can make to order you just basically type in your sizes. It will print whatever you want, and this is a it's based on a script. I wrote that is included in the description down below and i originally featured it on big clive live the live stream channel, but thought it'd be quite good here for reference. If you've not seen the big clive live channel, it's not so technical, it's more relaxed! Uh.

Imagine a pub with us gathered round at that a table in it that's more or less what it's like, so don't go there with high expectations of quality. However, let me talk about this script. This is an 8x8 tray holds 64 double a cells. You can just go right into the middle, you can just grab one cell and pick out the middle.

It's very versatile and secure. It holds all the cells securely and stops them rolling about all over your bench. It also lets you keep them in order, so you could have the charge ones at the back or the uncharged ones at the front or have different colored trays for different charge. States uh.

It can be made to print any dimension of a number of cells and any diameter of cell, so it can be used for well any cylindrical object really. So i'm going to walk you through how to use the script and how to generate your stl files that you can then 3d print on your printer. So i'm just going to grab that script right now. One moment please so: here's what the script looks like and rather than trying a screen capture which is just not as convenient since i can actually doodling this and point to specific things.

I'm just going to show you off as a print off. So here is the what you're going to get in openscad now openscad is open source software, it's free to download it's a mathematical marvel and by using a text script you can specifically design things and allow computations uh so that it can actually create quite complex, multiple Dimensional arrays of things like this, so what you're going to do is you're going to copy and paste the text from the description down below and it will all be clearly marked out you're going to copy it into the design window of open scad. And when you do that, um you're going to be able to adjust several variables width in the case of this at set 5 is the number of cups. This way height is the number of cups that way depth is the actual depth of cups themselves.

Diameter is the internal diameter of these cups. That's the you just basically measure one of your batteries or whatever you're going to put into it and allow a slight margin, and - and that gives you the diameter thickness - is the thickness of the wall around that. In this case, it's set to one millimeter, which, to be honest in this case, is ample. If you had items that needed spaced a bit further apart, you could increase the thickness of the wall and it would keep them separate further apart from each other and the base.

Just because i could is the thickness of the plastic at the base here, underneath this uh tray, i just felt it was useful to have that as a separate variable once you've typed, those in uh noting be very careful because you're actually typing the code here. Be careful you don't delete the little uh semicolons here, they're quite important if you ever get a little red dot next to it, when you try uh rendering that it's usually because you've missed the semicolon. Just note that it's very easy to do that and you can only adjust these variables here - do not touch anything else. You will absolutely break it, but once you've done it, you've got a choice of some buttons up here or buttons down here.
If you look at the little box with the double arrow on it, the little double chevron that lets you get a quick preview of what you're going to get and then you can actually scroll and pan around this. It's good to play with that openscad. It's a very interesting piece of software once you've got it, how you like it press a little box with the hourglass on it and depending on the processing capability, your computer will take a while it'll render it out into the stl form. So it's going to take a wee bit longer, i'm using old, banger laptops.

It can take quite a while, but with a modern computer it should happen quite quickly. This is a fairly straightforward design. It's only when you get up to like eight by eight or bigger that it starts taking a bit longer, but you can try this see if you, you aren't quite sure of if it's going to be a fit or not, you can set this to width one And height one, and it will just simply make a single cup. Maybe you just want a single cup and that will just create that with appropriate sizes, and it lets you just try things for size, but once you've built it using the cube with the hourglass in it, and it takes that extra time and renders it in its Final form press the stl button and it will save it as an stl file then, and you can name it and uh.

Also, while you've got the usual controls, you can press the disk. If you just want to save your changes to this, and once you've got your stl file, put it into your preferred slicer for your 3d printer and you can then print off battery holders to your heart's content. Let me know if you found this useful. Let me know if you can think of improvements, so, to be honest, i think i've covered most things in this and yeah.

Let me know how you get on in the description. Well, in the comments down below.

14 thoughts on “Diy custom battery storage trays”
  1. Avataaar/Circle Created with python_avatars debeeriz says:

    would it be easy to have a hole in the base instead of drilling so you could weld tabs across positive and negative to make your own battery packs

  2. Avataaar/Circle Created with python_avatars Gary Calismax says:

    My "improvement" would be to have it double sided to then you could stack them if you have a lot of cells or limited room for storage other than that simple classic great design

  3. Avataaar/Circle Created with python_avatars hi-tech-guy-18 says:

    You should make a 3D Prated Auto Self Restocking Hopper box
    Batterys go into the top and roll dawn a few ramps to a collection Slot at the bottom that self restocks

    Bonus Points if You also Integrate a 4 ~ 8 ~16 Cell Smart Battery charger (ESP 8622 Based ) with display and mAH Tracking + RFiD NFC Data Storage so each cell records its ReCharge History + Ohms + time taken and update the TAG Data

  4. Avataaar/Circle Created with python_avatars Brigitte Coune says:

    A nice extra feature would be a small hole near the bottom of the cup to put a copper wire through. That way you can test the voltage of the cells in storage without getting them out.

  5. Avataaar/Circle Created with python_avatars Jason Kuehl says:

    I get the feeling Clive is like myself and 99% of what comes off his printer is something useful. I've never really used OpenSCAD, I prefer a drafting type CAD to a mathematical type, though. 😀

  6. Avataaar/Circle Created with python_avatars Tomd2008 says:

    Would using an isometric (triangular) pattern save more space?
    Would be interesting to see if an isometric pattern is stronger too
    e.g. how much it flexes when a full tray of batteries is picked up.

  7. Avataaar/Circle Created with python_avatars inc says:

    Obviously, there are similarities in this video, how you showcase and explain the code, to how you explain and trace out circuit boards, but you didn't go over the full code, which makes me question whether you've hidden the real secrets of circuit board design all these years 😀

  8. Avataaar/Circle Created with python_avatars bren160 says:

    Excellent Sir, most you find on thingi are not just right for what is needed for your particular use, and modifying a stl is not the easiest thing in the world when I'm still 90% Fusion360 clueless.

  9. Avataaar/Circle Created with python_avatars Tony Sheerness says:

    Once you have bought the 3d printer, mastered openscad, how expensive is it to make things as some objects can take hours to print I believe? How long does a spool of plastic last and how much waste does one get?

  10. Avataaar/Circle Created with python_avatars Kabral says:

    Thank you VERY much Clive. Will give a try once the Mrs. gives the green light on the printer.

  11. Avataaar/Circle Created with python_avatars FinalCPU says:

    It would take quite a bit more finagling but you could cut slots for nickel strips to spot weld in for a custom power cell for 18650s and print another to clip onto the other side.

  12. Avataaar/Circle Created with python_avatars Dennis says:

    Appears to be a simple task to add a small oblong hole for a peice of copper strip to enter each compartment to make battery holders to power projects with. Cable tie the whole thing together and solder a big BMS on the right copper lug and you have any capacity battery pack you want. You can design it around salvaged laptop batteries, especially as battery packs like that are usually have 1 or 2 bad cells and the whole pack is unable to take a charge to protect the rest from over charging them.

  13. Avataaar/Circle Created with python_avatars mortenmoulder says:

    For possibly faster print times, set the "thickness" variable to a number divisible by your extrusion width. For a 0.4 mm nozzle, 0.8 or 1.2 should be fine. If you pick 1, it might try to fill out a 0.2 mm gap, which isn't always going to look great.

  14. Avataaar/Circle Created with python_avatars RPDekka says:

    The only change I’d make is, if you want the batteries to have a snug fit, add a small hole to the bottom of each cup to allow airflow so they don’t get stuck.

Leave a Reply to hi-tech-guy-18 Cancel reply

Your email address will not be published. Required fields are marked *

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