Intro: GRBL With H Bridge and DC Motor
In this instructable I will be showing how you can build a personal X-Y Plotter using simple L293d motor drivers. ie- without Complex Stepper drivers.
Warning - Use of H-bridge to drive a stepper is inefficient. features like microstepping cannot be performed.
The precision of the sketches will be reduced.
Components used -
- Motor driver L293d x2 -- one for each axis
- Stepper motor. -- I salvaged them from a old printer
- Axis mechanism -- again from printer. see next step
Step 1: Upcycle Old Printer
Check out the Images above of my printer taken apart.
each printer is different from other, so i cannot give you steps on how to open it.
But usually it should come off easily after taking the screws out. Or as in my case there might be plastic thingy that might have kept the case snapped in.
Here is a list of thing I found that may be reused -
- Stepper motors x2
- The convey belt and linear motion mechanism.
- The power supply (PSU) in the printer.
The main part - print Head seems to be broken. (and hence useless printer). I also found the excess ink removing mechanism pretty amazing. Will be saving it for future use.
Apart from that the main circuit board Will have very little use because my board uses all smd components. But I will try to salvage a few motor drivers from that board.
Step 2: X-Y Axis Control
First step is making the motor driver.
We will use LM293d motor driver IC. Each IC will control one stepper, ie- two internal winding of the stepper. So will need two ICs for controlling both X and Y axis.
Connect the motor driver and test it using the stepper motor example in the arduino IDE.
Step 3: Pen Mechanism
I have used a small DC motor to move the pen up and down. It is not a efficient as i expected it to be...but without a servo this was the best i got. I have just attached a spring to a pen holding part to bring it back up automatically when ever the power to the motor is removed.
So in the program whenever the tool down command is received, the arduino just makes the motor pin high and the tip touches down. If the arduino is not able to supply enough juice, then you can use a transistor of a mosfet in switching mode.
Step 4: Calculations -
follow these steps to calculate the steps/mm -
This value must be calculated for both X-axis and Y-axis. And the value must be entered into arduino through the Serial monitor.
- Write down steps/revolution of the stepper. It is usually written on the motor, but in my case it wasn't. So I had to practically find it out.
- Next we need find mm/revolution. This is simple just use Stepper_oneRevolution in examples and see how much linear shift it will result in the Axial direction.you can simply glue a pen and measure the displacement. This will account for the gears and mechanical setup of the printer.
- now all we have to do is steps/mm = (steps/revolution) / (mm/revolution)
Now calculate this for both Axis and enter it into the 0 and 1 rows.
$0 = *value*
$1 = *value*
in the serial window.
Step 5: Software -
two main softwares - Inkscape and Universal G-code sender.
download them here -- https://github.com/winder/Universal-G-Code-Sender
and inkscape -- https://inkscape.org/en/release/0.92.2/
- In inkscape, insert a image, bitmap or create your own patterns.
- Once the design is finalized, select all of it and go to Path -> Object to path.
- Next Extensions -> Gcodetools -> Orientation points
- Then Extensions -> Gcodetools ->Graffiti
- A green window appears with details. Change Gcode before path row from M03 S1 to M3. And change gcode after path from M5 to M4.
- finally select Extensions -> Gcodetools ->Path to Gcode
You will get a Gcode file of your design which will be sent to your arduino. Make sure to enter destination location in the last step prreference window.
Universal G-code sender -
- Open the application and select File mode.
- Browse and Select the gcode file.
- You can click Visualize to see how the pattern looks.
- Finally select the correct COM port and click open.
Download library and .ino file from here -https://github.com/rakshithbk/GRBL-H-Bridge
Step 6: Final Result
Since we are using the H-bridge to control the steppers, we will not be able to microstep the motors.
So we will find zig-zag patterns in at curves because of this. None the less it is pretty good results considering that the everything was made from recycled parts. :-)
Upgrade - I replaced the H-Bridge with a stepper driver which supported micro-stepping. I set it to 8 micro steps and played around with a few applications. You can see the results in my last video.