ShapeOko desktop CNC mill build

When my WyoLum buddy in Boston, Kevin Osborn, built his “CNC AlaMode“, I just had to make one for myself too. Here’s how my build progressed.

I ordered the Mechanical Kit from Inventables with Dual Y-Axis motor upgrade– without any motors or electronics. For good measure, I also added in two lengths of MakerSlide, hoping to extend the axes at a later date. Being on the other side of the globe has its disadvantages, and it took almost two months after ordering the kit before I could lay my hands on it in April.

There were a few small bits and pieces missing, but nothing that I couldn’t replace from my local collection of hardware.

DSCN0872

The mechanical assembly seemed straightforward. But first order of business was tapping all the MakerSlides with a 5mm tap. The full kits come with the slides already tapped, but the Mechanical only kits need to be tapped. This is not something that can be rushed, even though it was a hefty 5mm tap in an open-ended hole – one slip of concentration, and it is highly likely you’ll end up snapping a tap inside the hole.

DSCN0885

Aluminum is a pretty “sticky” material, so make sure you lubricate the taps with cutting fluid while tapping. In between tapping the holes – so I wouldn’t get bored and snap a bit – I simultaneously went about assembling some of the other parts.

DSCN0883

I did the initial assembly, but could not proceed further until I could manage to buy the stepper motors locally – which were out of stock.

DSCN0889

Meanwhile, I moved my attention to assembling the electronics. The computer for the ShapeOko would be a Raspberry-Pi, the microcontroller would be our very own AlaMode – an Arduino clone board, and the GRBLShield from Synthetos would drive the Motors.

DSCN0880

DSCN0881

My plan was to put together a control box to house all the electronics. Here’s the full BoM :

DSCN0897

DSCN0899

DSCN0900

DSCN0907

Once the motors arrived, I was able to complete the rest of the build quickly. One of the changes I made was to move the Y-axis drive pulleys on the outside. I had to move the Y-axis motors further away from the mounting brackets by about 20mm to accommodate the change. This extended the X-axis range by almost 40mm.

DSCN0906

To do the initial “pen writing” trials, I made an aluminum block to allow mounting various types. My very first trial of the “ShapeOko” hello world was a mirror image. Turned out the dual Y-axis motors were running in reverse. I flipped a coil connection on both the motors, and the second trial was correct. I made a few more trials, using different pens, and printing some geometric patterns to check for any obvious errors in the right angles, circles and dimensions.

DSCN0910

Once the pen trials were done, I mounted the 300W, 48V DC spindle with ER-11 collet, that I got off eBay.

300W Spindle

Raspberry-Pi Setup
I’m not much of a software guy, so I mostly followed the nice set of instructions on the Adafruit Learning System – to install the OS and utilities on the SD Card. It’s important to set up SSH and also remote control using VNC or similar. This allows you to log in to the Raspberry-pi from a remote computer.

Next step would be to set up the AlaMode on the Raspberry-Pi. Detailed instructions are available at this link : AlaMode User Guide – http://goo.gl/DtQy3

Once Alamode setup is complete, it’s time to flash “GRBL” on the AlaMode. I downloaded the HEX file for GRBL Version v0.8c – http://bit.ly/SSdCJE – and flashed it on the AlaMode using XLoader. My Linux-Fu was not strong enough to figure out how to flash the HEX code directly from the Raspberry-Pi to the AlaMode.

XLoader

The final piece in the software chain was a means of sending a G-code file from the Raspberry-Pi to the ShapeOko. Initially, I tried “Universal G-Code Sender (https://github.com/winder/Universal-G-Code-Sender)”, but that runs on Java.

PrnScreen_01

Unfortunately, running UGCS slowed down my Raspberry-Pi to a crawl. The reason, it seems was that the Adafruit Occidentalis can only handle soft-float operations. The regular Raspbian OS can handle hard-float operation, and thus runs Java code more efficiently / faster. While trying to improve the situation, my luck ran out, and I ended up messing up the OS. Took me a fair bit of trial and error (and lots of hair-pulling) to get the Ras-Pi running correctly again.

At which point I decided it was just not worth the effort to continue using Java on the Raspberry-Pi, and I looked around for better options. Luckily, I found an awesome G-Code sender specifically written for GRBL, called GRBLController, by Zapmaker. There were some initial issues, like not being able to set up the Alamode port (TTYS0), etc. But a couple of exchanges with the author, and he quickly sorted it all out. We sent an AlaMode to Zapmaker for him to test it out – you can read his blog report on the Alamode.

PrnScreen_02

One of the first jobs I cut on the ShapeOko was a circular ring illuminator PCB which uses 12 LED’s to light up the cutting area under the spindle.

Photos here and here

DSCN0918

DSCN0929

PCB Milling Video

Next on my list of things to do is

  • Fixing end-stop / homing limit switches.
  • Make schematic for the control panel I built, and post it in my next blog post.
  • Describe the process for milling PCB’s on the ShapeOko

Announcing: KiCad workshop at Nova Labs

Hey!  Great news.  Its time to take that project from breadboard to printed circuit board.  Anool (WyoLum co-founder and master designer) will be leading a workshop on KiCad in Northern VA at NOVA Labs September 13-15, 2013.  Sign ups now available.  Limited to first 15 students.

The goal of the weekend is for each student to complete a design, ready for submittal to a fabricator like OSHPark.

 

Project ideas:

  • Custom Arduino compatible board
  • An Arduino shield
  • Motor controller
  • Clock (our favorite)
  • Custom NeoPixel board

We came up with this project while brain storming ways to offset the travel expenses for Anool’s to attend the Open Hardware Summit.  This seems like the best way to expand the Open Hardware movement and attain our funding goals.

You will learn how to take a project …

from a sketch

 

to schematic

to layout

to 3D view

to real life

 

 

Programming ClockTHREEjr_v2

At some point, you may wish to re-program your ClockTHREEjr_v2 or maybe you are building a clock from scratch.  This post will walk you through the steps.

Outline:

  1. Download and install Arduino for your target platform.  (More details can be found here.)
    • Navigate to the Arduino download site: http://arduino.cc/en/Main/Software
    • Download Arduino for your platform.
    • Unzip the file to the directory of your choice.  (We will refer to whatever directory you choose as <arduino_dir>).  I use c:\arduino\ on Windows or /home/justin/arduino/ on Linux so that (for arduino 1.0 for instance) the path extracted executable is c:\arduino\arduino-1.0\arduino.exe on Windows or /home/justin/arduino/arduino-1.0/arduino on Linux.
  2. Download and install ClockTHREE source code
    • Download the latest ClockTHREE library source code file from here: http://code.google.com/p/clockthree/downloads/list
    • Unzip the library source code file in your home directory. I use “My Documents\sketechbook\” on windows and /home/justin/sketchbook/ on linux.  We will refer to the directory you choose as <sketchbook>.
  3. IMPORTANT: Point Arduino to your newly extracted library files.
    • Start arduino (look here if you have trouble with this step)
    • Click File->Preferences to pull up the preferences menu.
    • Leave “Use external editor” unchecked if you plan on using Arduino as your editor.
    • Click the “Browse” button and navigate to your <sketchbook> directory from step 2.
    • Click “OK”.
    • Close and restart Arduino
    • Click “File->Sketchbook->libraries”.  If “ClockTHREE” is listed you’ve done well.
  4. Using a text editor, edit source code:
    • On or about line 32 of <sketchbook>/libraries/ClockTHREE/examples/ClockTHREE_04/ClockTHREE_04.ino, comment out all but one of the following lines depending on language and hardware.
    // #include "dutch_v1.h"
    // #include "english_v0.h"
    // #include "english_v2.h"
    #include "english_v3.h"
    // #include "french_v1.h"
    // #include "german_v1.h"
    // #include "german_v3.h"
    // #include "german_v5.h"
    // #include "hebrew_v1.h"
  5. Compile and upload
    • Connect the FTDI cable to ClockTHREE (mind color labels) and to your computer.
    • Click Tools->Boards->Duemilanove
    • Select USB port Tools->Serial Port (this may take some trial and error if you have several devices connected).
    • Compile and upload <sketchbook>/libraries/ClockTHREE/examples/ClockTHREE_04/ClockTHREE_04.ino.
      Click the arrow button, second from the right.  
  6. Congratulations!  That is it.  Now you can customize the code to your hearts content!

p.u.l.s.e. – fader control for Motorcycle parking Lamp

My brother is a Mechanical Engineer who loves his KTM Duke 200 bike. He asked me to build this circuit : http://sunbizhosting.co.uk/~spiral/blog/?p=227 for a ‘heartbeat’ lamp controller for the parking light. A Neutral Detect (ND) signal controls the lamp pulsing. When ND is HIGH, the Lamp is fully lit. When ND goes LOW, the lamp starts pulsing.

I’m not familiar with PIC microcontrollers, and didn’t want to dabble in “C” code. I’d be comfortable with an Arduino, but even the smallest ATMega seemed too big (and overkill) for this simple requirement. How about an ATTiny ? A bit of Googling, and I found this excellent resource for running the Arduino environment on the ATTiny : http://hlt.media.mit.edu/?p=1695

Time to churn out a circuit. I selected the ATTiny45 which has 6 I/O pins, with two of them being PWM, and three Analog. The schematic and board layout (in KiCad) can be found on the wyolum code repository at Google Code. The idea was to have a board that plugs in to the existing lamp socket. The board size is about the same as a T10 lamp. A new socket is wired to the p.u.l.s.e. board which then attaches to the lamp. A third wire from the p.u.l.s.e board goes to the Neutral Detect (ND) signal in the bike. This makes the installation clean and simple.

3D render of the p.u.l.s.e. board

3D render of the p.u.l.s.e. board

3D render of the p.u.l.s.e. board

The 6 way header is ICSP for programming the ATTiny.

p.u.l.s.e boards

p.u.l.s.e. boards

p.u.l.s.e. boards

Assembled p.u.l.s.e board

Assembled p.u.l.s.e board

Assembled p.u.l.s.e board

Green wire is for ND signal. Red and Black go to a Lamp socket. The p.u.l.s.e board plugs in to the original lamp socket.

Now for the Important bits – getting Arduino to run on the ATTiny. These are the steps :

PHASE I – Get the ATTiny boards.txt files
1. Download ATtiny hardware description files for the Arduino environment from here : https://github.com/damellis/attiny/zipball/Arduino1
2. Create a sub-folder called “hardware” in the Arduino sketchbook folder (find its location from preferences dialog in Arduino IDE)
3. Copy attiny folder from inside the downloaded .zip to the hardware folder. You should end up with folder structure like Documents > Arduino > hardware > attiny that contains the file boards.txt and another folder called variants.
4. Restart the Arduino IDE.
5. You should see ATtiny entries in the TOOLS > BOARD menu.

PHASE II – Hook up the ATTiny to the Programmer (Arduino Duemilenove)
6. I used an Arduino Duemilenove board as the Programmer. There are other options (see the original post).
7. Plug the ATTiny in to a prototyping board, and link up wires between the Arduino and the ATTiny as follows :
ATTiny <-> Arduino
Pin 1, RESET <-> Digital Pin 10, SS
Pin 2, NC <-> x
Pin 3, NC <-> x
Pin 4, GND <-> GND
Pin 5, MOSI <-> Digital Pin 11, MOSI
Pin 6, MISO <-> Digital Pin 12, MISO
Pin 7, SCK <-> Digital Pin 13, SCK
Pin 8, VCC <-> 5V

8. Load ArduinoISP sketch in to the Arduino IDE. This sketch can be found under the examples menu.
9. For ARDUINO 1.0, find the line in the heartbeat() function which says “delay(40);” and change it to “delay(20).
10. Download this modified ArduinoISP sketch to the Arduino Duemilenove board.
11. Connect a 10uF, 16V electrolytic capacitor on the Arduino Board, between the RESET and GND pins. [+] of cap. goes to RESET and [-] of cap. goes to GND.

PHASE III – Change Fuses on ATtiny and burn Arduino Bootloader
12. ATtiny runs at 1MHz by default, out of the box. To make it compatible with Arduino IDE, it needs to run at 8MHz.
13. Select the 8MHz option for your selected ATtiny chip (“ATtiny45, internal 8MHz” in my case) from the TOOLS > BOARD Menu.
14. Select TOOLS > PROGRAMMER > Arduino as ISP
15. Select TOOLS > BURN BOOTLOADER
16. That’s it – done. You can now load Arduino sketches in to the ATtiny, using the same connections that you have already set up.
17. For the ATtiny45, the Port definitions are as follows :

ATtiny45 Pin No <-> Arduino Pin No
Pin 1, <-> PB5
Pin 2, <-> Pin 3, Analog Input 3 (PB3)
Pin 3, <-> Pin 2, Analog Input 2 (PB2)
Pin 4, <-> GND
Pin 5, <-> Pin 0, PWM (PB0)
Pin 6, <-> Pin 1, PWM (PB1)
Pin 7, <-> Pin 2, Analog Input 1 (PB2)
Pin 8, <-> VCC

For the other ATtiny chips, the table will be different. Check the ATtiny datasheet for details.

18. After Bootloader is burnt to the ATtiny, you can load the BLINK sketch to verify if it all works well. Change Pin 13 to Pin 0 before uploading the sketch, and you should get the blinking LED between PB 0 and GND of ATtiny (Pins 5 and 4)

Connections between Duemilenove Board and p.u.l.s.e for burning bootloader and downloading sketches (note the 10uF capacitor between RESET and GND of Duemilenove)

Connections - Duemilenove to ATtiny

Connections – Duemilenove to ATtiny

EDIT :
Video of p.u.l.s.e

Another video after installation in the Bike