Upgrade: Print without a pc for less than 10€ (part 1)


Ever wanted to run your 3D printer directly from SD card? This hack enables you to print from an SD card without the need of a PC.
Basically all you need to do is a cable to connect a SD module to your printer, but in this post I’m also going to show you how to create/adapt a SD module in case you don’t already have one.

You can use any SD module you like. MicroSD, SD, or even build your own! I'll show you how

You can use any SD module you like. MicroSD, SD, or even build your own! I’ll show you how

Despite I’m working on a control panel with some innovative features (look here), I’ve been asked to publish a super-cheap solution that can make you print without the need of a pc (or like in my case a Mac).
Printing without the need of a PC has many benefits, the first one of course it’s that… well… you don’t need a PC.
It could seem a stupid thing to say, but when you have to print a big file and you want to use your pc, you realize it’s not that banal after all 😉

Notice that Marlin firmware already supports a feature called “autostart” to automatically print a file from a SD card, but in my opinion it needs some improvments to make it more reliable for the scope we want.
This first post (of 3) will illustrate the “hardware” part of the solution: the SD card reader and how to build the cable to connect it to your printer.
Part two will be about the changes of the firmware, and part three will be about how to provide an enclosure and some improvements for a even better experience.

SKILL: not for a rookie  if you want to build your own SD board, otherwise: not difficult at all
TIME: from 1 to 3 hours, depending on the options
TOOLS: a soldering iron, hot glue (optional)
COMPONENTS: 1 SD card module (or components to build it), 30cm of 10 wire ribbon cable, 1 2×5  female Molex connector, 10 female plugs
OPTIONAL COMPONENTS: 1 LED, 1 resistor, 1 push button (see part 3)

Step 1: get a SD card module

You have two options for this: build your own board or you can buy one of the many modules aviable on the net.

Option A: Create you own SD card module (are you serious?! 😉 Jump to Option B!)

SD cards comunicate in two different ways, the easiest one to make it talk to your electronics (Arduino) and the one implemented in Marlin is using the SPI bus, so let’s see which pins are used.
The SPI bus uses 4 pins: MOSI (Master Out – Slave IN, think of it as a TX signal), MISO (Master In – Slave Out, think of it as a RX signal), SCLK (Serial Clock) and SS (Slave Select).
This is the pinout scheme for the SD and microSD cards:

SD Card Pinout

SD Card Pinout

Don’t worry! You really don’t need to know anything about this (I could have simply skipped this part), but unfortunately there is something that we have to take care of:
An SD card works at 3.3V (low level logic) while the Arduino in your printer uses 5V (high level logic) so we need to convert all the signals that go to the SD card from 5V to 3.3V.
There are many methods to do that: resistors, logic level converter or a simple chip like the 74HC4050. It’s a logic level translators that convert high-level logic to a low-level logic while operating off the low-level logic supply. It’s a one-way logic level conversion (not bi-directional) that won’t work with I2C bus, but it’s perfect for our purpose since Arduino uses a high level logic but can “read” signals as low as 3V so we’ll need to translate just the signal that goes to the SD card: MOSI, CLOCK & CS and not the MISO signal.
A proper level shifting chip, not resistors, gives you less problems and faster read/write access but for this application I wouldn’t mind too much.
We’ll also need to connect GND and VCC (3.3V) as well the CardDetect signal. Since we already have a 3V3 power source from our Arduino there is no need to regulate the tension.

This is the schema for a resistor based board:

SD_Module_schematics

SD module schematics (with resistors)

This is the schema I did for a 74HC4050 based board to be used with my printer:

SD_Module_schema

SD Module schematics. A 74HC4050 chip has been used for level shifting and a led is used to show activity

You have to create the pcb and solder the card holder (or buy a breakout board like this one) then you have to add the IC (or resistors) and the connectors then… hey!!!
Wait a minute! The SD card module online cost as low as 4$! (look at this) do you really want to go on this way??? I would.. but this is another story 🙂

Let’s jump to Option 2 and make it easier 😉 … but seriously, if you really want to go on this way, drop me a line and I’ll post the full process… in exchange of your your health certificate 😉

Option B: Buy a SD card module online

I prefer to use regular sized SD cards rather than the tiny microSD because for this application I can’t see any advantage in saving space and it’s much more comfortable to handle a full size card.. but you can choose to use whatever you prefer (or find), the only thing to look for in the SD card module it’s the presence of the card detection pin (CD). This will allow the printer to “sense” when you insert or remove the SD card and to behave accordingly. Very important in our case since we don’t have any LCD and buttons to interact with the printer.
Unfortunately many of the modules you find online don’t implement this pin (why?!?!). In case you already have one module without the CD pin I will show you how to enable it with a simple wire and a little soldering work, but of course if you can put your hands on a module with it you will save some time and work…

For a ready to go solution you can check out a module like this:
http://www.elecfreaks.com/store/sdmmc-card-module-p-286.html
This module has the CardDetect pin, it’s small (not a push-push card holder, but it’s shorter and perfect for the purpose) and… it’s just 6,90$!

In my “toolbox” I found some modules, so I’m going to use one of them and take the opportunity to show you how to enable the CardDetect pin in a module without it.

SD_modules

From left to right: Adafruit microSD, DF Robot and ElecFreaks (this module has a micro SD slot on the opposite side as well)

Here the links for these 3 modules:
Adafruit (this is the only one on my desk with a CardDetect pin and a level shifting chip, but it’s a micro SD)
DF Robot (this is the one i’m going to use). I bough it here for 9,10€
Elec Freaks (this one has two slots, one for SD and one for microSD and it’s only 5,50€)
Just for your curiosity, as you can see the first one uses a IC to down-convert the logic signal from Arduino the other two use resistors, anyway all of them work perfectly  for our purpose.

I’ve choose to use the DF Robot module for this tutorial, but unfortunately the SD CardDetect signal it’s not routed anywhere so let’s see how to enable this functionality.
If you already have a module with the CardDetect pin, jump to Step 2.

We have to solder a wire to the SD card cage, more precisely to the 2nd pin from the right as shown in the picture below. I suggest to use a 5/6cm wire so it’s easier to handle and once you have done the job you can cut it to 2/3cm. Use plenty of flux when you do the soldering since it’s a quite small pin the one you have to solder.

SD1

On the opposite side of the wire, solder a male pin so that you can connect to the female plug on the ribbon cable.
To avoid shorts I suggest you to isolate the pin with some heat shrinking tube.

SD3

Since the CardDetect pin you have just soldered it’s really tiny, I’ve put some hot glue on the wire to make it solid with the board so to avoid the risk of accidentally break it.

SD4

And finally, this is the board with the little hack.

SD5

Mmm.. yes, ok… my hot glue job it’s not really good looking… but it does it’s job

Ok, now that we have a SD card module ready to rock and roll so let’s see how to connect it to our printer.

Step 2: creating the cable

We are going to connect our SD module to the EXP2 connector of our board since this expansion port already exposes the SPI bus pins of our Arduino, power, ground and some extra pins.
It uses a polarized Molex connector very common to find and easy to crimp without any tool.

In the picture it's shown the Expansion 2 connector and the 5V as an orientation hint

In the picture it’s shown the Expansion 2 connector and the 5V as an orientation hint

For your curiosity, this is the pinout of the connector  EXP2:
——————————–
| 5V                | GND           |
| 3.3V            | 38                |
| 51 (MOSI) | 40                |
| 53 (SS)       | 42                |
|52 (SCK)     | 50 (MISO)|
——————————–
Numbers refers to the corresponding Arduino pins.Crimp the 2×5 female Molex connector to one end of the ribbon cable so that the red wire correspond to the 5V. If your ribbon cable doesn’t have any reference, I suggest you to use a pencil to mark one of the most external wires for future reference.As you can see on the picture of the board, the Molex socket (and plug) are polarized, so you can connect them in just one direction.

In this picture I've crimped the connector on the wrong side. I'll udate ASAP

In this picture I’ve crimped the connector on the wrong side. I’ll udate ASAP

Crimp (or solder) the 10 female plug connectors to each wire opposite end. Again, to avoid undesired shorts, isolate the connectors with some heat shrinking tube. It’s now time to connect the module to the ribbon cable!
If you look at the ribbon cable from top and keep the red mark on the left side you have this sequence:
| 5V | GND | 3V3 | CardDetect | MOSI | Arduino pin 40 | SS  | Arduino pin 42 |  SCK | MISO |
Connect the SD module accordingly.
For now let’s ignore the BUTTON and LED pin and let them free, I’ll talk about those in part 3 of this tutorial (not necessary but useful).
Notice that some cards may mark the pins differently: MISO –> DO, MOSI –> DI, SCK –> CK, SS –> CS.

Double check your connections and you are set… oh well… not really!
In fact, unless you have a Ultimaker shield from version 1.5.6 onwards, if you want to print without a PC you don’t want to depend on a USB cable to power your electronics!
You already have a power input so why shouldn’t be enough?

Step 3: unleash your dependency from the USB cable (optional but recommended)

I already showed this hack on a previous post (Upgrade: Mod your POWERWASP to support variable fan speed) but since I’m a good guy I will show you how to to it again 😉

A simple hack to power Arduino without the USB cable

A simple hack to power Arduino without the USB cable

Your printer needs a lot of power to run the motors, heaters, leds, fans… that’s why you have an external power supply that can provide enough watts.
Unfortunately you motherboard (Arduino) gets its power from the USB so, out of the box, you wouldn’t be able to use your printer unless you have an usb cable attached to power it. Since you normally print from pc there is no problem, but our scope it’s to use the printer without it right?
If you don’t want to “touch” your board you could use a simple USB charger and attach it to the printer just to power the board, but if you really want to eliminate any dependency from a useless wiring you can simply solder a wire to bridge the regulated 12V that comes from the external power supply to the Vin pin of your board.
Looking at the picture: the 12V pin you want to connect it’s the one on the left of the voltage regulator and the Vin pin of your board it’s the 4th, counting from right.
Super easy isn’t it?
There is just one drawback however: if you connect a powered USB after this hack, your fan will spin.. nothing special and nothing to worry, and.. there is a solution even for this. but in a future post 😉

Step 4: update your firmware

This is my next post!

Advertisements
Categories: 3D Printer, Improvements | Tags: , , , , , , , , , | Leave a comment

Post navigation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: