Let's Make Robots!

DAGU CNC mill controller - first prototype

I've been developing a CNC controller for DAGU. The project originally started late 2012 but got shelved because of other projects. Now we've dusted it off and plan to finish it in the next 6 months. Unfortunately blog post don't support video so watch the video that explains the basics by clicking on the link.

The controller is a 5-axis controller although the default configuration is 3 linear axises X,Y,Z. An additional 2 rotary axises can be setup in the configuration menu. The prototype controller shown in the video could only deliver about 1.5A per stepper motor winding. The new version being developed can deliver 3.5A continuous to each winding if required.

The display is 240x128 which provides enough resolution for a text display of 40x16. This is ideal for navigating an SD card with numerous files and directories. Being a graphics display it also allows us to produce a basic preview of the job before machining begins.

The display is not a touchscreen, your hands can get quite dirty and oily when working on a mill so a touch screen is not the best idea unless your going to clean your hands every time you want to use it.

As mentioned in the video, once the job has been selected, the controller scans the file. During this scan the gcode is read and the dimensions of the job are determined. This allows the controller to make various automatic calculations and warn you if there are any potential problems with the gcode. A preview of the job can also be displayed so you can confirm the correct file was selected.

DAGU is working in conjunction with a machine center specialist to develop an affordable, precision milling machine that can produce aluminium, wood and plastic parts.


The MkII controller is currently under development. It has more powerful stepper drivers and more features than the MkI prototype.

MkII Controller Specifications:

  • ATmega2560 @ 16MHz with 8K SRAM, 4K EEPROM and 256K FLASH memory (with Arduino bootloader)
  • ATmega8A @16MHz with 1K SRAM, 512 Bytes EEPROM and 8K FLASH memory (no bootloader)
  • 5 inch (125mm) white on blue, backlit 240x128 LCD display with brightness and contrast controls
  • 1x USB, 1x Bluetooth and 1x Xbee / WiFi serial port
  • I2C interface (3.3V and 5V)
  • SD card socket
  • DS1307 RTC
  • Input voltage 12V - 24V (40A maximum)
  • 5 axis controller (5 stepper motor drivers built in)
  • Stepper driver peak current - 3.5A per motor winding
  • Stepper driver adjustable current - 20%, 50%, 75% and 100%
  • Stepper driver resolution - full, half, 1/8th and 1/16th steps (current prototype achieves 1/100th mm resolution with 1/2 steps)
  • Stepper driver thermal overload protection and thermal trip outputs
  • 2x PTC fused, 4A motor drivers with speed and direction control for cutting tool motors
  • 2x Hall effect sensors inputs for regulated cutting tool speed control
  • 2x PTC fused, 2A motor outputs with PWM only for cutting fluid pump and blower / fan
  • 3x external temperature sensor inputs (optional)
  • 2x internal teperature sensors (ambient and heatsink)
  • All PTC fuses monitored by controller
  • Cooling fan speeds monitored by controller
  • Thermal overload outputs monitored by controller
  • Hardware emergency stop monitored by controller
  • Software controlled emergency stop if thermal overload or blown fuse detected
  • Key and code lockout for child safety






Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

You've been hackadayed. DAGU: The Standalone CNC Controller

Hooray! I've been hacked!

If you are already using the Mega, consider the Digix: http://digistump.com/products/50

For $10 more than the Mega, you get built in WiFi, twice the I/O pins, RTC, microSD slot, plus all the trimmings you are already using. It would be trivial to make a web driven UI to go with this controller as well. And you can probably use all of your existing code! :)

It would be awesome (really really awesome) if this were flexible enough to be used as a 3d printer controller as well. I hope you decide to open source your code as I've been considering doing this on the Digix already.



The controller does not use an "Arduino Mega2560", it just uses the same processor and bootloader so that it can be programmed with the Arduino IDE. This makes it very "Hacker Friendly".

I had considered making the controller "Arduino DUE" compatible and I might with future versions of this controller. For now the ATmega2560 does everything I want it to with the ATmega8A just working as a stand alone speed controller that monitors the cutting motor encoders and ajust the PWM to maintain constand speed with changing load.

As my controller already has the option of adding Bluetooh, Xbee or WiFly I don't see any advantage to trying to copy the Digix.

The digix is $10 more than an arduino mega board yes, but this doesnt use an arduino mega board. It uses the AtMega 2560 chip at the core of an arduino mega board (making it arduino mega software compatible, just not shield compatible).

Doesnt mean I disagree with you. The atmel ARM chips if anything are cheaper than their AVR counterparts, but they are less straight forward to design boards for and also program (in terms of uploading code, they require more specialised hardware which if featured onboard pushes the board cost up or requires the owner to have external tools).

My suggestion was why not make the controller a "shield" connection. The Digix is 100% code compatible with the Due (not just shield compatible), so it's not any harder to program for than any other Arduino clone. And when one of your stepper drivers goes up in smoke, you can simply replace the controller shield rather than replace your whole device. You don't even lose your firmware or config settings!

IMHO, a single monolithic controller card (especially in the experimental stages) tends to be a nightmare to trouble-shoot when things go wrong, and modular designs tend to be both easier to understand, repair, and to hack. This is my experience working with 3D printers anyways.

Just my 2 cents! :)

If I was to do as you suggested then the Digix would be a processor shield for the controller.


The processor is the cheapest part. Why bother to make it a separate shield? You just increase the risk of a bad connection and make the whole product less reliable.

The controller is not about to go up in smoke as it has thermal overload and short circuit protection. Temperature sensors prevent it even reaching the stage of thermal overload.

On a very hot day the software might limit the maximum power used (run in reduced power mode) so that in a worse case senario your job takes a little longer to process.

The software also monitors the PTC fuses and cooling fans. If a fan starts to run slow then the controller will warn you that it needs to be replaced. If a fan fails then the controller can monitor the heatsink temperature and run in reduced power mode to complete the job.

If a stepper driver's thermal overload pin goes low or a fuse open circuits the controller initiates an emergency stop and the 24V supply is immediately disconnected.

Is the controller generating the step and direction output itself? It looks like you're using Mach3 to produce the gcode but not using Mach3 to control the steppers, right?

What kind of processor is on the Dagu controller? Generating the preview has got to take some serious number crunching work.

What is your contribution to the project? Are you designing the interface hardware? Stepper driver hardware? Software?

Any chance of seeing pictures of the guts of the controller? 

It sure seems like a very intense (and interesting) project.

Gcode comes in many different variations (flavors) as is evident by the extensive list of post processor options offered by Freemill.

We are not using Mach3 at all. Freemill is simply emulating the code that Mach3 would produce. This was used in the test phase because of the simple nature of the gcode output. When I have more time I will teach the controller to recognise and process a full range of gcode.

The controller uses an ATmega2560. This processes the gcode, scans the keypad, home switches, limit switches, drives the steppers and updates the display. The new version being built now has a slave ATmega8A that is dedicated to monitoring the cutting tool motors and maintaining them at the correct speed as the load changes.

Before you get too excited and suggest changing to a propeller, although the propeller offers better number crunching power it also is crippled by a complete lack of I/O pins and internal memory.

I would have to use a handful of serial shift registers, memory chips and other hardware to do the same job as the ATmega2560. Then all the outputs would be at least 9 times slower anyway by the time you serial shifted 8 bits of data and  updated the output latches.

To use a propeller would make the controller much more expensive. It would be more complicated to design and to program.


I'm trying to recall if I've ever suggested you use a Propeller. I can't think of any.

I don't know enough about the ATmega2560 to claim the Prop would be a better chip for this application. And believe it or not, I don't think I was going to suggest it. And I'll try not to get too excited.

I misunderstood the Mach3 statement. Thanks for clearing that up. It makes more sense to me now.

I really like the idea of having a CNC controller that can be independent of a PC.

Having the controller able to graphically display the item is an added bonus.

One feature I think would be cool is if you could enter some simple cuts right into the controller without needing to use a PC at all. For example, say you wanted to cut a simple polygon. Wouldn't it be convenient if you could enter the coordinates of the vertices of the polygon and have the machine cut it out? I don't really know enough about this to know if this would be asking too much, but IMO, it would be a really cool feature if one didn't have to generate the gcode on a PC first. Darn, I did get too excited!

You mentioned this is part of a milling machine Dagu plans to produce and it's also pretty clear the controller includes the stepper drives. Are there plans to sell the controller separately?

If the controller would output step and direction pulses, I'd think it could be used with a lot of different stepper drivers. I'm sure I'm not the only one who would like to free their stepper controllers from a PC.