As our project we have made a 2D printer powered by Arduino UNO. The project is inspired by the 2D CNC machine.
There are two NEMA17 stepper motors, one for each dimension and a servo motor to plot the dots. The coding is not that complex, the actual complication lies in the structure and the hardware. According to the calculations, the motors accept around 1.2A (12V) while printing. Internally, Uno has a 32x32 bool array. Which is printed /plotted one dot at a time. In the worst case, the system will take 2-4 minutes to draw the whole image. Then once the image has finished, the python code gets ready for the next image.
Image Processing: The Image module from the PIL library is used. The image is opened and converted to black and white. It is then resized to 32x32 pixels. The resulting image is plotted using the matplotlib library. The data is sent byte by byte to the Arduino serial port.
Printing:There is a platform that sits on the base. The platform has a stepper motor mounted on it that controls movement in the y-direction, a coupling connector connects the motor shaft to a threaded rod. There is a base mounted on the rod that moves with the rotation of the motor. A similar assembly is attached to the base of the platform that controls the displacement of the servo motor in the x-direction. The servo motor rotates to drop the pen on the paper and when it rotates in the opposite direction it lifts the pen off the paper. The stepper motors are controlled by a 12V power supply. The motor driver receives pulses from the Arduino. The servo motor is also controlled by the Arduino. The image is processed by a python program that takes a .bmp image and coverts it into a pixel array of 32x32 bits. The array is sent to the Arduino’s serial port. When the Arduino is ready to read from the serial port a green led is turned on. The Arduino code reads the array from the serial port and converts it into a 2D array. The array is iterated in a nested loop. When a 1 is found the pen is dropped else it is lifted. During printing a red led is kept on. Once the printing is complete, the stepper motors return to the initial point.
We have chosen the scanning algorithm which follows a snake pattern and plots all the points. This gives the maximum time efficiency without optimization.
Images with dimensions of 8x8cm have been printed, within 2-4 minutes. The pixel density is 35 steps per pixel which is approximately 1mm.
The structure is made from wood. A 22x20 cm board is used as a base. The 20x4.5 and 22x5 cm pieces are used as bases for the motor assemblies. The 4.5x5 and 4.5x4.5 cm pieces are used as walls. Holes are made into the walls to support the threaded rods. Another 4.5x5 cm piece is used as a platform for the second motor. The platform is supported using wooden skewers glued to the walls.
It was a fun project, which gave us a lot if insight into mechanics, mathematics and motors. We have learned to understand and work with the serial communication of the Arduino. It involved some complex conversions from data types as we needed to cast the datapoints from bools to bytes and convert it back from bytes to bool and store it in the array in the Arduino.
An implementation of the model has been coded in python and Arduino which can be found on GITHUB.