<<<<<<<=Go Back To Home <<<<<=Previous Week || Next Week>>>>>

Braille printer in action

Visit Our Group Page Documentation

We have done this group project during the timeline of two weeks (May 2nd 2018 to May 17th of 2018). First week was the Mechanical Design Week and the latter week for the Machine Design.

  • Week 15 - Mechanical Design (May 2-9, 2018)

  • Week 16 - Machine Design (May 10-17)

  • Week 16 : Machine Week 2 - Machine Design

    Choosing Microcontrollers

    We could use a commercial board to talk to the machine. We chose to use Arduino Mega 2560 with RAMPS 1.4 shield.
    We use two A4988 stepper driver boards to control the two stepper motors in our machine.

    Ramps (Source) and Arduino Mega (Source)

    Arduino Mega(Source)

    The Arduino MEGA ADK is a microcontroller board based on the ATmega2560. It has a USB host interface to connect with computers.It has 54 digital input/output pins (of which 15 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button


    Ramps is short for reprap Arduino mega pololu shield, it is mainly designed for the purpose of using pololu stepper driven board (similar to 4988 driven board). Ramps can only work when connected to its mother board Mega 2560 and 4988/DRV8825

    Source of the above details

    A4988 Stepper Driver

    A4988 microstepping bipolar stepper motor adjustable current limiting, over-current and over-temperature protection, and five different microstep resolutions (down to 1/16-step).
    It operates from 8 V to 35 V and can deliver up to approximately 1 A per phase without a heat sink.

    Stepper driver
    A4988 Stepper Driver Source

    Major features of A4988 stepper driver is Simple step and direction control interface, Five different step resolutions: full-step, half-step, quarter-step, eighth-step, and sixteenth-step.
    Adjustable current control lets you set the maximum current output with a potentiometer, which lets you use voltages above your stepper motor’s rated voltage to achieve higher step rates.

    Connection Diagram Source

    Source of the above details

    Choosing the end effector to be attached to the printer head

    We needed an end effector to punch holes in a regular paper,the standard Braille holes have to be close to 1.44mm diameter size.

    After the first Solenoid we purchased was a failure because it had no power to embose the holes, i decided to use Servo motor to make the embosing action with a tool head attached to the Servo shaft.


    Download Program file for servo

    We needed to test the stepper motor and how much steps it takes to complete one revolution. We connected the ramps board to Arduino mega and connect the A4998 driver to X part of ramps 14 board.N ext connect all the 4 pins named 2A, 2B, 1A & 1B to the stepper motor. According to the schematic diagram, we find that stepping and direction pin of x is connected to 54 and 55 pins of mega and enable pin is connected to 38.
       #define X_STEP_PIN       54
    #define X_DIR_PIN          55
    #define X_ENABLE_PIN       38
    char data = 0; //byte to receive and check data from computer
    void setup() {
      Serial.begin(9600);//Start the Serial port.
      pinMode(X_STEP_PIN   , OUTPUT);
      pinMode(X_DIR_PIN     , OUTPUT);
      pinMode(X_ENABLE_PIN      , OUTPUT);
    void loop()
      if (Serial.available())
      { //if there is data on the Serial buffer
        while (Serial.available() > 0)
        { //continues reading the values on the buffer.
          data = Serial.read();
          if (data == '1') {
            forward(200); // if i recieves make single rotoation clock wise
           if (data == '0') {
              backward(200);  // if i recieves make single rotoation anti clock wise
      void forward(int number) {
        digitalWrite(X_DIR_PIN    , HIGH);
        for (int i = 0; i <= number; i++)
          digitalWrite(X_STEP_PIN    , HIGH);
          digitalWrite(X_STEP_PIN    , LOW);
      void backward(int number) {
        digitalWrite(X_DIR_PIN    , LOW);
        for (int i = 0; i <= number; i++)
          digitalWrite(X_STEP_PIN    , HIGH);
          digitalWrite(X_STEP_PIN    , LOW);

    Amith wrote a program in which , when if we send 1 through serial monitor it rotates one revolution and if we send 0 it roates backward.

    Number of steps per revolution should be 200 by default but the program was not working.
    This was because all stepper drivers A4988 come from china are in the 1 /16 microstepping.
    Which meant the total No.of steps required for 360 deg rotation = 200*16 = 3200. And when we changed the steps 200 to 3200 it worked.

    As said earlier, the first solenoid didnt have enough power to make holes in paper so we took another option to use a servo motor . Our idea was to connect a pen/tool to the servo motor and move up and down it makes holes.

    Ramps14 have capacity to connect 4 servo motors , So we connected the servo motor and the stepper motor and wrote a code to control all these using serially

    Code for running Stepper forward ( x axis -which head moves )

            void forward(int number) {
              digitalWrite(X_DIR_PIN    , HIGH);  // makes the motor direction in forward
              for (int i = 0; i <= number; i++)
                digitalWrite(X_STEP_PIN    , HIGH);
                digitalWrite(X_STEP_PIN    , LOW);

    Code for running Stepper backward( x axis -which head moves )

            void forward(int number) {
              digitalWrite(X_DIR_PIN    , LOW); // makes the motor direction backward
              for (int i = 0; i <= number; i++)
                digitalWrite(X_STEP_PIN    , HIGH);
                digitalWrite(X_STEP_PIN    , LOW);

    Code for running controlling servo to make holes ( x axis -which head moves )

            void braille(void){
                     myservo.write(50);First paper drwaing : How printer looks

    Code for running Stepper forward ( Y axis -which paper roller connected )

              void forward(int number) {
                digitalWrite(Y_DIR_PIN    , HIGH);   // makes motor direction forward
                for (int i = 0; i <= number; i++)
                  digitalWrite(Y_STEP_PIN    , HIGH);
                  digitalWrite(Y_STEP_PIN    , LOW);

    Function to control the actions

            void loop()
                         {              //if there is data on the Serial buffer
                         {               //continues reading the values on the buffer.
                            braille();//if a one was received, makes a dot.
                         forward(3200);// if a zero was received just advances.
                   if(data=='3'){//if a "3" was received, pull the paper to begin a new line.
                    backward(3200);//return the car.

    That is when Our instructor Yadhu bought the good solenoid and gave it to us, so we are now again on track.
    The power of this one was quiet enogh to embose the holes.

    Then we have to calculate the movement of motors.
    First we connected X-axis stepper motor to the ramps.
    A small mark was made on the bottom of the head and we rotated stepper motor for one cycle and then marked on the bottom of head again.

    The distance between the two marks was a distance of 31mm, ie; for one cycle of rotation of the stepper motor(3200 steps) the head goes the distance of 31mm

    After completing this, We should calcute the Y axis part, where the paper should move forward for printing.
    We used the paper rod from old printer with rubber bushes to help paper to move forward and backward .
    Then we measured diameter of the rubber bush covering, it was 11.8mm. So for 1 revolution of stepper motor rod covers a distance of 22/7*11.8mm = 37.05mm

    After making these calculations we found that for 1mm movement of the X-axis head we need a step of 104 and for the Y-axis 1mm movement we need a step of 86.

    We referred the Instructables website for some CNC machine tutorials and from there we got the idea of controlling the stepper motor using some open source firmware.

    On searching and we found the Marlin firmware, which is good and useful.
    Now using a G code file, we can control the printer.

    So we uploaded Marlin firmware on our atmega board and check that

    Marlin firmware

    A firmware is a permanent software programmed into a read-only memory. Marlin firmware is program that designed and developed for making 3D printers using Ramps board.
    Firmware is the link between software and hardware, it interprets commands from the G code file and controls the motion accordingly. We could use marlin firmware for any machines if we made some changes.

    We need to run two stepper motor and control on solenoid push-pull using G code.

    Marlin firmware Download link

    After downloading the firmware, open the file Configuration.h in the Marlin folder and Set the communication speed:

        #define BAUDRATE 115200 

    The serial communication speed as 115200 gives a balance between speed and stability.

    We need to configure the End stops for all the edit functions are making on Configuration.h file.
    The main aim of end stops is to find the origin of the head.

    End stops are switches that trigger before an axis reaches its limit, It will prevent the head from trying to move out of its frame.

    The printer also uses end stops as a reference position.

    The Marlin firmware allows to configure each limit switch individually. We made our end stop is on the right side of the machine.

                    #define X_MIN_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop

    The total number of axis which is 2

                         #define NUM_AXIS 2

    The stepper motor receives step by step moving command from the controller.


    The controller needs to know the steps per mm ratio for sending the appropriate steps to reach the required distance.
    How many steps are needed to move an axis by 1 mm. here we use the calculations find in above

     #define DEFAULT_AXIS_STEPS_PER_UNIT   { 104, 86, 4000, 500 } //104 stands for 1mm moement in x axis number of steps is 104 and for y axis 1mm movement steps is 86 other values are not usefull to us

    Send the firmware to the 3D Printer: after verify the marlin.ino in marlin folder and upload that code to arduino mega and after that Power up the machine and open prointerface in your Pc and connect arduino to pc using usb cable.

    Click to connect the machine and move X axis a little amount like +1 or +10 mm. after that we found that its working.

    We now connect the solenoid to the port so that we could control it using a gcode.

    G-Code: Numerial control programming in which its changes depends on the machine and firmware.

    I referred the website for the G code details needed

    We only need few codes to control our printer using marlin firmware
  • G0, G1 - Linear Move: The G0 and G1 commands add a linear move to the queue to be performed after all previous steps completed. Marlin treats G0 (rapid linear movement) as an alias to G1 (fast action).
  • G4 - Dwell - Dwell pauses the command queue and waits for a period of time.
  • G21 - Millimeter Units: Set units to millimeters.
  • G28 - Auto Home
  • G90 - Absolute Positioning In absolute mode all coordinates given in G-code are interpreted as positions in the logical coordinate space
  • M106 and M107 : thes are used to one and off the fan using this we can operate solenoid push pull.
  • Our Instructor Yadu already made a text to gcode creater and sender.
    We used it to create text to gcode and send the gcode to machine.

    A GUI in python was done by Amith and it was like when we enter a text in a coloum which saves that text in .txt file. And when the print key is pressed, it executes the text to the braille gcode creator and creator to sendor. From there the sender sends the gcode gopes to our machine.

    Python GUI code

       from Tkinter import *
       import sys
       import os
       def save():
           text = e.get() + "\n"
           with open("text.txt", "w") as f:
       def printer():
           os.system('python text_to_braille.py')
       master = Tk()
       master.title("Braille Printer")
       Label(master, text="Enter the text").grid(row=0)
       e = Entry(master,width=70)
       e.grid(row=0, column=10)
       Button(master, text='Save', command=save).grid(row=3, column=0, sticky=W, pady=4)
       Button(master, text='Print', command= printer).grid(row=3, column=1, sticky=W, pady=4)
       Button(master, text='Quit', command=master.quit).grid(row=3, column=3, sticky=W, pady=4)
       mainloop( )

    To make G-code for text to braille
    Every text(alphabets A to Z and numbers 0 to 9) of braille language was entered into a 3x2 matrix and stored as .json file (jason format).

    for example A  we store it as  "a": [[1, 0], [0, 0], [0, 0]]

    Download All Machine Week 2 files

    Braille printer in action

    Creative Commons License
    This work by Aby Michael is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.