Using a permanent marker to make circut boards

I’ve been considering the best approach to making my circut boards with the Cricut Expression (aka FreeExpression).

The board design software I use is called Eagle Cad.  It is free for small designs and can generate HPGL files that I can send to the Expression via my custom firmware.

First off, I’ll need a suitable pen that will produce ink which can survive the etching bath.  The go-to marker for this purpose is the Sharpie ultra fine permanent marker.

sharpieultrafine

However, in my past experience with this marker, the results were less than desirable.  The copper under the ink will be pitted and can result in open connections on fine traces.

I’ve had much better luck with the Staedtler Lumocolor Fine Point Permanent Marker

staedtler1

These pens are pretty expensive too..

If you can’t find them at your Office Depot or Staples in the Pen/Markers section, look in the Drafting Supplies section.  That’s where I found mine.

Do not buy the Staedtler Fine Pigment Ink Archival pens.  They do not work at all.  (See below).

I bought two sets of pens.  The Staedtler Lumocor set of colored pens, and a set of four Staedtler Pigment Ink Archival pens.  As  a writing instrument, these archival pens are incredible.  They write so fine, and the ink is acid free, waterproof, won’t smear or smudge.  It’s awesome.  As a PCB writing tool, forget it.

I grabbed a scrap board and used each pen to write the color name.  Then I used each of the archival pens to write the point size.

pcbtest1

 

Then I headed to the Ferric Chloride bath.

If you don’t want to use Ferric Chloride, read this article for a home made alternative.

After 45 minutes, had my results.

First observation: 45 minutes was too long 🙂  Probably somewhere between 30 and 45 minutes.

Second observation:

pcbboardtest2

So, ranking the colored pens in order of preference:

  1. Black
  2. Green
  3. Orange
  4. Brown

The rest were unusable IMHO.  Red used to work a few years ago.  Seems they changed the formulation.  I’m going to repeat this test using Acid/Peroxide mixture.  Another alternative is Sodium Persulfate.  I have some Ammonium Persulfate on hand, but it is hard to get the mixture right.  Problem with both persulfates is that the mixture loses it’s strength over time, so letting it sit on a shelf for a couple of weeks it will be useless.  Not as long lived as Ferric Chloride.  The Acid/Peroxide mixture etches much faster though.

Be sure if you use acid/peroxide, do it out doors.  My workshop is poorly ventilated so I can’t use that stuff indoors.

To be continued…

Low cost markers that fit the Expression

I found some inexpensive markers that fit (a bit tightly) the pen holder in the Cricut Expression.

They are $2.97 at Walmart, and can be found in the kid’s coloring section with the crayons.  They are Cra-Z-Art Washable Mini Markers.  I didn’t notice the “Washable” bit until just now as I was writing this post.  The mini Sharpies might work too, but they are a bit expensive.  I’ll probably browse the shelves at Office Depot to see if I can find the Sharpie minis.

Repairing a damaged surface mount resistor

Well, somehow I managed to damage a resistor that is connected to the ISP header (J5) on the expression’s motherboard.  This led to a confusing error message in AVR Studio when I tried to program the flash on the Atmel chip.

The error message said “Failed to connect to target.  Does the target have power?”

Referring to my previous image on the JTAG interface, I recognized this pin, VTRef, which is pin 2 on the connector:

CricutExpressionJtag

Just to the right of the connector, off screen in the above image, is a tiny surface mount resistor.

I had carelessly plugged the ISP cable (which goes in the black connector in the bottom right above) into my AVR Dragon programmer’s JTAQ port!!!!  Argh, so this sent voltage back down to pin 2, which fried the resistor.  During inspection of the board when I could no longer program the code, I saw some brown residue next to that resistor.

Using the voltmeter when the machine powered on, I confirmed that I had 5 volts going into the resistor, and zero volts coming out.

chicken_fried_resistor

Now I had to find a spare board with a similar sized resistor… and use my shaky hands to dismount it and re-solder it onto my machine’s motherboard.

So, once I removed the resistor and replaced with a similarly sized one, I tested the voltage going in and out, seeing that it was both 5v, I reconnected the AVR Dragon’s ISP cable (to the correct port this time!) I successfully read the chip and received no errors…. yayyyy!

Repurposing the cricut expression

Now that I have the firmware in a working condition, I’m contemplating all the neat little uses I can get out of this machine.

To be honest, I’m probably really late to this whole craft cutting party, since I’m really not a crafting person.  I’m more of an electronics/computer programming hobbyist, so that is my style of crafting.  However, this machine interests me greatly because I’ve always been intrigued with programming tiny micro controllers that control machines.

Luckily, I don’t have a huge investment in cartridges like this person on Craigslist:

20150218_112145

I mean, really!  Could you imagine the money involved in this?  I’ll be honest, I admire Provo Craft’s product development, engineering and marketing teams that were able to design, produce, and sell this machine and it’s required proprietary cartridges.

Provo Craft invested heavily in their artwork library, product development, the little books that come with the cartridges, etc.  I really do hand it to them.

If you’re a normal user, you can be perfectly happy living in the Provo Craft eco system.  If you’re like me, where you want to create just anything arbitrarily, then the love affair ends.

For example, I wanted to cut a Star Trek logo out of card stock to make little lamp shades.  I could not do that with the regular Cricut.  So my only option was to print the logo using my large format inkjet printer, then use an exacto knife to cut them out.

Now that I have my own software running on the machine, I can cut anything I want:

20150217_232300

And since there are tons of these machines on Craigslist and Ebay for cheap, anyone who is able to use my firmware can pickup a really good machine, skip the cartridge investment, and express their Free Expression:

20150218_082228

So what’s next?  I think I’m going to build a laser cutting head so that I can do some burnishing and engraving wood, leather, etc.

lasercutting

The laser cutter mod would actually be very simple to implement, and it’s at the top of my list.

Another modification I’d like to try is automatic registration so that I can increase the accuracy of multi-cuts.

The controller in the Expression has a lot of IO that I could borrow from some controls that I’m not using, such as the three dials that control pressure, size, speed, or the cartridge port which has four digital pins I could use.

Another mod that is possible is adding Dremel tool, but this will require some more extensive mods that may end up being overkill.  I might save the Dremel mod for my stand alone table top CNC  machine that I plan to build from used Cricut Personal machine parts.

 

FreeExpression Firmware Roadmap

Now that I have the base code working, and all the moving parts moving, I am planning the full firmware roadmap.  The original expression machine is a very capable machine but it is designed to be used with the manufacturer’s cartridges.  My ambition with this project is of course to break that cord and use the machine with open source software (Inkscape) in a user friendly manner.  Previous attempts by other people to use these machines with third party software have either been incredibly tedious, or resulted in litigation (yuck).

My approach is quite different.  I have decided to completely write new software that is installed onto the machine itself, erasing the manufacturer’s software (to avoiding copyright infringement) and implement my own grand design for the machine.

cricutkeypad4

Let’s talk about the user controls on the machine:

Dials

There are three dials marked Speed, Size, Pressure.  These are convenient because while the software (Inkscape) can manage these as well through the Export/Plot interface, it seems logical to support this functionality through the dials.

Size

The size dial is an interesting one.  In the original machine’s design,  you load a shape from a cartridge and then you use the size dial to resize it.  In this new paradigm, where you are using Inkscape, you simply would set your design size in Inkscape.  So the Size dial is kind of useless unless I implement some other feature (see below) that could make use of it.

Pressure

The pressure dial is very useful, as it allows us to set the pressure in one of four (five??) increments.  This would tell the firmware to adjust the voltage going to the solenoid that pushes the knife head down.  This in turn controls how hard the solenoid “presses” on the knife.

Speed

Adjusting the speed of a cut can help with thicker materials that require more delicate handling, or with thinner materials that can handle faster cutting.  It makes sense to allow the user to adjust the speed before the cut begins. I’m not sure if it should adjust the speed during the cut….

Keypad

The keypad has numerous keys that perform a wide range of functions.  Many of these keys are used to select a shape from the cartridge library.  Without the need for cartridges, there is a lot of keypad real estate that is going to be unused.

The main keys, A-B, 0-9, and some basic shapes (from Wingdings library) will allow the user to cut using a standard font (Comic Sans).

Direction keys

These keys allow you to position the cutting head over a specific area of your material

Stop key

This key will stop the cutting process completely and basically aborts your project, returning the machine to its home position and ejecting the mat.  There is no way to stop the incoming stream, so the machine will just have to ignore the remaining data and allow the internal buffers to clear out until it receives the final “end of job” HPGL command.

Cut key

There really is no current plan for this key.  Cutting is started at the computer.

Option keys

These keys are just to the right of the display and control things like multi-cut, portrait, mix n match, quantity, auto fill, fit to page and fit to length.  I’m not sure what possible use these can have in the future, but I’ll try to implement some of the options if they make sense.

Display

The display works fine in my current firmware, so I will continue to use it for user input/output.  On the original expression, when a user selects a shape, the machine shows a small image of what they selected.  This will not be possible since the main goal of this project is to allow you to cut whatever you want, the code could not possibly interpret your image completely and display it.  So, the display will just be for menu prompts and confirmations.

Onboard memory

Since the machine has 512k bytes of on board memory storage, I have considered the option to allow the user to save their favorite projects and shapes into the memory, and allow them to easily retrieve them through the keypad or use the speed wheel to browse through the their custom shape library.  If this is implemented, then several of the option keys have meaning again, as well as the size wheel.

SD Card add on

sdcard

Another interesting possibility is the addition of an SD card port at the cartridge port.  The cartridge port is ideally designed to allow expansion, and in fact the Atmel AVR control pins that are connected to the cartridge port are the very same pins that standard SD card readers use.  The feature would work like this:

User inserts an SD card, and the machine reads the list of files, giving them a menu to browse through them using the speed wheel.  Once a file is selected, they can have the option of storing it, or cutting it.  If they store it, it will be placed into the machine’s on-board permanent memory.  This is useful for those stars, squares, hearts, snowflakes that we use every day 🙂

 

Reverse engineering a printed circuit board

Reverse engineering things is a fun hobby.  It enables someone like myself who is intensely curious about all things and how they function to understand the design of things.

I started dabbling with electronics when I was in high school.  At the same time, I was learning programming, so I had eventually to choose.  I went the software engineer tract, but never really gave up on my love for electronics.  Unfortunately, I lacked in the math department, so sometimes thing are very difficult for me when it comes to theory.  Nothing can put me to sleep faster than a good book on pulse width modulation theory and math!

Anyway, when it comes to “reverse engineering”, the phrase alone can have all kinds of negative connotations.  Most people will attribute “hacking” and “reverse engineering” as things that evil people do for evil reasons.  Sure, there is that…. But then there is the positive side of it.  By reverse engineering things, you can identify weaknesses, or potential enhancements.  You can even re-purpose hardware, make it better, make it your own.

How do you reverse engineer things?  There are tons of Youtube videos on the subject.  For electronics, a good starting point is a basic understanding of electronic components and their relationship to other components.  You don’t need to be an Electronics Engineer to understand these things.  But you do need to know what a transistor does, or a capacitor, resistor, and how to identify integrated circuits, understand datasheets, and a few more basics that I’m forgetting to mention 🙂

A printed circuit board is basically a bunch of interconnecting lines that move electricity from point A to point B.  Or more accurately, from Part A to Part B.  They may be single sided, double sided (top/bottom) or for very complex systems, multi-layered.  For example, an iPhone 5 board has 16 layers!!

Luckily, the Cricut Expression is only a two sided board.  A minimum toolset will include a digital auto-ranging multimeter.  I use an Extech EX430.

For tracing the connections on a PCB, you need to use what some units call Diode test mode or on my unit it is on the Ohms mode, set the range to “audible”.  Whenever I touch a connection that is a closed circuit (the trace is connected at both ends with nothing in the middle) it will ‘beep’.  Depending on what I’m tracing, I typically start at the connector away from the CPU (in this case an Atmel ATMEGA1281), or I can start at the CPU pins and work outward.

Simple method of tracing the paths on a double layer circuit board involves taking a high resolution picture from a mounted camera at a fixed focal length. This is to ensure that when taking a picture of the top and bottom of the board the dimensions are as close as possible.

Open the two images in Photoshop or Gimp. Set the top image as the top layer and the bottom as the bottom layer. Delete the background layer if any.

In Gimp, you can convert a color to a transparency. I then used an eye dropper tool to pick a portion of the green area that would erase the bulk of the solder mask. I do this only for top layer.

Then set the opacity of your top layer to 50%.

Now, go to Channels and turn off the green channel.

You can size and align the top layer to the bottom layer as needed.PCB1 PCB2

With XRay Vision 🙂

PCB3

Better contrast:

PCB4

Now, we can see the traces on both layers of the board.  Using this information with the multimeter techniques, we can identify our traces and build a “reverse schematic” of sorts.  There are probably much more advanced and difficult techniques for this, but this is what worked for me on this project.

Keypad Internals

Here is an image of all the LEDs lit up on the keypad.  Side note:  I once saw a similar machine on Ebay for $40 that had this same exact pattern displayed on it.  The description of the item said “For parts only, not working.”  I thought to myself, I know what happened to that machine!  This happens when the firmware is wiped out and the Atmel chip starts up in it’s blank state, the pins are set into output mode rather than input mode, causing the LEDs to light up.  If you ever see one for sale like this, and you’re not a hard core hacker, you should not buy it!

CricutKeypadLights

The keypad is comprised of a whole-lotta-buttons and a few LEDs.  The matrix of buttons are interfaced with the AVR processor by way of three shift registers.  A shift register is also known as a port expander because it allows us to digitally interface 8 switches.  When you matrix buttons in this typical fashion you are able to access a large quantity of buttons for the price of only a few AVR pins.

KeypadBottom

The shift registers in question are of the Parallel In, Serial Out variety.  This means that 8 buttons can be connected to the data lines of the shift register which represents 8 bits of incoming data.  The data will be sent to the AVR in a sequence of 8 bits in a serial stream of data.  Shift registers can be daisy chained further extending our reach, while still only costing us the same 3 pins.

In order to access this matrix of buttons where you have N rows and C columns, you need to add more shift registers and daisy change them together.  Here is an image I lifted from a Google search that explains how these buttons are connected to the shift registers.

buttonmatrix-shiftregisters

Each group of 8 columns is controlled or accessed by a shift register.  The two types of shift registers used are Parallel In, Serial Out (74HC165N on the bottom in the image) and Serial In, Parallel Out (74HC595N on the top left).  The 595 controls the “row select” part of the scanning algorithm.  The 165 then receives the input state of it’s attached 8 buttons.

Rather than repeat the in depth analysis of multiplexed keypad scanning, I’ll give you a really good link.

KeypadTop

In addition to buttons, the keypad has a bunch of light emitting diodes to represent the button’s state.  Not all button’s have LEDs under them.

Using my high tech x-ray vision system, I can see how the two layers are inter-connected.  In this picture, the two layers are not perfectly lined up, but it was sufficient for what I needed to know at the time.

keyboard_motherboard_xray

As I went through the keys one by one to document the scan code, I noticed that there are a few overlapping keys.  Either this is some kind of strange anomaly, or that’s the way it is with the original.  Luckily it is not occurring to keys that are close together.

I don’t yet have an entire plan for the features I want in my custom firmware, therefore some of these keys will have no meaning.  I bought the universal overlay that has all the alpha and number keys, along with “Function” keys labelled.

Interfacing with the OLED Display

The FreeExpression contains a nice little OLED display which measures roughly 2.7 inches diagonally.  The display module has a very thin ribbon cable on which is stamped the module’s part number “UG-2864ASYDT01”.

A bit of Googling dug up the data sheet (interestingly stamped “Confidential” across every page).  This device uses a driver integrated circuit called an SSD-1325.

I’ll admit that writing code to make this display work is probably outside my skill set at this time.  Luckily, I found a library named u8glib which contains support for this driver, as well as numerous others.

Now, my task is to figure out the physical connections to the driver, and configure the software accordingly.

oled_AVR_connection

The laborious task of following each trace is very tricky with such small components.  I use a multimeter that has an audible beep when two connections are in a closed circuit configuration.  However, this does not work across components like resistors.  So one must follow the trace from end to end, continually testing each connection point.

The SSD-1325 driver IC uses two modes of operation, Parallel and Serial.  Luckily, the Cricut engineers decided to use the Serial configuration to save pin count.  The display’s pinout diagram was pulled from the data sheet:

DisplayPinout

 

Now that I identified each pin on the display, and it’s corresponding pin on the AVR, I could plug these values into the u8glib’s initialization routine and hopefully get it going…
The u8g init routine looks like so:

Software SPI:
uint8_t u8g_InitSPI(u8g_t *u8g, u8g_dev_t *dev, uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset);

The u8glib wiki has a cheat sheet of device types:

https://code.google.com/p/u8glib/wiki/device

Since I am using “software spi” on an NHD27 compatible device, from this list, I can see that my desired device type is probably one of these two:

u8g_dev_ssd1325_nhd27oled_bw_sw_spi
u8g_dev_ssd1325_nhd27oled_gr_sw_spi

I can see I need sck, mosi, cs and a0 lines.

My Display to AVR connections are as follows:

D/C# -> PF7
D1/MOSI -> PF5
CS# -> PE7
D0/SCLK -> PF6

u8g_InitSPI(&u8g, &u8g_dev_ssd1325_nhd27oled_bw_sw_spi, PN(5, 6), PN(5, 5), PN(4, 7), PN(5,7), U8G_PIN_NONE);

To test this, I used the u8glib example code named “graphicstest.c”…. and…. it didn’t work… at all.

I communicated with the u8glib author via email several times, each time he assured me that it worked with the SSD1325. I was at my wits end. I even thought that I had some how broken the display or disabled it. So I then decided to wire up an LCD module and test it. It didn’t work either. Now I was really flabbergasted. I had all but given up on the display, but then I remembered that the display pins are the same pins as the JTAG interface. I had already considered this, and switched to the ISP interface for programming the device. However, I did not reset the AVR Fuse for JTAGEN. This must be disabled in order for the display pins to work in the normal mode. ARG… So then I disabled the fuse, reconnected the OLED display, and reloaded the test code. Voila! It works! (Video coming soon…)

So now I switch back to my main project to re-integrate the display initialization routines into my project and write some code to print to the display. On my long list of to-do items is to create a menu of sorts and wire up the button’s to display the proper screen or information according to function.

SSD1325 datasheet

Cutting my first design from Inkscape to my craft cutter

I’ve spent about two weeks writing software for my custom craft cutting machine that replaces the manufacturer’s original program on the machine.  Why would I do that you ask?  Well, you can read the full story in another post, but for a short answer, because I could!  Well, the machine was given to me by my sister, and it was dead on arrival.  I received no cartridges or anything with it.  So I had to first, determine why it was dead, then my brain went directly to “ok, how does it work?”

Skipping over the next two weeks, I have it working and cutting with Inkscape perfectly.

However, there are some gotchas.

First and foremost, for cutting purposes, all our designs have to be simplified to a path.  So when you draw something on the canvas, you have to use the Object to Path menu to make this conversion.

Sometimes, it doesn’t seem to do anything visibly to the design, but if you skip this step, the output will not be desirable 🙂

Here I have drawn a simple star.  You can see the black outline and if you try to cut it as is, you will get some cuts but not the complete star.  Selecting the Path menu, then Object to Path, Inkscape will make the necessary changes internally and when you send this to the export extension, it will then cut perfectly.

ObjectToPath

Font’s are similar in nature:

InkscapeFont1

Here I have simply entered some text, set the font to Comic Sans, and made it big.  However, sending this to the HPGL export plugin would fail miserably because it is not a path, and Inkscape can only send Paths to HPGL.

We must always simplify our objects to a path.  However, with fonts it seems to be a little more challenging.  Simply clicking on Object to Path doesn’t do the trick. A font is actually an object made up of two parts, a fill, and a stroke.  Most of the time, the stroke is turned off.  The stroke would be the “outline” you might see around the font.  However, it is this that we are interested in, as plotters and cutters don’t usually care about fills, only the “outline” which instructs the device where to draw or cut.

The options we need are on the Font panel that appears when you add a text object to your drawing:

InkscapeFontStrokeFill

We want to turn OFF the fill, and turn ON the stroke:

InkscapeFont2

How, we can use Object to Path or even Stroke to Path.

After you do this, you will not see any visible change to your object, but what you will see is that your text panel no longer considers this object as text.  The interesting side effect of this is we can now manipulate our sign as a drawing object.  I’ll cover that in a future post!

You’ll notice the stroke in the above image is very thick. This kinda makes it ugh.. painful to work with, although it doesn’t matter for the cutter, from a visual aesthetics point of view, it seems to be easier on the eyes if we change our stroke size down a bit.  We can select our object and change the stroke style to our liking.  You can un-group the object to work with individual “letters” and add nice effects like sizing, rotation, skew, etc etc.

InkscapeTextStrokeStyle

Now we can send this to our machine through the export plot menu described in my earlier post.

My first sample cut is shown below:

SampleCut1

Next, since it was Valentine’s Day, I decided to play around with this craft foam stuff that I had laying about.  I used a deep cut blade for this.  You can see just at the bottom of the heart where it kinda-sorta didn’t cut all the way through.  I’m actually encountering a little bit of a blade pressure problem at the moment…

 

 

SampleCut2

Here’s a Youtube video of the machine cutting away:

I’ll upload more/better videos soon!

Using Inkscape with an HPGL craft cutter

The latest version (as of this writing it is Inkscape 0.91pre3), Inkscape comes with two HPGL export features.  One, under the file, Save As menu, saves  your design as HPGL.  This is not much use to me at this time.  The second HPGL feature is located under the Extensions menu, Export, Plot …

InkscapeExportPlotMenu

The Plot dialog has three panels of settings, two of which we are particularly interested in.  For my machine, a modified Cricut Expression, I have coded the firmware to set the USB speed to 9600, Software Flow Control (XON/XOFF) an command language is HPGL.

 

InkscapeExportDialog1

We need to change the resolution for X and Y to 400 under the Plotter Settings.  Also, I have noticed that the image cuts in reverse, so checking the two Mirror X/Y axis boxes corrects this anomaly.

InkscapeExportDialog2

Clicking Apply will start sending the data to the machine.

Here’s a video of the machine cutting a complicated design that I downloaded.