Printing Braille labels via OpenSCAD

Saturday night saw me flashing my latest 3D print at a party - is this a new breed of party bore? However my heart-shaped box was admired and got people thing about the possibilities of 3D printing. One friend thought of two project for the visually-impaired: Braille labels and raised contour maps. 

There is a surface() function in openscad which reads a text file containing a matrix of z values so that could be useful if I can find a way to generate this data from, say, a portion of a googleMap. 

Braille labels looked straightforward. I had a look around and found a number of projects on thingiverse. The one I liked was this Braille label project by polymaker (Brad Pitcher) This prints muliple lines of Grade 1 Braille on a base.

I know nothing about Braile printing but found these guidelines according to which

  • height of dot is 0.48 mm
  • base of dot is 1.44 mm 
  • dot spacing 2.34 mm
  • character spacing 6.2 mm

polymaker's code uses a hemisphere but I'd like to get closer to the spec. The base of the dot is longer than 2 * height so its really the chord(?)' of a larger sphere. To compute the offset I wrote a function to compute the radius from the height and the chord length:

function chord_radius(length,height) =
  ( length * length /(4 * height) + height)/2;
font_dotHeight = 0.48;
font_dotBase = 1.44;
font_dotSphereRadius  =  chord_radius(font_dotBase,font_dotHeight);
font_dotSphereOffset = font_dotSphereRadius - font_dotHeight;

I've taken to using global variables for the font variables because I think it's less clear if they are passed around as model parameters. It would be great if openscad had objects but it doesn't.

I also wanted to compute the width of the label which depends on the length of the longest line.  There is a max() function in openscad but it only accepts two scalars.  Fortunately I found that whilst module calls can't be recursive, function calls can be, so I was able to write a couple of functions, a recursive function and its front-door to find the maximum length:

function max_length_r(v, i, max) =
     i == len(v) 
       ?  max  
       :  max_length_r(v, 
                       len(v[i]) > max 
                           ? len(v[i]) 
                           : max

function max_length(v) = max_length_r(v,0,0);

echo (max_length(["cat","dog","master"]));

returns 6.

My openscad code differs in a few other ways to polymaker's but the basis and the braille character data are all his.

Sadly when the STL from this code was printed on a Makerbot, the result was a mess.  The dots are too small and joined by threads so that some rethinking about dimensions is needed.

[later:  revised code to bring the font to bring it closer to signage dimensions and add holes so a non-braille reader doesnt fix it up-side-down - printing stilll to be tested]

Here is a sample - "Aremiti" , the name of our yacht. This is now uploaded to Thingiverse

My thoughts turned to using the Raspberry Pi to drive a Braille output device, perhaps as simple as a matrix of 6 solenoids to dynamically configure the dot matrix.  Looking around I was amazed to discover  Bristol Braille, a group with the aim of producing an affordable Braille output device, based in the Bristol Hackspace. Quite a coincidence.