Open Source Closed Loop Motor Controller

Similar projects worth following
This device is designed to control DC brushed motors up to 36 V and 10 A (almost ½ hp) for axis positioning in CNC machines such as routers, milling machines, laser cutters and 3D printers.

This project is now avalilable on Crowdsupply


The board accepts the common STEP/DIR signals that are ubiquitous to low cost machine control boards, such as the RAMPS and parallel port breakout boards for Mach3, LinuxCNC and Machinekit.

Position sensing is achieved by means of an incremental quadrature encoder. The controller is capable of stopping the machine when it detects one of several fault conditions (discussed later) to avoid ruining a job. A full duplex serial port is available for easy configuration and tuning of the servo driver.

Shrouded and keyed headers for the signal connections are installed on the board to keep the end user from accidentally shorting two pins together or plugging a connector backwards. Pluggable screw terminals for the power connections allow the board to be easily installed inside a case or in tight spaces without having the cables getting in the way of the user.

SoC for Closed Loop Control

A Cypress Semiconductor PSoC4 chip (ARM Cortex M0 core plus internal programmable logic and analog hardware) is present to read the STEP/DIR signals from the machine controller, read the encoder input and perform the calculations required for closed loop control of the motor kinematics.

It controls two indicator LEDs for signaling the different fault modes the device is able to detect, such as motor overcurrent, driver undervoltage, missing encoder, exceeded encoder pulse rate and motor not able to reach position. It can also send an alarm to the rest of the motor drivers.

Gate Driver

A full bridge MOSFETgate driver switches four transistors with an appropriate voltage with the appropriatecommutation speed, while also protecting them from being damaged by a shoot-through condition oroverheating due to insufficient gate voltage or anovercurrent event.

The IC also amplifies the voltage drop from an external 5 mOhm shunt resistor for low side current sensing.

Finally, the driver also performs current chopping (set at 12 A) to provide a second layer of overcurrent protection. The current level is set via two resistors in a voltage divider configuration.

MOSFETs in H Bridge Configuration

The device utilizes four ~5 mOhm (at 25 ºC) N channel MOSFETs with a 60 V breakdown voltage. The transistors use the board as a heatsink.

Device Characteristics






Motor side voltage




Continuous current output




Logic side voltage (VLOGIC)




Current consumption



Step signal frequency




Encoder frequency (4x)




Error signal output current



Serial port speed






Operating ambient temperature 1




1 40 ºC is the maximum ambient air temperature for which the current output value is valid

Source files:

  • 1 × CY8c4245PVI PSoC microcontroller
  • 1 × DRV8701 gate driver
  • 1 × 0603 green LED
  • 1 × 0603 red LED
  • 4 × IRFH7545PbF MOSFET

View all 16 components

  • The new boards

    ottoragam02/17/2017 at 04:03 0 comments

    During the past few days I was able to burn the firmware and begin testing the
    new Tarocco boards. I plan to ship half of the batch first, as soon as I'm done
    testing the boards (probably next week), so those of you who ordered the
    controller without a servomotor can begin to use them. The second half of the
    batch will likely be shipped in the following week. The servomotors should be
    ready by the second week of March.

    I've uploaded the final design files for Tarocco and the BOM tothe repo.

  • Crowdfunding campaing status update

    ottoragam01/18/2017 at 21:25 0 comments

    At just 3 days from the end of the campaign, the project is just 800 dolllars away from the goal.

    Now is the time to get your own board at

  • Machining with Tarocco

    ottoragam12/21/2016 at 22:44 0 comments

  • Funding Campaign Started!

    ottoragam12/08/2016 at 16:49 0 comments

    The Crowdsupply funding campaign is now live! If you find the project useful please consider backing it.

  • Testing the new motors

    ottoragam11/05/2016 at 15:33 0 comments

    I borrowed a Prusa i3 from a friend. I wanted to show the performance of the 30W motors I got, so I made a NEMA17 adapter from a piece of acrilyc and replaced the X axis stepper with my servomotor.

    But it has 3 times the mechanical output power!

    I used one of the available headers on the MKS board to supply the signals to my controller, and removed the stepper driver from its socket.

    After getting familiar with the 3D printing software (I used Repetier), I was able to print the classic ship thingy.

    Unfortunately the printer only had space for my servomotor on the X axis, and I didn't wanted to modify it as it was not mine. The good thing is that I have an old router available for more testing. I just need to replace the steppers with the servomotors and do some testing!

  • A little update

    ottoragam10/24/2016 at 23:29 0 comments

    I'm planning to provide a suitable motor for use with Tarocco for those who don't want to go through the trouble of selecting a motor and feedback sensor.

    Last week I got some DC servomotors to test with Tarocco. They are 24V 30W units, with a maximum angular speed of 4000 rpm, and they come with a factory installer optical encoder. The encoder wheel has 360 divisions, so the encoder provides 1440 pulses per revolution.

    Physically, the motor's body is 38 mm (1.5 in) in diameter, and it has a 5 mm shaft, so it can be used to replace NEMA17 and NEMA23 motors. I'm planning to swap the steppers on an off the shelf 3D printer with brushed motors and see how the conversion goes, hopefully the frame will be able to handle the increased speed of the motors. Keep tuned for more!

  • Online project source files

    ottoragam10/14/2016 at 05:50 0 comments

    I've just begun uploading the source files to the Tarocco Github repo. If you wanted to know more about Tarocco, well, now's your chance!

  • Everything up so far

    ottoragam09/21/2016 at 13:40 0 comments

    Almost a year ago I started making my own brushed DC motor controller, after having difficulties finding a commercial unit with the right features, within my budget. As of today, I'm using the controller to successfully run a 120 pund class milling machine. However, I wasn't entirely satisfied with the first version of my controller, so I decided to improve it.

    And for anyone interested on having a ready made controller, there will be a Crwodsupply campaing launching very soon. You can sign up to get the relevant notifications here:

View all 8 project logs

Enjoy this project?



dakota pahel-short wrote a day ago point

I'm  designing a micro extruder (30g!!!) with this board and I have a bit of a wiring question. The smoothieboard has break out pins for external drivers: step, direction, enable. Do I connect the enable to the rest pin on tarocco board?

  Are you sure? yes | no

ottoragam wrote a day ago point

Hi! Yes, the reset pinshould be connected to the enable pin on the smoothie. The reset is active low, so make sure the smoothieboard keeps the pin high while in operation.

  Are you sure? yes | no

dakota pahel-short wrote 13 hours ago point

Btw just an update, when I tried to open Serial Port Plotter and windows prevented access saying that it was infected with Rundas.B Trojan. I'm having a little trouble finding a serial plotter that will respond to the tarocco. 

  Are you sure? yes | no

ottoragam wrote 13 hours ago point

I really don't know what could be causing the antivirus to trigger. It probably is a false positive. Anyway, the serial data stream can be adjusted to send exactly the data you need in order for another program to parse it. What plotter program would you like to use?

  Are you sure? yes | no

dakota pahel-short wrote 12 hours ago point

Looks like it would work but nothing is plotting. 

  Are you sure? yes | no

ottoragam wrote 11 hours ago point

I'll give that plotter a check. Write to you back in a bit.

  Are you sure? yes | no

dakota pahel-short wrote 5 hours ago point

please do. figuring out how to connect to the board is a real challenge . i even turned off my security to try out Serial Port Plotter but nothing seems to be getting a response . i know the board is working. the Vin led is solid until i turn on the motor and then the fault led turns on too, but nothing seems to be allowing it to send data or receive data. 

  Are you sure? yes | no

ottoragam wrote 5 hours ago point

Try inverting the connections of the motor to avoid the fault when you try to spin it. Yo can use any other serial terminal program in the meanwhile, like realterm. You should see the numeric values that the Tarocco reports in the terminal window. If not, then the problem is probably caused by something else.

  Are you sure? yes | no

dakota pahel-short wrote 4 hours ago point

I tried realterm. Nothing is giving me feedback. 

  Are you sure? yes | no

ottoragam wrote 4 hours ago point

Try inverting the RXD/TXD connections, that may do the trick.

  Are you sure? yes | no

dakota pahel-short wrote 4 hours ago point

Well that did something! I now see E0 on the screen over and over again in realterm. I also inverted the motor but it still faulted when the enable pin activated. 

edit: for some reason it rest the baud rate while i wasnt looking. changed it back and im getting $numbers which seems more correct. 

  Are you sure? yes | no

dakota pahel-short wrote 3 hours ago point

So feedback is definitely happening but nothing seems to be improving the motor position. I told it to extruder 5mm and it will go from $000503 000310 to $002803 000310 and no inputs to the p seems to affect it. though it also is showing a fault right away even though it says $000500 at the start which should be no positional error. it is not the motor connections because i tried reversing those. 

  Are you sure? yes | no

ottoragam wrote 2 hours ago point

It seems that inverting the motor wires is causing it to runaway. You can invert them again, or send the "invert direction of rotation command". Also, Serial Port Plotter will probably work now.

  Are you sure? yes | no

dakota pahel-short wrote 14 minutes ago point

I wish it was that. I've flipped it back and forth several times and nothing has happened. Everything seems wired right though. It's fun to manually move the encoder and see the number change. I'm gonna update the firmware and test that in a few days (i just got commissioned for a few hundred dollar print... gotta get the old extruder working again XD) 

So about serial port plotter, how do you use it to send commands to the driver? I didn't see anything about that in the interface. Though i did only use it for a few minutes before i turned the windows defenses back on and it removed the program....

  Are you sure? yes | no

Rost wrote 05/14/2017 at 22:56 point

Hi! How it's going Ottoragam?) Any news about your video tutorial for motor tuning from PC ?

P.S. Still have my interest to your project. )

  Are you sure? yes | no

ottoragam wrote 05/14/2017 at 23:54 point

Hi Rost! I've been really busy improving the firmware and dealing with the assembly of the next board batch. I believe I'll be able to work on some other things, like the guide, next month.

  Are you sure? yes | no

Rost wrote 05/15/2017 at 11:15 point

I see. Will be waiting for it. Good luck with your work. ) 

By the way. New firmware will be availible to download?

  Are you sure? yes | no

ottoragam wrote 05/15/2017 at 17:43 point

Of course. Everything will be made available via Github :)

  Are you sure? yes | no

Rost wrote 01/28/2017 at 21:41 point

Hellow again. I have another question. Will it work with 48 volts power supply normaly? If not, what changes shold be done to the board to accept such voltage?

  Are you sure? yes | no

ottoragam wrote 01/29/2017 at 09:49 point

I don't think it would be possible to work at such voltage. I think the maximum should be 40 V. The gate driver (practically the heart of this design) is rated for 45 V and a maximum of 47 V. You could probably run your motors at a lower voltage without loosing too much.

  Are you sure? yes | no

Rost wrote 01/29/2017 at 12:17 point

I see, thank you. You told me that it is easy to control the driver using usb-uart converter with serial terminal like Realterm. I made a search for example how to do that on youtube and thound nothing usefull. Will you make instructions video on your youtube channel in the future showing how to do that?

  Are you sure? yes | no

ottoragam wrote 01/29/2017 at 13:35 point

Yup, I plan to make a video tutorial for the board. I recommend you read this
It should give you a basic idea on how the board is used.

  Are you sure? yes | no

Rost wrote 01/29/2017 at 15:58 point

Thank you. Will wait for it. You said in the guide about encoder errors depending on motor speed. On what speed it starts to happen? i am going to use 1600 rpm motors and 600 ppr encoders. As I can understand errors problem is about much higher speeds and high resolution encoders. Do I understand it right?

  Are you sure? yes | no

ottoragam wrote 01/30/2017 at 04:32 point

The speed at wich the error becomes more significant depends on the motor, the tuning and the thing it is coupled to, I cannot say how much the error will be. Don't worry too much about it tho, many times the error will be below the mechanical tolerances of your machine components, and you could do a finishing passes at low speed when you need to be more accurate.

  Are you sure? yes | no

Rost wrote 01/24/2017 at 17:05 point

I have more questions. Will you provide print layouts for the board, instructions for controller flashing and capasitors and resistors used? I am not experineced in electronics so any manuals and information will be very helpfull.

  Are you sure? yes | no

ottoragam wrote 01/25/2017 at 23:55 point

Hi Rost! Sorry for the delay, I was a bit busy. The design files and the manual are hosted on Github.

To connect the board to a pc you'll need a USB-serial converter, like the popular FTDI boards. Then you can use a serial terminal program like Realterm to monitor and adjust the parameters for operation. You can use any microcontroller to command the controller to move the motor, just send it some high-low pulses.

  Are you sure? yes | no

Rost wrote 01/26/2017 at 00:25 point

Thank you for answer. I took a look on a board schemе but i noticed it has some polygones and i need to learn how to make it printable for a laser printer mask, because all my experience was just a few boards made long time ago in an old style way.) I wiil try to learn how to make the board scheme printable or i can relay on your recomandation. Maybe you know a good youtube links how to make boards print close to the type of yours. I anderstand my questions are very beginner level, so thank you for your patience.

  Are you sure? yes | no

ottoragam wrote 01/27/2017 at 10:38 point

No worries :) You need to click the Ratsnest button first to fill the polygons. Then activate the pads, vias and top (and then bottom) layers to see only the copper zones on the board. Then go to file-print and check the mirror and black options before you print the mask.

  Are you sure? yes | no

Rost wrote 01/27/2017 at 19:58 point

Thank you. I tried and now it's allmost clear. Next step to order materials and components. Some of them long time to wait. But it's a good hobby time for winter.)

  Are you sure? yes | no

Rost wrote 01/24/2017 at 14:43 point

Hi! Can you recommend simple setup ? I want to make one driver board only and connect it to pc via usb for example. What simple soft i can use just to check dc servo for steps and rotaition besides arduino and grbl?

  Are you sure? yes | no

mitja.kumin wrote 11/24/2016 at 22:33 point

Interesting project! Just what I need to upgrade my CO2 laser stepper motor system. Is there a way to setup the PID parameters and how it is done?

  Are you sure? yes | no

ottoragam wrote 11/24/2016 at 23:31 point

Hi Mitja, I'm glad you like the project! The controller settings, including the PID coefficients can be modified via serial commands. You just need to send a packet like p234; to modify the non volatile values for each parameter. The controller also transmits back the errror value in real time (100 Hz), to make the calibration process easier.

  Are you sure? yes | no

ottoragam wrote 11/24/2016 at 23:37 point

I plan to upload a video of the whole process soon. Give me a day or two and it will be ready :)

  Are you sure? yes | no

mitja.kumin wrote 11/25/2016 at 18:19 point

Fantastic! I will make PCBs this weekend. I will make some tests with yaskawa DC servo motors. My plan is to use these in my machine. I also have some BLDC servo motors, some of them quite massive but they will have to wait for another kind of controller.

About rotary encoder: if math serves me well I can use 600P/R encoder. That would result in 40kHz at 1000RPM. So the encoder frequency would max out (200kHz) at 5000RPM which is way to high for even a 5mm pitch lead screw. This would result in speed of 25m/min. My goal is resolution and with 600P/R encoder i get insane resolution of 2um. In reality this is impossible to achieve on home built machine. 

I will probably go with 400P/R encoder, as this gives me a resolution of 0,02mm with GT2 timing belt (2mm pitch and 16 teeth pulley) and the encoder frequency will max out at 7500RPM which is 15m/min. But that won't happen because motors don't spin so fast.

Instructional video of controller setup would be really great addition and will make the project even come closer to the end user.

  Are you sure? yes | no

ottoragam wrote 11/25/2016 at 20:16 point

Your calculations are correct :) Do you have more info on those servos of yours? I also have the BLDC version of this controller, the hardware works, but I have not done any firmware development beyond a basic commutation test.

I plan to use it on a RF45ish mill build. If you want I can upload the hardware files, but I don't think I'll make any software progress till I complete the Tarocco project.

  Are you sure? yes | no

ottoragam wrote 11/25/2016 at 20:21 point

I also uploaded a user's manual. It is not complete yet, but I think it could be useful. Check the project files section

  Are you sure? yes | no

mitja.kumin wrote 11/29/2016 at 20:28 point

Great I will take a look tonight.

About the servo motors: I have 3 pcs yaskawa minertia motor, model T03M-AR21. I got lucky and got them on MAM Radio Messe in Friedercshafen for 10€/piece. They are not specifically strong but as they can turn faster than steppers I can implement reduction pulley to reduce turning speed and increase torque. 

I really hope you will work on BLDC controller in future. I have projects to use the motors but no controller. The only difficulty could it be that they need higher voltages, like 90V and even 110V. I regularly go on fairs in Italy and Germany to find used industrial ware for small money. The servos are usually without drives :(

  Are you sure? yes | no

mitja.kumin wrote 11/29/2016 at 20:59 point

I read your manual and I have to say that some things are much clearer now. I really appreciate your effort. Writing a manual is a hard task and it takes as much time writing it as it takes for the project development. But in the end there are always few users more because with manual all is explained and immediately known what can be expected prom the project. 

About the design: is this final or will there be some upgrades in the future? 

I have on my mind opto isolation of the inputs/outputs, some way of mounting a heatsink on the transistors if needed (those glue on type sucks).

  Are you sure? yes | no

ottoragam wrote 11/29/2016 at 21:54 point

 That's a amaaazing price for the motors! The only change I have in mind for the controller is moving the step and direction pins to port 0, as port 4 pins cannot connect to the internal programmmable logic of the PSoC. That would allow the controller to potentially handle step pulse frequencies above a MHz, tough I doubt it would be that useful many of us. The other advantage would be the option of decoding a wide variety of signals in hardware, not just only step and direction.

I tought that a good way to heatsink the transistors would be with something like a laser cut 3mm Al sheet that can be installed using the pcb mounting holes. You could even put a 40 mm fan on top.

I use a beaglebone with machinekit to control my machines. As you can see, the optocouplers are on the connector cape. I feel it is more versatile this way, as people who don't need isolation can save a bit of money.

I've tested these boards with H11L1 optoisolators, they're fast, work fine and are not expensive.

The BLDC controller should be able to handle motors up to 150V with the correct FETs and capacitors. I think a good value would be 90V, as higher voltage components start to get kinda expensive from here. Cheap quick switching, low resistance MOSFETS are very rare past ~120 V, in my experience. I am using 75V FETS as of now, cause I only need 48V for my motors, but I think it would be a good idea to change them. There are not many "high voltage" economic controllers out there, as you point out. I'll try to post the BLDC controller files on this site as soon as I can.

And please feel free to ask about anything that's not covered in the manual :)

  Are you sure? yes | no

psykhon wrote 10/27/2016 at 16:17 point

Could you also provide/recomend a more powerfull motor?

  Are you sure? yes | no

ottoragam wrote 10/27/2016 at 20:24 point

Hi psykhon! Would be of use? It is a ~120W unit.  Can you tell me more about your motor requirements? price point? I should be able to supply some other motors, based on the needs of the project followers.

  Are you sure? yes | no

Rainer wrote 10/21/2016 at 11:02 point

Will the new controller board also be open-source/open-hardware like the first one or just closed-source and available to buy from you or crowdsupply?

  Are you sure? yes | no

ottoragam wrote 10/21/2016 at 11:11 point

Hi Rainer! You can check most of the design files for this project here:

Right now there are some minor features missing, and I still need to add the BOM. But you're welcome to ask me anything about the new design (the main change is the microcontroller, Tarocco uses a CY8C4245PVI instead of the Atmega328)

  Are you sure? yes | no

Rainer wrote 10/21/2016 at 11:18 point

Thanks for the github link. :)
I think of replacing my steppers on my little desktop cnc for brushless motors. So i'm quite interested in such a controller which also is affordable. All industrial brushless controller are way to expensive for me.

  Are you sure? yes | no

ottoragam wrote 10/21/2016 at 11:36 point

Yup, I faced the same pricing issue, that's why I decided to make this
thing. Have you chosen the motor yet? Maybe I can convince you to use
some affordable brushed servomotors instead? I plan to provide a full kit for those who have trouble sourcing the motor. It is a 24V 30W motor with a maximum speed of 4000 rpm, with a 1440 pulses per revolution optical encoder.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates