GRBL With H Bridge and DC Motor




Introduction: GRBL With H Bridge and DC Motor

About: Electronics and communication engineer in making. Hobby tinkerer and photographer

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

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

and inkscape --

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 -


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.

Epilog Challenge 9

Participated in the
Epilog Challenge 9

Arduino Contest 2017

Participated in the
Arduino Contest 2017

Be the First to Share


    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Home and Garden Contest

      Home and Garden Contest
    • Electronics Contest

      Electronics Contest



    2 years ago

    This grbl for H-drive (l293d) seems not working at all. No response, no connection !


    3 years ago

    hi! iM Trying to upload the library but I cant. Could you help me? thanks!


    Reply 3 years ago

    I open the .IDE and it upload OK but I have no response of "$". Just do nothing. Thanks!

    Maker Saga
    Maker Saga

    4 years ago

    Dang! If only I had this tutorial when I had three flatbed scanners!

    Rakshith bk
    Rakshith bk

    Reply 4 years ago

    what did you do with them..?


    4 years ago on Step 6

    A full and very didactic post but a bit confusing. The title is about H bridge driver and DC motor, then it's said that H drivers aren't ideal for stepper motors but this is how it's used. Of course stepper motors are DC as well but this isn't how it's understood here. The end finishes with a stepper driver able to be microstepped, the ideal configuration.

    Rakshith bk
    Rakshith bk

    Reply 4 years ago

    The most popular G-code parser for Arduino is GRBL. But it is very rigid in terms of hardware. It works with stepper driver such as DRV8825 or A3967, which are hard to get in local stores around me and they are expensive compared to L293d.
    My objective was to construct a working Plotter with all recycled parts (without spending ₹). So I used few L293d's laying around and a broken printer parts. Which is given in the instructable.
    But the curves are not smooth when using H-bridge, so I had to go for those Drivers in the end and those results are posted in the last step. When running on H-bridge the results are better when the step count of the motor is higher.