Purpose:
The motivation for this project was my neighbor asking if it was possible to send the text to a 3D printer and have it print the Braille equivalent. She works with visually impaired children in the school district and expands how something like this could be of use to them. I told her it can be done and set out to make it happen! I needed to create a program that can take user input text and output a 3D .stl file of the equivalent in Braille for a 3D printer to use. |
Design:
Being familiar with 3D printing, I knew .stl files are a fairly common / easily translatable formate to work with and decided on that for my output formate. To generate these files I'm using an STLA file formate (ASCII stereolithography files). A series of three (X,Y,Z) vertex coordinates tell where a triangle lies. Added to that, a (X,Y,Z) normal vector indicates the triangle's plane direction. To make a 3D object you simply construct many of these 2D triangles together. To get familiar with this I tried some of the sample files on the page. Conveniently, there was a sphere example provided that I shaved down (deleting half the data) to create a hemisphere. This hemisphere is what I am using as my Braille dot. I next dissected each of the XYZ vertex and normal components to create arrays I could work with. This was done using Excel and saving the file as a CSV to comma separate but name as a .txt. This array is in the correct format to work with in C, just needed to add braces on the ends. I next wrote a one-dimensional array for each of the dots to store all the ASCII characters it represents (Dot1 top left, Dot2 top right, Dot 6 bottom right). By doing so I could decide whether that dot needed to be ON or OFF. User input is received from the fgets function and is directly converted to a form that takes into account some Braille rules. These rules are a certain character before every uppercase letter, a certain character before any number string, and a certain character to represent the common word "and". After accounting for these I set up some defined spacing parameters for how many row/column cells and the cell/dot spacing. Each converted character is sent to the 6 dot array checks to see which are on and off after that the dots are shifted accordingly to assemble the text. The result is a 3D Braille interpretation of the input text.
Being familiar with 3D printing, I knew .stl files are a fairly common / easily translatable formate to work with and decided on that for my output formate. To generate these files I'm using an STLA file formate (ASCII stereolithography files). A series of three (X,Y,Z) vertex coordinates tell where a triangle lies. Added to that, a (X,Y,Z) normal vector indicates the triangle's plane direction. To make a 3D object you simply construct many of these 2D triangles together. To get familiar with this I tried some of the sample files on the page. Conveniently, there was a sphere example provided that I shaved down (deleting half the data) to create a hemisphere. This hemisphere is what I am using as my Braille dot. I next dissected each of the XYZ vertex and normal components to create arrays I could work with. This was done using Excel and saving the file as a CSV to comma separate but name as a .txt. This array is in the correct format to work with in C, just needed to add braces on the ends. I next wrote a one-dimensional array for each of the dots to store all the ASCII characters it represents (Dot1 top left, Dot2 top right, Dot 6 bottom right). By doing so I could decide whether that dot needed to be ON or OFF. User input is received from the fgets function and is directly converted to a form that takes into account some Braille rules. These rules are a certain character before every uppercase letter, a certain character before any number string, and a certain character to represent the common word "and". After accounting for these I set up some defined spacing parameters for how many row/column cells and the cell/dot spacing. Each converted character is sent to the 6 dot array checks to see which are on and off after that the dots are shifted accordingly to assemble the text. The result is a 3D Braille interpretation of the input text.
How to Run
Compile the C code into a executable (output file can be named whatever, I like to just drop the .c on mine).
gcc Text_to_Braille.c -o Text_to_Braille
Now run the executable and take the output and redirect it to a file ending in .stl using >, if you need privilege sign into root and chmod the file.
./Text_to_Braille > file.stl
Once you hit enter you can type what you would like to have converted to Braille and press enter. You can now view the finished file.stl to see the results (orientation may be confusing, I always look for the left justified corner or the first word).
Printing
To print upload the .stl file to any 3D printing software. I am using slic3er which was recommended for the PRUSA i3 printer. Scale the print so it fits on the bed. If you need to alter the rows and columns do so in the program and regenerate. When I import my design it is always upside down so I have to do a rotation over the x-axis by 180 degrees. Once in place you can change printer settings for resolution and infill. Lastly, export the generated file to the printer to begin printing. I tried printing on a sheet of regular A4 paper and the results are shown below. If I were to go it again one pass of the printer would be sufficient. When it does two passes one of the dots was knocked off from the printer tip.
Comment Form is loading comments...