HackCNC Assembly Tips

From Open Hardware Miniconf
Revision as of 23:16, 15 January 2013 by Angus Gratton (talk | contribs)
Jump to: navigation, search

Mechanical Assembly

Get the PDF guide from github

Mechanical Tips

  • You may need to sand/file some of the wooden pieces before they'll push together.


Electronics Assembly

  • Soldering headers, capacitors.
  • If possible, solder the capacitors lying down to make room for the LCD panel to sit on top.

Software

Getting The Software

Get the software from the HackCNC repository on github. If you don't use git, click the "ZIP" button to download the repository contents as a zip file.

Everything you need is in the Software/ directory.

Programming the Arduino

You need use the Arduino IDE to upload a firmware program to the HackCNC board.

Arduino programs are called sketches. The firmware sketch, "EmcArduinoFirmware", makes a bridge between the LinuxCNC software (also called EMC), and the interfaces on the HackCNC board.

Getting the Arduino IDE

On Linux

Get the Arduino software the same way you usually install software, from your Linux distribution's package manager. For example from the Ubuntu Software Centre, Fedora Package Installer, or from a terminal with apt-get install arduino or yum install arduino.

You will need Arduino 1.0.1 or newer. If your Linux system has an older version then you may want to download the newer version direct from the Arduino site.

On Other OSes

Download Arduino from the Arduino website.


Installing Libraries

You need to install some libraries into your Arduino's sketchbook directory. The libraries are used by the firmware sketch.

Create Directories

On Linux, the sketchbook directory is called "sketchbook" in your home directory. On Windows & Mac OS, it is called "Arduino" inside your Documents directory.

Create the Arduino sketchbook directory, then create a subdirectory "libraries" inside it:

  • sketchbook directory
    • libraries

On Linux, you can do this from the command line by opening a terminal and typing:

 mkdir -p ~/sketchbook/libraries


From the HackCNC directory Software/EmcArduinoFirmware, copy the folders "digitalWriteFast" and "NewLiquidCrystal" into the libraries folder. The structure should look like this

  • sketchbook directory
    • libraries
      • digitalWriteFast
      • NewLiquidCrystal

Then copy the EmcArduino_07b_32u4 directory directory to the sketchbook directory itself. The final structure should look like this:

  • sketchbook directory
    • EmcArduino_07b_32u4
    • libraries
      • digitalWriteFast
      • NewLiquidCrystal

(Linux) disabling modem-manager

On my Linux distro (Ubuntu 12.10) I found that the built-in "modem-manager" made it very hard to upload a sketch correctly (Arduino IDE says "Upload Completed" but nothing was actually uploaded.) We need to tell Modem Manager to ignore the Freetronics bootloader on the HackCNC board.

If you are on a recent Linux distro (definitely recent Ubuntu & Fedora) with network manager or modem manager, you may need to do this as well. If you're not sure if you have to do this, it won't hurt to do it anyhow.

Open a terminal window and carefully run these two commands:

 echo -e '# Freetronics\nATTR{idVendor}=="26ba", ENV{ID_MM_DEVICE_IGNORE}="1"' | sudo tee /etc/udev/rules.d/77-mm-blacklist-freetronics.rules
 sudo /etc/init.d/udev restart

The first command creates a file in /etc/udev/rules.d, and the second command restarts the udev daemon.

Loading and Flashing the Sketch

  • Open (or close and reopen) the Arduino IDE.
  • Go to the File menu and the Sketchbook submenu. You should see "EmcArduino_07b_32u4" in the list of sketches. Select this sketch to open it.
  • If you can't see "EmcArduino_07b_32u4" in this list, check your sketchbook directory is in the right place (see the previous section.)
  • Go to the the Tools menu, Board submenu, and choose "Arduino Leonardo" for the board type.
  • To verify the sketch is correct, click the "tick" icon on the Arduino IDE toolbar. After a little while you should see a message "Done Compiling" towards the bottom of the IDE window. If you see "Error Compiling" then something has gone wrong, look at the message and try to guess what's happened - it may be one of the libraries is not in the right place.
  • To upload the sketch to the board, connect the HackCNC to a USB port and then press the Arrow icon (next to the tick icon) on the Arduino toolbar.
  • If you get an error uploading the sketch, you may need to choose a different serial port (under Tools -> Serial Port.) On Linux, the serial port name will start with "/dev/ttyACM".