GRBL With H Bridge and DC Motor

by Rakshith bk in Workshop > CNC

15407 Views, 44 Favorites, 0 Comments

GRBL With H Bridge and DC Motor

IMG_20170219_171356.jpg
Capture.JPG

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 -


  • Arduino
  • 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

Upcycle Old Printer

IMG_20170115_124429.jpg
IMG_20170115_124421.jpg
IMG_20170115_124920.jpg
IMG_20170115_124504.jpg
IMG_20170115_124608.jpg
IMG_20170115_125915.jpg
IMG_20170115_125459.jpg
IMG_20170115_124622.jpg
IMG_20170115_125102.jpg
IMG_20170115_125227.jpg
IMG_20170115_125342.jpg
IMG_20170115_125404.jpg
IMG_20170115_124719.jpg
IMG_20170115_124730.jpg
IMG_20170115_125531.jpg
IMG_20170115_125645.jpg
IMG_20170115_124745.jpg
IMG_20170115_125554.jpg

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.

X-Y Axis Control

IMG_20170121_142732.jpg
IMG_20170121_142801.jpg
l293d.jpg
arduino-stepper-motor-circuit.jpg
L293D-pin-out.gif

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.

Pen Mechanism

IMG_20170219_171317.jpg
IMG_20170219_171309.jpg
IMG_20170219_171327.jpg
IMG_20170219_171356.jpg

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.

Calculations -

2017-10-19.png
Capture.PNG
calculations.jpg

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.

Software -

Capture2.PNG
Capture.PNG
Capture1.PNG

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/

InkScape -

  • 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

Final Result

Arduino plotter - Arduino logo
Arduino plotter - spiral
Arduino GRBL Plotter
IMG_20171101_210845.jpg
IMG_20171216_123426_1.jpg
IMG_20171030_233641.jpg
IMG_20171216_123426.jpg
Arduino GRBL Plotter - Iron man

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.