Hydra-MMM Software and Firmware

From RepRap
Jump to: navigation, search

This page is a development stub. Please enhance this page by adding information, cad files, nice big images, and well structured data!

Crystal Clear action run.png
Hydra-MMM Software/Firmware Releases

Release status: unknown

Hydra-MMM logo.jpg
Java host software with Arduino firmware
CAD Models
External Link


The Hydra-MMM software and firmware can be downloaded here: https://sourceforge.net/projects/hydra-mmm/

Project Background

Hydra is a multi-headed manufacturing machine that is originally being designed and built for ME463 (senior design) at Purdue University. The general idea is to make a personal manufacturing machine that will be able to perform multiple, simultaneous operations such as milling, additive prototyping, pcb fabrication, laser etching, etc. For the most part, current industrial workplaces have dedicated machines for each one of these functions. By having multiple independent toolheads on the machine, Hydra will be able to perform compound operations that are not possible on dedicated machines (ie FDM rapid prototyping and milling for more accurate part outlines). Hopefully the project will lead to potential discoveries of new manufacturing techniques through the use of compound operations, as well as create a very cost effective product for small business or educational institutions who cannot afford current commercial machines.

The Sourceforge project will contain the microcontroller firmware and host software for the machine. The firmware was written in the Arduino development environment (http://www.arduino.cc/) and is currently being used on an Arduino Mega microcontroller. The software is written in the Processing development environment (http://processing.org/) and is written in Java. Because of this the host software can be run on Windows, Mac OS, and Linux operating systems. The software and firmware communicate via a serial interface. Standard machine language (Gcode) as well as custom M codes are being used for communication.

Please see: http://cpwebste.blogspot.com/ for more information about the build or https://sourceforge.net/projects/hydra-mmm/ for all future software and firmware releases

A reprap wiki development page for the details of the machine has also been created here Hydra-MMM_Prototype

A screenshot of the GUI is below:

Hydra-MMM v1 0 screenshot.jpg


Hardware: The firmware is only supported on the Arduino Mega as that is the only chip I have available to test with, however, the code is small enough that it should fit on a Duemilanove with an Atmega328 microcontroller. Due to the size of the firmware, the Duemilanove with an Atmega168 microcontroller is not supported at this time. The host software is written in Java and has been tested successfully on Mac, Windows, and Linux systems.

Firmware: After downloading the latest release please copy the Arduino libraries (cpwStepper and PID_Beta6) to the Arduino Sketch Folder/libraries/. The Arduino sketch folder can be changed from the Arduino preferences menu. If the libraries folder does not current exist, please create it and copy the files there. Next, use the Arduino software to open the Arduino .pde sketch in the editor. Look through the top of the code and change the necessary pin declarations and variables. This includes selecting if you will use step/dir control (for external motor drivers) as well as defining the pin locations for these drivers. Please double check these to ensure they match your setup before proceeding. Once all your variables have been defined, click the upload button to send the sketch to your Arduino compatible microcontroller!

Software: The host software can be run from the /Processing/*release*/application.your_operating_system folder. The Processing .de sketch can also be placing in the Processing application and compiled and run from there. A USB serial connection must be established between your computer and the microcontroller before running the software. Please see the Arduino and Processing websites and forums if you have any trouble with USB serial drivers. Once the software starts, click the "Connect" button to get going and follow the onscreen prompts. If you wish to make changes and compile the Software yourself using the Processing development environment make sure to move the controlP5 library into the "libraries" folder in your Processing sketch folder (make the folder if it does not exist).

Gcode File Preview: The file preview function can be used without connecting an Arduino to the serial interface. Just run the processing program and you press the "File Preview" button to preview a gcode file. A sample gcode file is included in the release.

Communication Protocol

Standard machine language (gcodes) were used to communicate to the machine. A listing of the currently available G and M codes are below.

Gcode References

G0 - rapid positioning, input X Y Z, syntax: G0 X1.25 Y0.025 Z0.0

G1 - linear interpolation, input X Y Z F(feedrate in inch/min or mm/min depending on unit sys), syntax: G1 X1.5 Y0.5 Z0.0 F10.0

G4 - dwell, input P(dwell time in ms), syntax: G4 P115.0

G20 - inch unit system

G21 - millimeter unit system

G30 - set reference point 1

G31 - return to reference point 1

G32 - set reference point 2

G33 - return to reference point 2

G90 - absolute coordinate system

G91 - incremental coordinate system

G92 - set current position, input X Y Z, syntax: G92 X0 Y1 (set current position as X=0.0, Y=1.0, and Z remains unchanged)

Mcode Reference

M2 - stop program

M3 - spindle on, CW

M4 - spindle on, CCW

M5 - spindle off

M44 - enable min software endstops

M45 - disable min software endstops

M46 - enable max software endstops

M47 - disable max software endstops

M48 - max speed override, input F(new max feedrate), syntax: M48 F100.0

M49 - disable speed override

M50 - change step mode, input X Y Z, syntax: M50 X1 Y1 Z4 (set x and y axes to full torque and use 4x microstepping on z)

M60 - turn acceleration on

M61 - turn acceleration off

M70 - debugging mode on

M71 - debugging mode off

M101 - extruder on, forward

M102 - extruder on, backward

M103 - extruder off

M104 - set extruder temperature, input S, syntax: M104 S200 (set target temp to 200 deg C)

M106 - turn fan on

M107 - turn fan off

M201 - turn light on

M202 - turn light off

Tcode Reference

T0 - switch to tool 0, default tool by which all other tool offsets are measured from

T1 - switch to tool 1

T2 - switch to tool 2

T3 - switch to tool 3

T10 - home all z axes, lower each z axis until it hits its software/hardware min endstops

T11 - level all z axes, this will move all z axes so the toolhead tips are all at the same height assuming the toolchanger array values are set correctly

T14 - set desired active toolhead clearance, input P, syntax: T14 P0.5 (set clearance to 0.5 inches), required for milling or any other operation where the toolhead tip drops below workpiece height

T15 - move all non-active toolheads to achieve desired active toolhead clearance

T20 - complete toolhead startup routine


Purdue University for supporting and inspiring the original machine. Original design team consisted of 6 members who may or may not want their names released to the public.

The Reprap project for much of the inspiration for the original machine.

Arduino and Processing development environments for making a great piece of software that is very versatile and easy to use.

The very easy to use controlP5 library written by Andreas Schlegel (http://www.sojamo.de/libraries/controlP5/)

Brett Beauregard for the PID Library for the Arduino Playground that is used for temperature control (http://www.arduino.cc/playground/Code/PIDLibrary)



- Acceleration is now supported and computed using kinematics (no linear approximations here!). The computations are performed before each move and have been optimized to reduce CPU and SRAM usage.

- Added support for several T (toolhead) commands for managing up to 4 independent toolheads. See above for list of new commands. Also note that there are new parameters that must be declared if multiple toolheads are to be used. See the top of the firmware.

- Added support for physical max and min endstops on each axis

- Maximum software endstops added in case physical max endstops are not available

- PID temperature library and cpwStepper library are now options and can be excluded from the firmware if it is not desired

- GUI now supports M105 command to receive temperature from the firmware and print to screen

- Fixed bug with time to move calculation being dependent on the x axis

- Lots of optimization to get the firmware small enough to fit on the ATmega328 (reduced total firmware size more than 6KB!)

- Serial baud rate changed to 19200 for compatibility with Reprap and Makerbot hardware


- Added automated port selection and authentication sequence, now there is no need to manually select what COM port to use, it will find the correct one automatically!

- Added mouse manipulation support for gcode preview window, L mouse moves offset, R mouse up/down changes zoom

- Significantly reduced CPU intensity for file preview window. Scaling and moving parts after >5000 lines have been drawn is still somewhat slow on my old computer though so it would probably be a good idea to position the screen at the beginning of a large build and then leave it. Playback with large builds is very fast, it is just the scaling and moving that takes CPU cycles

- File preview window for sending gcode files has dynamic color updating to give maximum 3D representation on a 2D plane

- Changed G92 command to accept desired set position instead of just set current position as 0,0,0

- Bug fix for how preview window deals with negative coordinates

- G4 delay time was changed to use milliseconds (Reprap standard) as opposed to seconds (CNC standard) by request. If you want it to be seconds just add a *1000 in the delay command


- Extruder support added that automatically determines correct extruder speed based on XYZ specified federate

- Support for external motor drivers added, the option is now at the top of the firmware to choose to use dir/step method (for external driver) or defining each coil and using MOSFET transistors or something of that nature (see below)

- Wiring diagram added by request to show how to hook up a stepper motor without an external motor driver

- Made preview window larger and added ability to change the size easily in the Processing sketch (variables pw_width and pw_height)

- Sample gcode file added by request


- First release on sourceforge!

- GUI now includes ability to preview gcode files as well as a realtime viewer for showing what commands are currently being sent to the machine

- Ability to send and control temperature via PID control has been added

- Custom microstepping library was written to allow for simplified control of stepper motors

- Stepping mode can be changed on the fly (includes wave drive, full torque, half stepping, and microstepping from 4x-64x)