Difference between revisions of "HackCNC Assembly Tips"
(→Electronics Assembly) |
|||
(28 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
=Mechanical Assembly= | =Mechanical Assembly= | ||
− | [https://github.com/CCHS-Melbourne/HackCNC/raw/master/ | + | [https://github.com/CCHS-Melbourne/HackCNC/raw/master/Docs/hackCNC%20-%20Frame%20Assembly%20manual.pdf Get the PDF guide from github] (PDF Link) |
==Mechanical Tips== | ==Mechanical Tips== | ||
Line 7: | Line 7: | ||
* You may need to sand/file some of the wooden pieces before they'll push together. | * You may need to sand/file some of the wooden pieces before they'll push together. | ||
+ | =Electronics Assembly= | ||
+ | |||
+ | Begin with the assembly guide: | ||
+ | |||
+ | [http://www.arduinominiconf.org/index.php/HackCNC_Electronics_Assembly Step by step electronics assembly guide] | ||
− | = | + | ==Connections To Steppers And Servo== |
− | * | + | * The cable order for the stepper motors is red-green-yellow-blue: |
+ | [[File:cableorder.png|200px]] | ||
− | * | + | * Connect the micro servo as shown above. |
=Software= | =Software= | ||
Line 19: | Line 25: | ||
Get the software from the [https://github.com/CCHS-Melbourne/HackCNC HackCNC repository on github]. If you don't use git, click the "ZIP" button to download the repository contents as a zip file. | Get the software from the [https://github.com/CCHS-Melbourne/HackCNC HackCNC repository on github]. If you don't use git, click the "ZIP" button to download the repository contents as a zip file. | ||
+ | [[File:zipfile.png]] | ||
Everything you need is in the Software/ directory. | Everything you need is in the Software/ directory. | ||
Line 49: | 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 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 | * sketchbook directory | ||
Line 86: | Line 77: | ||
The first command creates a file in /etc/udev/rules.d, and the second command restarts the udev daemon. | 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. | * Open (or close and reopen) the Arduino IDE. | ||
Line 96: | Line 87: | ||
* Go to the the Tools menu, Board submenu, and choose "Arduino Leonardo" for the board type. | * 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. | + | * To verify the sketch is correct, click the "tick" icon on the Arduino IDE toolbar. [[File: verify.png|100px]] |
− | * 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. | + | * 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. [[File: upload.png|100px]] | ||
* 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". | * 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". Time to set up LinuxCNC! | + | The final message on the LCD should say "Waiting for LinuxCNC": |
+ | |||
+ | [[File:waitingforlinuxcnc.png|400px]] | ||
+ | |||
+ | Time to set up LinuxCNC! | ||
==LinuxCNC Setup== | ==LinuxCNC Setup== | ||
Line 129: | Line 126: | ||
===Installing on other distributions=== | ===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=== | ===Configuring LinuxCNC=== | ||
Line 135: | 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 | + | * 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 cp ~/linuxcnc/configs/my-mill/3axis_arduino /usr/bin | ||
sudo chmod +x /usr/bin/3axis_arduino | 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=== | ===Using LinuxCNC=== | ||
Line 150: | Line 158: | ||
* Launch linuxcnc (you can just run 'linuxcnc' from a terminal.) | * Launch linuxcnc (you can just run 'linuxcnc' from a terminal.) | ||
− | * Choose "my mill" from the | + | * Choose the "my mill" configuration from the welcome screen that pops up: |
+ | [[File: mymill.png|400px]] | ||
+ | |||
+ | * 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.) | ||
+ | [[File: stoppower.png]] | ||
− | * | + | * You can then use the jog controls to move the motors around. |
+ | [[File: jogcontrols.png]] | ||
− | * | + | * Before the motors will move you'll need to have connected the 12v power, USB power isn't enough to drive them. |
Latest revision as of 04:11, 23 January 2013
Contents
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:
- 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.
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.
- 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".
- 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":
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:
- 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.)
- You can then use the jog controls to move the motors around.
- Before the motors will move you'll need to have connected the 12v power, USB power isn't enough to drive them.