Friday 25 May 2018

EV3 Banner Printer

We have developed an EV3 Banner Printer based on the instructions given here. We developed a Java (LeJOS) program to make it operate according to our requirements. Below is a small clip which will demonstrate the printing of various characters. We have also posted the gist of Java program which we developed. This Java program has an array called "myString" which stores the entire set of characters that we want to print. 

Let me give you a brief introduction of this array. The main objective of the program was to operate with the help of a Infrared beacon (For Example: Print "P" when beacon is on mode-3 and button-4). However, testing frequently with the help of beacon was quite time consuming. Hence we have put the entire list of beacon characters in "myString" array. 

NOTE: Below is the gist of how "myString" array looks like
myString[0][0] = 2;  // This is the mode number of the first character
myString[0][1] = 4;  // This is the button number of the first character
myString[1][0] = 2;  // This is the mode number of the second character
myString[1][1] = 1;  // This is the button number of the second character
and so on ... 

Once the string is stored inside the array, we can iterate it over the while loop and start printing the characters one by one. The job of printing any characters is very simple. Rotate the three motors as per requirements. In our case, Large Motor C is doing the job of moving paper as the characters get printed. Large Motor A is doing the job of moving the pen up and down. Medium motor is doing the job of moving the pen from bottom to top of the paper and vice-versa. 

Some key points to remember:
  • Each character is printed 180 degrees apart from each other horizontally, where 180 degrees is the rotation of large motor C. The motor C is responsible for the horizontal movement along the paper's length
  • Each character is printed within 90 degrees to 270 degrees rotation of medium motor D. The medium motor D is responsible for the vertical movement of the pen along the paper's breadth. Here, motor's rotation to 90 degrees correspond to bottom most position along the paper's breadth and 270 degrees correspond to topmost position along the paper's breadth 
  • When the large motor A is rotated through 160 degrees, the pen touches the paper and the character starts printing. And when the motor is rotated through 360 degrees, the pen is lifted up and the printing gets disabled  
Now let me explain the way we print the letter A as an example:
  • The character begins at the position begin = (character - 1) x 180 degrees. The motor C is rotated to this position with the statement ev3lmotorC.rotateTo(begin)
  • Medium motor D is placed at its lowest position on the paper by rotating the medium motor through 90 degrees. This is achieved by the statement ev3mMotorD.rotateTo(90)
  • Large motor A is rotated through 160 degrees by the statement ev3lmotorA.rotateTo(160). This brings us to position A of the character A (based on the below figure)
  • Then comes the drawing of slanting edges of the letter A. The drawing of slanting edge is achieved by incremental movement of motors C and D which move the pen horizontally and vertically respectively. As a result, if you closely observe, the letter A looks like in the below image

 
  • There are total 10 increments through which the motors move and draw the edges. The motor D is moved through increments of 18 degrees vertically, that helps it reach the maximum of 270 degrees of character height in 10 increments. While motor C is moved through increments of 5 degrees that will help it reach 45 degrees horizontally, when it is at the character height. A similar principle is applied when the downward slanting edge is drawn. This exercise brings us from point A to B to C   
  • Now it is the time to draw the horizontal middle line of the letter A. But before jumping into drawing the line, we have to know where we are, with respect to the entire drawing of letter A. We are at point C. At this point we have to lift the pen, by rotating the motor through 360 degrees. We lift the pen so that nothing gets printed unless we want it
  • We then bring the pen at the position M, by rotating the motor C horizontally through an angle begin + 90 - 68. Also we need to rotate the motor D vertically by 180 to reach the point M
  • Now rotate the motor A through 160 degrees, to get the pen in contact with the paper. Then rotate the motor C horizontally through an angle begin + 90 - 23. This will bring the pen at position N. 
  • The next steps are to wrap up the printing of the character, by brining the pen from position N to position C.  
    • Lift the pen up by rotating the motor A through 360 degrees
    • Rotate the motor C through begin + 90 degrees and motor D through 90 degrees to reach the point C. With respect to point C, the next character will be drawn. 
For us, it was a lot of joy to work on this printer. Hope you will also enjoy reading the article and also building it. 


No comments:

Post a Comment