Difference between revisions of "HackCNC Assembly Tips"

From Open Hardware Miniconf
Jump to: navigation, search
(Fix pdf link)
(Electronics Assembly)
 
(One intermediate revision by one other user not shown)
Line 9: Line 9:
 
=Electronics Assembly=
 
=Electronics Assembly=
  
* Soldering headers, capacitors.
+
Begin with the assembly guide:
  
* If possible, solder the capacitors lying down to make room for the LCD panel to sit on top.
+
[http://www.arduinominiconf.org/index.php/HackCNC_Electronics_Assembly Step by step electronics assembly guide]
[[File:sidewayscaps.png|200px]]
+
 
 +
==Connections To Steppers And Servo==
  
 
* The cable order for the stepper motors is red-green-yellow-blue:
 
* The cable order for the stepper motors is red-green-yellow-blue:
 
[[File:cableorder.png|200px]]
 
[[File:cableorder.png|200px]]
  
* Solder the servo header with the tab facing inwards, and connect the micro servo as shown above.
+
* Connect the micro servo as shown above.
  
 
=Software=
 
=Software=
Line 55: Line 56:
 
On Linux, the sketchbook directory is called "sketchbook" in your home directory. On Windows & Mac OS, it is called "Arduino" inside your Documents directory.
 
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:
+
Create the Arduino sketchbook directory, then move the directories "libraries" and "EmcArduino_097b_32u4" from Software/ into it. The final structure should look like this:
 
 
* 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
 
* sketchbook directory
Line 155: Line 140:
 
Your LinuxCNC installation needs some custom configuration to work with the HackCNC.
 
Your LinuxCNC installation needs some custom configuration to work with the HackCNC.
  
* Copy the directory 'linuxcnc' from Software/EmcArduinoFirmware/ to your home directory.
+
* Open a terminal and create the linuxcnc config directories:
 +
  mkdir -p ~/linuxcnc/configs/
 +
 
 +
* Copy the 'Software/my-mill' directory into the configs directory you just created
 +
  mv my-mill ~/linuxcnc/configs/
  
 
* Did you have to use a different serial port to /dev/ttyACM0 when you uploaded your Arduino sketch to the HackCNC? If so, then edit the script ''~linuxcnc/configs/my-mill/3axis_arduino'' and change the serial port name there as well (it will be same as you used in the Arduino IDE.)
 
* Did you have to use a different serial port to /dev/ttyACM0 when you uploaded your Arduino sketch to the HackCNC? If so, then edit the script ''~linuxcnc/configs/my-mill/3axis_arduino'' and change the serial port name there as well (it will be same as you used in the Arduino IDE.)

Latest revision as of 04:11, 23 January 2013

Mechanical Assembly

Get the PDF guide from github (PDF Link)

Mechanical Tips

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

Electronics Assembly

Begin with the assembly guide:

Step by step electronics assembly guide

Connections To Steppers And Servo

  • The cable order for the stepper motors is red-green-yellow-blue:

Cableorder.png

  • Connect the micro servo as shown above.

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. Zipfile.png

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 move the directories "libraries" and "EmcArduino_097b_32u4" from Software/ into it. 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.

Verifying and Uploading the Firmware

  • 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. Verify.png
  • 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. Upload.png
  • 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".
  • A few seconds after the firmware uploads you should see some messages coming up on the LCD panel. If you don't see any messages, it means there was either a problem uploading the sketch or a problem with the solder connections on the LCD panel.

The final message on the LCD should say "Waiting for LinuxCNC":

Waitingforlinuxcnc.png

Time to set up LinuxCNC!

LinuxCNC Setup

You can either just use a prepared LinuxCNC USB stick, or install and configure it yourself on your computer.

Easy Way

If you get a LinuxCNC USB stick, as prepared by John, then you can boot into a pre-prepared LinuxCNC environment.

Installing on Ubuntu/Debian

To install LinuxCNC on an Ubuntu/Debian system, navigate to http://buildbot.linuxcnc.org/ and follow the steps to set up a new package source /etc/apt/sources.list.d/linuxcnc-buildbot.list

You want the v2.5 branch, simulation version, for your distro (ie v2.5_branch-sim).

If you're on Ubuntu 12.10 (Quantal), then the steps for Ubuntu 12.04 (precise) will work fine without any changes.

Follow the rest of the steps on that page to install the linuxcnc-sim package:

 sudo apt-get update
 sudo apt-get install linuxcnc-sim

Installing on other distributions

Unfortunately we haven't had time to do test installs on any distribution other than Ubuntu.

However...

These instructions while aimed at ubuntu should give you an idea as to what dependencies linuxCNC has and should let you build it from source.

http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Build_A_Simulator_Manually

And there is some more information here http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Installing_EMC2 - you want the 'simulation' version of the 2.5 branch, ignore anything about 'realtime' or kernel extensions.

Configuring LinuxCNC

Your LinuxCNC installation needs some custom configuration to work with the HackCNC.

  • Open a terminal and create the linuxcnc config directories:
 mkdir -p ~/linuxcnc/configs/
  • Copy the 'Software/my-mill' directory into the configs directory you just created
 mv my-mill ~/linuxcnc/configs/
  • Did you have to use a different serial port to /dev/ttyACM0 when you uploaded your Arduino sketch to the HackCNC? If so, then edit the script ~linuxcnc/configs/my-mill/3axis_arduino and change the serial port name there as well (it will be same as you used in the Arduino IDE.)
  • Copy the 3axis_arduino script to /usr/bin and mark it executable. You can do this by running the following commands in a terminal:
 sudo cp ~/linuxcnc/configs/my-mill/3axis_arduino /usr/bin
 sudo chmod +x /usr/bin/3axis_arduino

NB: If you'd rather not copy this file to /usr/bin/, you can optionally edit the file linuxcnc/configs/my-mill/custom.hal and change the path to 3xaxis_arduino, near the top of that file.

Using LinuxCNC

  • Launch linuxcnc (you can just run 'linuxcnc' from a terminal.)
  • Choose the "my mill" configuration from the welcome screen that pops up:

Mymill.png

  • To start jogging the stepper motors, first disable the E-Stop button (top-left on the toolbar) and then turn on the "machine power" (second to top-left on the toolbar, a virtual power button in our case.)

Stoppower.png

  • You can then use the jog controls to move the motors around.

Jogcontrols.png

  • Before the motors will move you'll need to have connected the 12v power, USB power isn't enough to drive them.