Page 1 of 1

Parametric Female/Female Pin Connector

Posted: Sat Feb 06, 2016 11:26 am
by charles.yates
So I'm trying to wire up some motors on to a 3D print, using an Arduino to control them.

I found that the driver boards for the motor (ULN2003) have male pins, and the only female connectors I had would have made the connecting wires way too long, so I figured I could just print some female/female connectors, connect those and shove in the male pins iyswim.

While knocking it up, I figured the same approach would work for the male GPIO pins on a Raspberry Pi, so I elected to go for a parametrisable approach - current state of play here:

It occurs to me that this could have some other uses for prototyping electronic stuff as shunting two wires into the holes gives a reasonably strong connection, and adding optional flanges could also allow these parts to be connected quite easily to more complex models.

Seemed like fun anyway :).

Also, wanted to give a shout out for openjscad :).

Re: Parametric Female/Female Pin Connector

Posted: Sat Feb 06, 2016 3:29 pm
by ednisley
charles.yates wrote:Note that the generated STL will need to be repaired using netfabb or similar for some slicers to handle.
If you make the holes slightly longer than the connector body to avoid the coincident faces, then the resulting STL should be manifold and won't require repair before using.

I haven't used OpenJSCAD, but I think this should do the deed:

Code: Select all

var hole = cube( { size: [ p.hole, p.length + 0.2, p.hole ] } );
obj = difference( obj, hole.translate( [ p.left + + hole_x * i, -0.1, + hole_z * j ] ) );
All my OpenSCAD models have an annoying Protrusion value that gets added & subtracted all over the place to make the answers come out right... [sigh]

Re: Parametric Female/Female Pin Connector

Posted: Sat Feb 06, 2016 5:04 pm
by charles.yates
Interesting, but the values given didn't fix it - still showing errors when loading in the netfabb version I have here. Tried a couple of variants with no success.

Would be nice to find a solution to that one for sure.

FWIW, you should be able to edit the code in place and re-run by pressing ctrl + return

Re: Parametric Female/Female Pin Connector

Posted: Sun Feb 07, 2016 1:32 am
by ednisley
charles.yates wrote:you should be able to edit the code in place
That's how I tried those values, but I couldn't figure out how to visualize the negative-space holes and I'm not surprised I got something wrong.

In OpenSCAD, a solid block with rows of holes punched completely through would definitely be manifold. I don't know what OJS could do under the covers to mess that up.

Re: Parametric Female/Female Pin Connector

Posted: Sun Feb 07, 2016 3:13 am
by jsc
It looks like any CSG operations generate non-manifold geometry. I tried commenting out the difference, getting a cube. That is fine. Then I tried a difference using Ed's suggested fixes; non-manifold edges (you can see them highlighted with the Repair menu in S3D). I turned the difference into a union, to verify that Ed's changes were doing the expected thing; it appears correct, but also gives non-manifold segments. I suspect some very minute coordinate errors introduced by JavaScript.

Re: Parametric Female/Female Pin Connector

Posted: Sun Feb 07, 2016 10:41 am
by charles.yates
Yeah, it's a curious one - I exported a simple 1x1 cube connector as ASCII, repaired that and exported as ASCII from netfabb.

There are quite some differences in the results - difficult to know whether some of the differences are just in the sort order, but the repaired model has many more vertexes (in this case, 32 in the original, 48 in the repaired).

Bit of a nuisance for sure :).

Re: Parametric Female/Female Pin Connector

Posted: Sun Feb 07, 2016 12:47 pm
by ednisley
charles.yates wrote:the repaired model has many more vertexes
Automated repair comes down to expecting The Algorithm to make a huge number of tiny decisions the same way you would, based only on a collection of triangles. Mostly, it works, but seems like a Bad Idea in general.

Some recent discussions on the OpenSCAD mailing list explored the deep geometric requirements behind what look like simple arithmetic; just representing coordinates with floating point numbers turns out to have terrible effects on the model's geometry that you'd (well, I'd) flat-out never expect.

Re: Parametric Female/Female Pin Connector

Posted: Sun Mar 06, 2016 5:12 pm
by charles.yates
I'm easily distracted me (easily amused too) - taking a break from making boxes, and revising this one for fun and giggles.

It occurred to that I can use this for solderless circuit building and having a bunch of about 100 microswitches (which were sent to me from banggood erroneously) and some lasers, I should be able to wire up a simple laser pointer.

So I printed up a 5 pin connector (the microswitch has 3 pins, but 5 with default settings gave a perfect fit), shoved a black wire and the blue wire from the laser into the same hole (earth), live into the middle and the red wire from the laser on the right, such that all the wires were poking out slightly at the bottom (bending them slightly and trimming them so they won't short), and the jacket of the wires are pulled in slightly at the top (giving enough friction to remain in place), and finally connected the switch - end result looks like:
2016-03-06 16.37.35.jpg
I used an additional connector (the white one) to make it easier to test this against a PP9 battery. Seems to work quite well - for this particular case, soldering may well have been easier, but I was mostly interested in this as a proof of concept. Suspect it should work with a regular 4 pin button too.

Next up is print a battery holder for 3 (or maybe 4) A76 batteries to see if that will power it and then see if I can put the whole thing into some kind of case.

Re: Parametric Female/Female Pin Connector

Posted: Mon Mar 07, 2016 12:18 am
by charles.yates
I just worked something out while looking at that last pic :D:
2016-03-07 00.15.47.jpg

Re: Parametric Female/Female Pin Connector

Posted: Thu Mar 17, 2016 2:45 pm
by charles.yates
Having learnt a bit from the above, I've extended the script to provide:

* a means to clamp a component (by adding clamping walls - you need to specifiy a non-zero length for them to become visible)
* added a means to cut holes on the sides to allow wires to be inserted such that they touch the pins on either side (check side holes)
* hosted on my own site
* worked around the need to repair the parts (I can't really say 'fixed' as the approach may break other stuff, but it appears to be working here at least).

New link here: ... main.jscad

And some of the others I'm messing with here: ... main.jscad ... main.jscad

The repair stuff was suggested by Andreas Thorn in this thread: ... o46LqcHhX3

Also hacked at a couple of pet hates in the UI - editor now invisible by default and instant update turned on.