## Introduction: Tim's Linear Slide

I'm making a robot, which I want to be able draw on the surface it moves over.

So I need something to raise and lower a pen.

I have already made a draw bot, which uses a servo to do this.

I am hoping the robot I am working on at the moment, will do a lot more, it's a long way from completion. I will be using multiple processors and communicating between them via I2C.

So all things considered, this reason and that reason, (a servo needs a carrier) I decided I would use a PCF8574, and because the pen lifter needs only to be one of two states, (up or down) I will only need one pin of the PCF8574. (need the other pins for other things)

## Step 1: Things Needed

I want it to travel in a Linear Motion. (Straight up and down)

I have two 3mm diameter 86mm long polished rods I removed from an old CD drive. (That's set one parameter of the design)

I am going to use a DC motor to drive the slider. I want to power it from 5 volts, also I want it to be as small as possible. This means it's going to be a geared motor, so that there is enough torque to lift the pen.

I found a nice little motor on eBay.

Another thing I am going to need is a switch at each end of the travel for stops, need to have normally closed option. eBay again.(smallest I could find)

To make sure all is going to fit correctly, I measure accurately and draw the parts.

## Step 2: Design (Slider)

The best way to make this is to make it symmetrical, so that's how I am going to go about it.

The length of the 3mm bar are obviously going to set the length of it, the key here is to get the most movement, but keep it stable.

So I am going to work out the length of the slider.

Work things out theoretically first, then work it out in practice. (I find trial and error works best)

The bars are 86mm long, I recon 2mm each end will hold them in place, leave a 1mm gap at each end, that leaves 80mm.

Going to place the motor in the middle and use a rack and pinion to move the slider. So divide what's left into 2 (half movement, half slider length), that gives us 40mm.

Now in practice, I need to leave some room for the Pinion Gear, so I will add 10mm to the length of the slider, which will still allow 30mm of movement.

I'm going to set the bars 22mm apart.(That dimension just popped into my head, so that's what it is)

I use M3 x 10mm Self-Tapping screws to join my projects together and have come up with the following that works best:

Hole Size for screw to tap into = 2.4mm diameter.

Hole Size for screw to pass through = 3.2mm diameter.

Edge Distance for a hole = 4mm radius.

A screw enters a taped hole at least 5mm. (usually the joint thickness is half 'n' half the screw length)

I am going to apply the same edge distance to the bars. A sketch shows the profile, I then extruded the sketch about the centre of the plane 50mm (that 25mm up and 25mm down), this will make working in the other planes easier.

I need to remove some of the material from the slider where the bars slide through it, as it stands there will be too much friction. So I will cut away the area around the bars, leaving enough to support it. (I also put in some fixing holes)

Next I need to cut into it the rack, (the teeth for the motor gear to fit into) but first I need to design the motor gear, so that the depth is correct.

## Step 3: Design (Motor Gear)

To work out the size of the gear to put on the motor, I need to see how close I can get the motor shaft to the slider.

I recon a 1.5mm gap looks good, that gives a dimension of 6.5mm from the centre of the shaft to the inner face of the slider.

There are a couple of things to consider when making a gear, mainly the size of the teeth. my printer has a 0.4mm diameter nozzle, therefore I will not be able to print less than 0.4mm. Also the diameter of the gear needs to be such that the teeth are inside the slider.

I want this to be a good fit on the shaft of the motor, so it is good practice to do a sample piece to check tolerances.

We all know you can't slide a same size peg into a same size hole, the hole needs to be slightly larger than the peg. But the reason the hole for a printed piece needs to be larger than you would think, is the way 3D models are printed.

Most are made into *.stl files which are triangular meshes. Holes become like threepenny pieces. So small holes need checking. I have tried to show what I mean in the sketch. (Very simplified)

Once I knew what size to put in the centre, I finished the gear.

Once the gear was finished, I could continue with the slider.

## Step 4: Design (Slider Rack)

To cut the rack (straight line of teeth) into the slider, I first need to draw a row of teeth that matches the motor gear. As the shape is quite complex, I will draw one tooth, then do an array of the object.

Once I had created my array of teeth, I used it to cut out the rack in the slider.

I now have the Rack and Pinion done. Next is to make the body to hold it all together.

## Step 5: Main Body

The body will also hold the limit switches, so I will add them to the model so that I will know where they need to fit.

The bars need to be fitted so that the will held parallel accurately, so I am going to make each end that hold the bars exactly the same. Also the ends will be shaped so that when fitted to the main frame, they will be aligned correctly.

The main frame will hold the motor and the switches, I will use the ends that hold the bars, to keep the switches in place.

I am still going for the symmetrical look so the footprint is going to be mirrored, this will also he making is fixing symmetrical.

I start with an extrusion then cut out the areas to fit the motor and switches. I find 0.1mm is good clearance on parts with straight lines. Where the gear goes I have left at least 0.4mm gap all the way around. The extrusion is 15mm deep, flush with the top of the motor, (I will make a small piece to hold the motor in) and deep enough so that the back side of the gear is inside the frame. The length of the frame is so that it is flush with the underside of the switches, when the ends are attached they will be held in place.

I just need to make a little retainer to hold the motor in place.

## Step 6: Filleting?

You will have seen from most of my sketches, that I put fillets on all the corners and edges.

I do it because I think it make the project look nicer, and the there are two places I have reasons for doing it.

1. Screw Holes. It makes a better start for the self taping screws, also any burr created when the screw goes in the plastic it will stay in the hole. Another reason is it helps with printing over air, when I have to print a piece with a counter bored hole on the bottom side, it helps the print with the transition between the two hole sizes.

2. The first layer. I always put a fillet on the bottom edge. This reduces overspill if the gap between the bed and the nozzle is smaller that it should be. Due to heat, sometimes the bed can have a little warping, not much, say 0.05mm. When I level my bed I preferer to be slightly under 0.2mm rather than over. This ensures that the print sticks to the bed. (I have done a mod to my bed so I no longer need tape or any adhesive to make it stick)

I took a photo with my USB microscope to try and show the underside and edge of my prints.

## Step 7: Print Files

I have done a screen shot of all the parts for the Linear Slider, I have also done one for the Pen Holder Attachment and Circuit Board Bracket I made.

This is to show the orientation I designed them to be printed.

The Pen Holder Attachment may be an awkward one, for some to print. My printer dose do it. (with a little head banging) the slope of the top part is a little shallow. You may want to add supports when printing.

Here are the files:

## Step 8: The Circuit

The motor needs to run in both it's directions, also I need to control it from a logic device.

Therefore I need some sort of electronic driver for it.

The obvious choice is a Half-Bridge, there are many to chose from like the quad SN754410NE and the dual L298N. But these would still need two or three logic connections without additional cercuitry.

As I have mentioned, I one want to use one data connection. So I am going to make my own out of a few transistors and resistors.

The circuit consists of the basic Half-bridge configuration with the addition of a logic inverter. The logic inverter is used to turn on one half of the bridge while the other half is off, and vice versa.

This way only one logic cable is required, on = down, off = up.

The two limit switches disable there respective part of the half-bridge circuit, turning off the motors.

I made my circuit board similar to what I wrote here: Tim's PCB

I use some other software now, to what I used there, and have an alternate/improved way doing it now, I suppose I should do version 2 of that instruction.

Done a zip of the Gerber files for this circuit board. Tims_Pen_Lifter_Plot_Files.zip

## Step 9: Video

Here is a video of it working.

It's currently connected to the power of an Arduino NANO, running the blink sketch.

LED On = Pen Down

LED Off = Pen Up

All it needs is: Power, Ground and a Logic signal.

I am quite pleased with the result, it has the power to lift a 300g weight.

Other uses:

Could have a small drill attached for drilling holes with a XY Plotter.

Could be used horizontally to slide a bolt for a door.

## Step 10: Improved Pen Holder

As I mentioned, this was originally designed to hold a pen in my current robot project.

As it stands the pen will be in one of two positions (up or down).

When it is in the down position I also need a little give in the pens position, if it is lower than the wheels, it will try to lift the robot, if it is higher than the wheels, it wont be lower enough to draw, at the moment all has to be exact, there is no leeway.

So I have redesigned the pen holder to locate the nib dead centre (between the wheels) and give some spring in the height to let the pen find its own correct height.

The Pen_Centre.stl I have made here is bespoke (for a basic pencil). This part will need to be made different, for different types of pen or pencil. This part keeps the nib central, while allowing the pen/pencil to move up or down to it's correct height.

## Step 11: Improve the Circuit

When I came to use the PCF8574, I found that I had to improve the circuit, I had to add another transistor to balance HI and LOW inputs.

The Arduino NANO pins are open collectors, these act like switches that switch to ground. So my original circuit worked fine with the Arduino NANO.

The PCF8574 however, have open drain, quasi-bidirectional setup.

Here is the new circuit. It now works with the PCF8574.

I have it fitted to my bot I am working on. TIM-01 Pen Test

I'll probably go back to using the MCP23017