Portable Portrait Painter

9,117

124

8

Introduction: Portable Portrait Painter

Introduction

There are probably over one-hundred Arduino based plotting machines on the internet with instructions available on how to make them. What makes this one unique (as far as I know), is the inbuilt camera and screen. Other plotters must be connected to a computer. This one works completely independently.

The 20fps video shown on the screen makes it easy to capture pictures with the camera, then just press the paint button to have a watercolour portrait in less than 5 minutes.

Thanks to Indrek Luuk who wrote the camera/video code and to Sourav S who solved how to read information from the screen (written permissions obtained for contest entry). Thanks also to Darcy Whyte (InventorArtist) who inspired the brush-pen approach to the plotter.

Guide to the instructions

The following instructions are a detailed step-by-step guide to making your own portable portrait painter. Before attempting this project you should have the following skills:

  • Operate a 3D printer
  • Able to upload sketches to an Arduino
  • Soldering
  • Assembly of parts
  • If you want to adjust the design, you’ll need to be able to write code for Arduino and adjust Fusion 360 CAD files.

The project is not a small undertaking:

  • The total parts cost (excluding 48x 3D printed parts) is almost £400!
  • The total cost of tools needed is £371 (including tools you may already own e.g. a £180 3D printer).
  • I estimate that it will take 20+ hours to complete the project.

Step 1: Tools and Materials

Attached are 3x lists:

  • A list of all tools required.
  • A list of all parts, fasteners, and electrical components required.
  • A list of all the parts you need to print.
    • I'll refer to the 3D parts by name in the instructions. You'll know I'm referring to a 3D printed part because it will be in bold, and then you can check this list (alphabetical order).

If you want to buy everything before getting started, you'll need to skip ahead to the steps for procuring the laser cut baseplate, and for making the PCB.

Also attached are all the STL files for printing.

Step 2: Overview of the Design

Once built, the machine should look like the Fusion 360 CAD image above. Key parts are labelled for reference.

Here is a public link which should let you view the Fusion 360 design: https://a360.co/39e3x8v

Unfortunately you cannot download from this link (that would require me to have a paid F360 subscription), but you can take measurements and reverse engineer if you want to modify the design.

Step 3: Procure the Laser Cut Baseplate

You could make the baseplate using hand tools. The 3mm plywood could be sawed to size, and the various holes drilled using a hand drill. The screen hole could be cut using a fret saw and file.

However, a laser cut baseplate will give you the benefits of:

  • Much cleaner holes for the camera & screen.
  • Ensures that the holes for mounting the linear guides will be accurate enough.
  • Laser engraved text!

I chose one of the many people offering a laser cutting service on eBay, and sent them the DXF file. Most of them will be happy to work from the DXF but make adjustments to the final part.

Make sure to keep the two parts that are cut from the spare material where the screen is mounted. These ‘offcuts’ are used to reinforce the toothed idler pulley assembly.

Adjust the DXF file

The laser cutting service will be able to make edits to your

DXF file. Edits you need to make are:

  1. Measure the internal dimensions of the box you have purchased (or built) and ensure that the baseplate is going to fit inside. Beware that the box walls might not be straight – the opening could be narrower at one end, or in the middle. You can tell the laser cutting service to adjust the overall L x W dimensions according to your measurement.
  2. There is placeholder text in the DXF, you might want to replace this text with a font of your own choosing – just ask the laser cutting service.
  3. If you have purchased a different 1.8” screen, you must measure and adjust the mounting holes accordingly.
  4. You could get creative and add your own text or images to be engraved.

Clean up the sooty residue

The laser cut part will almost certainly arrive with sooty residue still on it. This can be easily cleaned off by scrubbing it with a wet soapy toothbrush.

Apply a spray-on lacquer

Use a can of spray-on lacquer (I chose matte finish) and apply 3 layers to the baseplate, sanding in-between layers. Watch some YouTube videos on the correct technique for this. The spray-on lacquer will protect the wood, especially from the brush-pens. Once the lacquer is applied if you accidentally paint the wood with the brush pens, you can wipe it off with a damp cloth.

Step 4: Make the H-bot Gantry

Once this step is complete, your assembly should look like the picture above.

Prepare the MGN9 rail:

You might think that using MGN9 bearings is an unnecessarily expensive option for this low-precision painting machine. I chose this rail for 2 reasons: Firstly, the small size of the rail and carriages. Secondly, the rail is performing a dual purpose – it is clamped down onto the front of the plywood and forcing the plywood to be straight and flat.

Cut the MGN9 rail for the X-axis

Assuming that you ordered the MGN9 rail in 3x 300mm lengths,
you will need to cut the X-axis to length. The X-axis needs to be cut to 220mm length (11 holes will be available along its length). A hacksaw is not the best tool for cutting this hardened steel, but it is the cheapest. Follow these instructions to make it as painless as possible:

Cutting the MGN9 rail with a junior hacksaw will take 20 minutes.

  • Each 150mm junior hacksaw blade will only cut about 1mm depth before the blade is blunt. Once the blade is blunt, you could saw for 24 hours and make no further progress.
  • It only takes 2-3 minutes for the blade to be blunt.

Therefore the way to do it is:

  • Get a pack of 10 hacksaw blades (about £2).
  • Saw for just 3 minutes before swapping to a new blade. (It will take 6-7 blades in total).

The MGN9 cutting guide will help to align the blade as you start cutting, and if the blade jumps out while cutting then the plastic will protect the rail from getting scratched. Fasten the 3D printed cutting guide to the rail using M3 nuts and bolts.

Lubricate the ball bearing races

Things to know about linear recirculating bearings:

  • For whatever reason, bearing manufacturers supply their bearings unlubricated. Due to the close tolerances they will not run smoothly and freely.
  • MGN9 bearings are a knock-off design of much more expensive & professional Hiwin bearings. The ones I received were quite crunchy, and would always stick at specific positions, indicating relatively poor manufacture.

You will find YouTube videos that go into detail about cleaning and then greasing these bearings. They involve extracting all the balls from the carriages and it looks difficult and time consuming. Instead, I just added lots of grease to the carriages until they ran nicely (avoiding disassembly). I will describe the approach I used.

The grease I recommend is SuperLube. It’s a widely available grease. SuperLube is non-toxic and you can dispose of any greasy paper-towels into your normal household waste. I was able to buy a convenient 10ml syringe-full (rather than a full tube). You’ll only need a fraction of a millilitre.

I dispensed the SuperLube directly onto the exposed ball-bearings using a 23G needle. Do not be tempted by the holes in the MGN9 carriages which look like they are designed to accept grease – these are grease holes in the official Hiwin carriages but they don’t go anywhere in the MGN9 carriages.

Cut the needle short to reduce the force needed to dispense the grease. You will need to use pliers to shape the end of the needle a little so that it fits into the ball-bearing races. Then insert the needle amongst the ball bearings and squeeze the syringe hard to dispense grease.

I found dispensing the grease quite difficult due to the force required. A smaller syringe might have helped, or an alternative approach might be to apply grease directly to the linear rail and run the carriage over it, cleaning up the mess afterwards with a paper towel (not tested this).

Continue to apply grease until the carriages move smoothly.

Assemble & mount the Y-axis carriages

Assemble the Y-axis carriages onto the MGN9 carriages according to the exploded diagram.

For each of the two carriages, you will need:

  • (2x) M3x30
  • (2x) M3x25
  • (2x) M3x8
  • (2x) M3 square nuts
  • (4x) 3mm Harwin spacers
  • (2x) smooth idler pulleys
  • (1x) Y-carriage top
  • (1x) Y-carriage LHS/RHS
  • (2x) Y-carriage spacer

Mount the MGN9 rails

It is important that the Y-axis MGN9 rails are mounted parallel to each other for the gantry to move properly. To achieve this:

  1. Mount the 3 linear rails into position, doing up the fasteners so that they are snug but not tight and allow some movement of the rails.
    • The X-axis is secured in place using 4x M3x8mm bolts and square nuts through the Y-carriage LHS/RHS mounting holes. Underneath the head of each bolt is a 1mm MGN spacer which will stop the end of the bolt protruding too far and hitting the belt.
    • The Y-axes are secured in place using the 2x 2020 extrusion lengths, 4x M3 x 8mm bolts, and the 4x metal T nuts. Due to the importance of accurately mounting the axes, I don’t recommend using 3D printed T-nuts (which are used elsewhere in the design). The 2020 extrusion should be perpendicular to the Y-axes.
  2. Tighten up the X-axis bolts.
  3. Tighten up 2x bolts on one of the Y-axis rails.
  4. Move the gantry to the very top of the Y-axis and tighten the top bolt.
  5. Then move the gantry to the very bottom of the Y-axis and tighten the bottom bolt.
  6. Check if the gantry can move freely back to the top of the Y-axis , now that all the bolts have been tightened. If not, loosen the top bolt to allow the rail to pivot, move the gantry to the top, and re-secure the bolt.
  7. Repeat the process of moving the gantry up and down while tightening and loosening bolts until the gantry can move freely.

Mount the stepper motors

Mount the two stepper motors to the baseplate using 8x M3x10mm bolts, 8x rubber vibration washers, and 2x cork vibration dampeners. The vibration dampening cork & rubber washers will help reduce the noise of the machine.

Mount the toothed drive pulleys to the stepper motor shafts using the grub-screws. You will need to adjust the height of these pulleys later so that they are at the same height as the other pulleys.

Mount the idler pulley assemblies

Assemble the two toothed idler pulleys to the baseplate according to the exploded diagram. The 3mm plywood parts are used to spread the forces caused when the belt is under tension.

For each of the two toothed idler pulleys, you will need:

  • (1x) M3x40mm socket button head screw
  • (1x) toothed idler pulley
  • (1x) Harwin spacer
  • (1x) Idler pulley spacer
  • (2x) M3 flange nuts
  • (1x) Reinforcing plywood laser cut offcut

Assemble and mount the paper clamps

Disassemble the mini clothes pegs to get their springs, then use the springs to assemble the paper clamps according to the picture below. Unless you manage to buy mini clothes pegs with the same sized springs as mine, you will need to edit the design of the paper clamps in Fusion 360, or another CAD software.

I printed the paper clamps using wood-filled PLA filament, which improves the aesthetic and gives a nice tactile feel.

Mount the paper clamps using (8x) M3x12mm bolts & (8x) M3 hex nuts.

Mount the push buttons

Install the 3x push buttons into the holes marked ‘calibrate’, ‘paint / stop’, and ‘camera’.

The H-bot gantry assembly is now complete.

Step 5: Make the Brush Holder Assembly

Probably 80% of the time spent designing the machine was on this brush holder assembly. It’s densely packed with components and should be fun to put together.

Once the next steps are complete the assembly should look like the front/back pictures above.

Next steps:

  • Step 6: Assemble the X-axis carriage
  • Step 7: Assemble the servo bracket
  • Step 8: Assemble the brush holder

Step 6: Assemble the X-axis Carriage

This step refers to the 3D printed part ‘X-axis carriage’.

You will need:

  • (2x) M3 x 8mm socket button head screws.
  • (4x) M3 x 12mm socket button head screws.
  • (4x) M1.2 x 12mm slotted screws
  • (4x) M1.2 nuts
  • (4x) Ø5mm x 10mm magnets
  • (2x) M3 threaded insert, 4mm length, Ø4.3mm OD
  • (1x) M3 threaded insert, 5.2mm length, Ø4.3mm OD

Install the threaded inserts

There are several ways you can install threaded inserts. My

personal preference is to press them into an undersized 3D printed hole with a vice.

  • It is strong enough that the thread won’t come out unless the force is high enough to destroy the 3D printed component anyway.
  • It doesn’t require any tools beyond the vice.
  • If you scrap the part and want to retrieve the threaded insert, you can just crush/lever it out of the plastic with the vice with ease. I expect it’s not worth the trouble for an insert which has been melted or glued into place.

Install the M3 threaded inserts to the X-axis carriage. I recommend putting a long M3 bolt into the threaded insert when pressing the insert into place to give better access for the clamp as shown in the picture above. I used the shorter threaded inserts for the two holes next to the belt clamp.

Mount the limit switches and magnets

Mount the limit switches using the M1.2 x 12mm bolts and M1.2 hex nuts according to the exploded diagram.

Mount the magnets into the X-axis carriage using super glue to hold them in place. The North/South orientation of the magnets is important – the X-axis carriage must magnetically attract the servo bracket. Skip ahead in the instructions to and glue the magnets into the servo bracket – the orientation of magnets in the servo bracket is not important.

Place a magnet on the outside of the servo bracket to find the correct orientation for the magnet. Then, glue the magnet into the X-axis carriage making sure the orientation is correct. Repeat this for the 4x magnet installation locations on the X-axis carriage, so that the servo bracket snaps into place whether in the horizontal or vertical mounting position.

Strip and insert the spiral cable

The spiral USB cable should have a short straight section at the end where it connects to the USB connector. Snip off the USB connector, and then strip approximately 20mm of the outer black insulation to expose 4x wires. Strip the end of each of these 4 wires (e.g. 3-5mm).

Once stripped, force the spiral cable into the front of the X-axis carriage so that the outer insulation just protrudes from the exit hole. This should be a snug fit, as the hole should be providing strain relief to the cable (prevent it from accidentally coming out). If the fit is loose, consider using some glue.

Install the presser foot

The presser foot gently pushes down the paper or card while the machine is painting. Paper is wavier than I thought, and so the presser foot is essential. To install the presser foot you will need:

  • (1x) M4x8mm socket button head screw
  • Presser foot
  • Presser foot handle
  • Ø5.6 x 17.5mm compression spring from Amtech AM-S6210 assorted springs

The M4 button head screw provides a smooth surface to run over the paper without gripping it. Use an M4 tap to thread the internal hole in the presser foot, then install the M4x8mm screw.

Remove any excess plastic from the presser foot and presser foot handle so that they can move smoothly within the presser foot hole in the X-axis carriage.

Insert the compression spring into the hole. Insert the presser foot after the spring. Apply a blob of super glue to the end of the presser foot handle and insert through the top of the X-axis carriage into the presser foot handle.

Step 7: Assemble the Servo Bracket

This step refers to the 3D printed part Servo Bracket.

You will need:

  • (4x) Ø5mm x 10mm magnets
  • (2x) Ø3mm x 25mm dowels
  • (2x) M2 x 10mm socket button head screws
  • (2x) M2 hex nuts
  • (3x) M3 x 10mm socket button head screws
  • (1x) laser cut acrylic servo mount plate (from kitronic actuator)

Glue the magnets

Glue 4x magnets into the Servo Bracket. The orientation of the magnets is not important.

Glue the dowels

Push the (2x) Ø3mm x 24mm dowels into the Servo Bracket, along with some super glue to fix them in place.

Drive the servo to the 90° position

Temporarily wire up the servo to the Robotdyne Arduino MEGA Pro so that you can drive it to the 90° position. You can copy/paste the below sketch. Connect the red wire to 5v, the brown wire to ground (0V), and the orange wire to pin 3. Once the sketch is uploaded, the servo will drive to the required position for mounting and you can disconnect from the Arduino.

#include <Servo.h>
Servo myservo;  // create servo object to control a servo
void setup() {
  myservo.attach(3);  // attaches the servo on pin 3 to the servo object
}
void loop() {
  myservo.write(90);   // sets the servo to 90degrees                      
}

Mount the servo

Mount the servo in position using 2x M2 x 10mm bolts & hex nuts. The label of the servo should be pointing upwards – away from the 3D printed part. Also push the acrylic mounting plate from the Kitronic parts onto the servo. This should snap into place and does not need to be glued (the brush holder will prevent it from coming loose once that is mounted).

Solder the limit switches & servo

The servo and limit switches solder onto the spiral USB cable. Cut the connectors off the servo cable and strip the ends of the wires.

  1. Determine which pins of the limit switches to use. Use your multimeter on connectivity mode, and identify the two pins which are:
    • Connected when the switch is pressed.
    • Not connected when the switch is not pressed.
  2. Wire up the servo and limit switches according to the below diagram. Use heat shrink cable (or a hot-glue blob) to prevent the spliced wires from short circuiting against each other.

Refer to the diagram and picture to see how I've done it.

The trailing wires might rub on the belt if left loose, so perhaps glue them to the underside of the 3D printed part to keep them out of the way if necessary. I’ve also used hot-glue to insulate the solder joints to prevent short circuits.

Step 8: Assemble the Brush Holder

This step refers to the 3D printed part ‘Brush Holder’.

You will need:

  • (1x) M3 threaded insert, 4mm length, Ø4.3mm OD
  • (1x) M3 x 6mm button head socket screw
  • (2x) M3 x 12mm button head socket screw
  • (2x) M3 hex nuts
  • (1x) M3 x 10mm thumbscrew
  • (1x) M3 square nut
  • (1x) laser cut acrylic rack (from kitronic actuator).
  • (1x) Igus rail cut to 30mm long

Install the threaded insert

Press the M3 threaded insert into place using a vice.

Mount the thumbscrew

Glue the M3 square nut into position and then do up the thumbscrew. It’s best to leave the thumbscrew just snug rather than tight, as PLA will creep (distort) over time.

Mount the Igus linear rail

The amount of play in the Igus rail & carriage is
terrible, and they’re barely cheaper than a small MGN7 alternative which is similarly low-profile. On the plus side, there’s no risk of spilling ball bearings everywhere when assembling/disassembling.

Cut the linear rail to length with a hacksaw, and then screw the linear rail into place with a single M3 x 10mm bolt into the threaded insert.

Mount the rack gear

Mount the rack gear to the brush holder using 2x M3 x 12mm
bolts and 2x M3 hex nuts.

Mount the brush holder

You will need:

  • (1x) laser cut acrylic pinion gear (from kitronic actuator).
  • (1x) Igus carriage
  • (3x) M3 x 10mm button head socket screws
  • (1x) Amtech extension spring 6.4 x 22.2mm

Slide the Igus carriage onto the Igus linear rail attached to the brush holder. Push the Igus carriage into the servo bracket, and fasten it in place with a M3x10mm bolt (one of the threaded holes of the carriage will be left unfastened).

Screw 2x M3x10mm screws into the acrylic mount plate through the slots in the acrylic rack gear.

Now, hook the extension spring over the two spring hooks of the servo bracket and the X-axis carriage. While making sure that the spring is extended by at least 5mm, push the acrylic pinion gear onto the servo shaft.

The brush holder should now be mounted to the servo bracket & X-axis carriage. The servo is at its 90° position and the spring is extended by at least 5mm.

The purpose of the spring is to preload the rack and pinion gear. This ensures that the teeth are always in contact with each other and eliminates any ‘backlash’ or ‘slop’ when the servo changes direction and the rack/pinion teeth disengage/re-engage.

Mount the brush holder assembly to the MGN9 carriage

Use 4x M3 x 12mm button head bolts to mount the brush holder assembly onto the MGN9 carriage on the X-axis of the H-bot gantry.

Step 9: Install the Belt

Place the belt so that the belt teeth engage with the teeth on the X-axis carriage, then screw the belt clamp into place with 2x M3x8mm bolts to fix the belt into position.

Thread the belt around the H-bot gantry as shown in red on the picture.

Try and estimate how long the belt needs to be, and then thread the belt into the belt tensioner as pictured, so that the teeth engage with each other.

Screw the belt tensioner into the X-axis carriage using an M3 x 12mm bolt. If the belt is too long/short, make coarse adjustments by re-threading the belt into the belt tensioner. When the belt is sort-of tight, the tension can be increased by tightening the belt tensioner screw.

The belt should be nice and tight. Twanging the belt should produce a note. Under-tensioning the belt will actually cause more force to be applied to the clamps, as when the carriage changes direction the belts will suddenly snap tight.

Step 10: Install the Battery and Charging Circuit

3-cell batteries and battery chargers use JST connectors. In this section you make your own JST connectors using a fairly expensive crimping tool (£25 for a tool and assorted JST-connectors). It’s physically possible to avoid buying the tool and instead spend lots of time bodging the connectors together. I strongly recommend you buy the crimping tool, it is 100% worth it to avoid the pain even if it’s only for this project.

Install the battery

Install the battery mount to the 2020 extrusion using 2x M3 x 10mm bolts and 2x 2020 T-nuts with M3 square nuts.

Install the battery into the battery mount using cable ties.

LiPo batteries are a fire hazard. A fire is most likely to occur during charging of the battery, so you should never leave this fairly sizeable battery charging unattended. There are fibreglass battery pouches available but they are completely useless (check out YouTube videos of them failing). To give the battery the best chance, buy it from a reputable source and don’t physically damage it. Only charge it using an appropriate LiPo charger. The battery only has enough charge for 10-15 paintings, however a larger battery represents a more significant fire risk (again, see YouTube).

12V will not harm you if you touch the live wires with your fingers, however the high current output of the battery means that it is capable of big sparks if short circuited. Short circuiting the battery can start fires, as well as permanently damage the battery in less than 1 second.

Mount the battery discharge protector

The battery discharge protector protects the battery from being over-drained if the machine is left on. When the battery voltage drops below a certain threshold, a relay will kill power to the circuit and sound an alarm.

Without the battery discharge protector, if the machine is left on then the screen, camera, and Arduino will continue to draw a current from the battery until it is over-drained. This will permanently kill the battery. The battery protector itself will draw a small current which will eventually over-drain the battery (why is why it has an alarm), so the machine should always be switched off when not in use.

The battery discharge protector for a 12V battery is normally pre-set to cut off the power when the battery drops to about 10.5 V. If you have a variable voltage power supply, you can adjust the cut-off voltage using the potentiometer on the battery discharge protector. The painting machine will start to malfunction at around 10.7 V (e.g. stop moving in the middle of a painting).

Use the 3D printed Battery Discharge Protector Spacers and 2x M3 x 10mm bolts and 2x 2020 T-nuts with M3 square nuts to mount the component onto the 2020 extrusion.

Wire up the power switch

Wire up the power switch according to the diagram. Leave the battery disconnected until after you have checked for short circuits & the instructions specify it is time to connect the battery.

JST plug

  • Use the crimping tool to make the JST male 4-pin plug at the end of the 500mm long wires.
  • To neaten up the 500mm long wires, consider sleeving them in some 550 paracord, and using heat shrink tubing to contain the ends.

JST socket

  • The wires extending from the power switch to the JST female 4-pin socket need only be ~100mm long.
  • Soldering the JST female socket is a nuisance because the plastic has quite a low melting point, so the pins end up out-of-line. I recommend plugging a plug into the socket to hold the socket pins in place while soldering. (Really, these sockets are intended to be mounted on a PCB).
  • Once the socket has been soldered successfully, the solder joints will be very prone to breaking when the battery plug is inserted/removed. There’s a good chance that while trying to grip the socket, you accidentally short the wires & the battery (it happened to me). A dollop of hot glue is not sufficient to solve this. I used Araldite 2-part putty and moulded it around the socket and solder connections. It cures very hard and rigid. Make sure to wear latex/nitrile gloves when working with the putty as it is sticky, smelly, and (like many adhesives) contains small amounts of carcinogens (cancer). I also applied the putty to the power switch solder joints.

Battery discharge connector

  • Attach the 12V and 0V wires to the battery discharge protector screw terminals. Check the documentations for the battery discharge connector to identify the correct terminals. It’s important not to connect the battery while these wires are loose, as they could accidentally touch each other and cause a short circuit.

Make/test the charging/power circuit

The power switch has two positions:

Position ON: The battery 12V & 0V wires are connected to the battery discharge protector 12V & 0V wires.

Position OFF/charge: The 4 battery wires are connected to the JST plug.

Carefully double check that the wiring is correct. The battery wires must be connected to the same pins in the newly made JST connector as they are in the original battery JST connector.

  1. Manually trace the wires.
  2. Use the multimeter on conductivity mode to double check the wires.
  3. Use the multimeter on conductivity mode to check that there are no short circuits between the wires (i.e. none of the 12 pins on the power switch are connected to each other, other than by action of the switch as intended).
  4. Connect the battery to the socket and use the multimeter on Volts mode to check that the voltages across your new JST plug pins are the same as across the battery JST plug pins.

Read the instructions of your 3-cell battery charger and then connect the newly made JST plug into the 3-cell battery charger and switch the power switch to the charging position. If you have wired up the JST connectors incorrectly, the battery will catch fire! (The chargers might come with safety features to prevent charging an incorrectly connected battery, but I haven’t checked).

Step 11: Make & Wire the PCB

Order the PCB

Ordering a custom PCB might sound intimidating, but it is as easy as ordering anything else online.

  1. Download the PCB Gerber files. You do not need to unzip the folder. (‘v3 Painting Machine Schematic_2021-03-23’). Instructables doesn't accept these file-types, but you can find the files on my GitHub here: https://github.com/benlucy/Arduino-Portable-Portrait-Painter
    • The zip file is called: v3 Painting Machine Schematic_2021-03-23
  2. Go to a Chinese manufacturer website such as JLC-PCB or Elecrow.
  3. Click to order a PCB.
  4. Upload the zipped folder containing the Gerber files.
  5. Choose the options highlighted in the picture. Most of the options will default to those shown. Choose your preferred colour. Do the world a favour and choose Lead Free HASL surface finish.

Adjust the voltage converters

There are two voltage converters on the board. One is to power the Arduino, screen, camera, and TMC2208 logic. The other is to power the servo. Set them both to 6.5V.

To set the voltage of the voltage converters, connect the input pins to the battery terminals (12V), and then measure the voltage across the output pins using a multimeter. Adjust the potentiometer to adjust the voltage.

Solder the PCB

I often use female header pins for the more expensive components on the board. Partly so that I can use the components in other projects if I want, but mostly so that if I accidentally destroy a component on the board I can easily extract the valuable components and start again on a new PCB.

In this case, if you use female headers to mount the stepper motor drivers there will not be enough room in the wooden box to fit the PCB. If you use the stepper motor protector boards (strongly recommended), then you will be able to swap out the valuable TMC2208 boards anyway. You can use female header pins for the Robotdyne Arduino Mega Pro board if you wish (I would).

Your PCB will look a little different to mine. My original PCB had a couple of mistakes, which I fixed by cutting traces & soldering on extra wires and components. The Gerber files you have downloaded incorporate these fixes into the PCB.

Solder the components onto the board

  • Robotdyne Arduino MEGA Pro
  • 2x TMC stepper protectors
  • 2x TMC2208 stepper motor drivers. Apply the 2x sticky heat sinks that come with the TMC2208 boards.
  • 2x 4-pin terminal blocks.
  • 2x voltage converters.
  • 2x 100uF polarised capacitors.
  • 1x 100nF ceramic capacitor.
  • 1x tilt sensor.
  • Resistors 1, 2, 3, 4, 5, and 6 are 1k Ohms.
  • Resistors 7, 8, 9, 10, 11, and 12 are 680 Ohms.
  • Resistors 13 & 14 are 10k Ohms.
  • Resistor 15 is 1M Ohms and resistor 16 is 500k Ohms.

Solder the screen and camera wires

Solder the screen wires:

  • 8 wires must be soldered between the screen and the board. The pins are labelled on the screen, and the corresponding hole is labelled on the PCB. I don’t recommend using wire header terminals for this as the connection is not reliable compared to a soldered joint.

Solder the camera wires:

  • Similarly to the screen, there are 18 wires that must be soldered between the camera and the board. The pins are labelled on the camera, and the corresponding hole is labelled on the PCB.
  • The camera wires are extremely susceptible to interference. Pinching the camera wires together with your fingers will eliminate the interference. I tried replicating this with some cable ties but not very successfully. I got a separate length of wire, and tightly wrapped it around the camera wires. That has worked for me. I’m not sure if it’s the physical restraining or if the coiled wire interacts with generated fields in a useful way.

Ensure that the screen & camera wires are long enough to reach once the screen, camera and PCB are mounted in the machine.

Solder the push-button wires

Cut and strip the ends of 6x lengths of wire which will reach to the three push-button positions (~200mm).

Solder these wires to the PCB where labelled. (CALIBRATE IN, CALIBRATE OUT, PAINT IN, PAINT OUT, CAMERA IN, CAMERA OUT).

Solder the spiral USB cable to the PCB

Snip the USB connector off the free end of the USB cable.
Expose ~20mm lengths of the 4x internal wires and strip the ends of each of these 4x wires.

Poke the USB cable through the baseplate hole, and wind it through so that most of the spirals are on the underside of the baseplate. I left about 3 inches of spirals on the front side of the baseplate, or 21 spirals.

Solder the 4x USB wires to the PCB.

  • GREEN to SIGNAL
  • RED to +VE
  • BLACK to GND
  • WHITE to XLIM/IN

Solder the power wires (12V and Ground)

Cut and strip the end of two wires approximately 300mm long. Solder them to the PCB where it is labelled ‘12V’ and ‘GROUND’. I used 22AWG wire for these, as they will be carrying a lot of current.

Mount and solder the Y-axis limit switches

Materials for this step:

  • Wire
  • (2x) limit switches
  • (2x) ‘limit switch covers’
  • (4x) M1.2 x 12mm screws
  • (4x) M1.2 hex nuts

Cut and strip the ends of 4x lengths of wire about 300mm length each.

Use a multimeter on the continuity setting to determine which pins of the limit switches are connected when the switch is closed (as with the X-axis limit switches). Solder the 4x wires to the identified limit switch pins.

Poke the wires through the holes for the top and bottom Y-axis limit switches, put the limit switches in position over the mounting holes, and mount using the screws & the limit switch covers to improve appearance.

Solder the wires to the PCB where labelled. (YLIM/BOTTOM/OUT, YLIM/BOTTOM/IN, YLIM/TOP/IN, YLIM/TOP/OUT).

Adjust the TMC2208 current limit

Ensure that you have not jumped ahead and wired the stepper motors to the PCB. Adjusting the TMC2208 current limit should be done without stepper motors connected.

Switch on the power switch.

Measure the voltage across each of the TMC2208 boards, place one multimeter probe on the potentiometer, the other on the ground pin. Adjust the voltage of the potentiometer to adjust the voltage of each board to about 1.27V.

Connect the stepper motors

The stepper motors should each have 4x wires trailing from
them. If there is a connector at the free end of the wires, snip it off and strip the ends of the wires.

Connect the ends of the wires to the screw terminals on the PCB. You will need to check the datasheet/documentation for your stepper motors to identify which wires are which (A+, A-, B+, B-), and then wire them up according to the below diagram.

If you can’t find the documentation for the stepper motor, follow these instructions:

  1. Identify the two coils of the stepper motor.
    • Place an LED across two of the stepper motor wires, then manually spin the motor shaft. If the LED briefly flashes, then those two wires are one coil, and the other two wires are the other coil. If the LED does not flash, try a different combination of wires.
  2. Guess which coil is A and which is B.
  3. Later on, when running the program, if the x/y gantry moves in the wrong direction, swap the A/B wires around.
    • (Be careful when running the program the first time – the current code hasn’t set up the limit switches to stop the motors in the event of a crash).

Mount the screen and camera

Mount the screen using 4x M3x8mm bolts and 4x hex nuts.

Attach the camera to the camera mount using 4x M3 x 10mm bolts and 4x square nuts, then glue the camera mount onto the baseplate using superglue.

    Step 12: Prepare the Wooden Box

    Buy or build a wooden box

    The machine is designed to fit inside the largest wooden box I could find on Amazon. Depending on where/when you are reading this, the box may no longer be available. In this case you must either adapt the design to fit a similar box or build your own.

    If buying a box, beware that the machine only just fits within the internal dimensions of the chosen box (380L x 280W x 115H mm). If your box is larger than mine, just make the baseplate bigger, and only adjust the position of the 4x mounting holes (see ‘Adjust the DXF file’). Or you could do some design/coding work yourself and increase the size of the gantry. (See ‘Potential improvements to the design’ in the appendix).

    If building a box, I am sure you can find a suitable Instructable. Personally, I think the easiest way would be to order some laser cut 10mm plywood with joining tabs, and then glue them together. This is the approach I would take if I were to make a larger machine. There are many free online tools which generate DXF files for custom-dimension laser cut boxes, e.g.:

    The remaining instructions assume that you successfully bought the same box as me. If you didn’t then you’ll have to adapt these instructions yourself.

    Remove the lid

    The two hinges of the box are hidden within slots, and a pin has been fired through the top & bottom of the hinge to hold it in place. To remove the hinges, the pins must be removed.

    The pins can be hammered out using a picture tack or small nail. Firstly, blunt the head of the tack – this will stop it from escaping around the side of the pin, which will make the pin much more difficult to remove. The tack can be blunted by hitting the pointy end of the tack with a hammer.

    Insert the blunted tack into the pin hole, and then gently hammer it. The pin will be pushed out into the box, where you can grab it and pull the rest of the way using pliers. The hinge will then lift out of the slot.

    I successfully removed 3 out of 4 pins with this technique. The first pin I hadn’t blunted the tack. In the event that a pin doesn’t come out, it is possible to gradually pull the hinge directly up out of the slot. When pulling the hinge like this the pin holding it will slowly bend in half, allowing the hinge to be removed.

    Install dowels and magnets

    To make the lid removeable, I decided to go with glued metal dowels and magnets which has worked well.

    • 4x Ø4mm dowels protrude from holes drilled into the lid.
    • When the lid is put on, the dowels go into 4x Ø5mm holes drilled in the wooden box.
    • Magnets deeper inside the Ø5mm holes attract the dowels and hold the lid on.

    Use the lid dowel drill guide to drill holes in the lid and the base so that the holes line up. Use electrical tape on the drill to control the depth that you drill to. You only want the dowels to protrude ~5mm. If the dowels protrude too far, then you might accidentally use the lid as a lever to split open the holes in the base, which would be bad. To push the Ø5mm magnets down into their holes, you can use long stainless steel (non-magnetic) bolts.

    Install the handle

    I purchased a handle I liked the look of from eBay and mounted it using countersunk screws. It’s important that the mounting doesn’t obstruct the baseplate mounts or baseplate itself.

    Make and assemble the baseplate mounts

    Once the 3x ‘baseplate mount’s have been printed, and the 1x ‘slim baseplate mount’ has also been printed, press the 4x M5 threaded inserts into place using a vice.

    The next step is to screw the baseplate mounts into the box using 3.5mm x 10mm self-tapping woodscrews. It is vital that the baseplate mounts line up with the baseplate.

    1. Position the baseplate mounts in the box by eye (taking note of the correct position for the 1x slim baseplate mount – next to the camera).
    2. Push a little blu-tac against the sides of the baseplate mounts to fix them into position.
    3. Place the baseplate into the box and ensure that the mounting holes line up with the threaded inserts.
    4. If the holes don’t line up, repeat steps 1-3 until they do.
    5. Remove the baseplate, and drill 2.5mm guide holes ~5mm into the wood, using the blu-tac’d baseplate mounts as a guide. The guide holes are a precaution to make sure that the wood doesn’t split when the 3.5mm screws are screwed in.
    6. Screw in the 8x 3.5mm screws (two for each of the baseplate mount).

    Install the rubber feet

    Drill 4x 2.5mm holes for the 4x rubber feet at the bottom side of the machine, and then screw them into place using 3.5mm x 10mm woodscrews.

    Build and install the charging port and cable

    If you’d rather open the box in order to charge the battery you can skip this step. Otherwise, this step will create a charging port in the box. The machine cannot be powered on while charging. I assumed this would be difficult to achieve & I didn’t look into it as an option.

    Charging port

    Drill a Ø12mm hole for the mini DIN connector socket, and then using the DIN socket as a template, drill 2x 3.5mm holes to mount it. The hole should be about 27mm up from the base. If the hole is drilled too high, then there will be a clash with the internal components & the power switch.

    Solder 4x ~80mm wires to a JST female socket. This socket is going to connect to the JST plug coming from the power switch and it would be sensible to use the same colour wires so that it is easier to see which wires will be connected when the plug is plugged into the socket.

    Pass the 4 wires first through the charging port and second through the 12mm hole. Solder the wires to the mini-DIN socket solder cups. Then push the mini-DIN socket into its mounting hole. See the picture above.

    Mount the charging port and mini-DIN socket onto the wooden box using 2x M3 x 20mm bolts and 2x M3 nuts. Glue the JST socket into the charging port.

    Charging cable

    Open the mini-DIN plug to expose the solder cups. Cut and strip ends of 4x 300-500mm length wires, and solder them to the solder cups. Use the same four colours as before. Make sure that when the DIN plug is plugged into the DIN socket, the pins which come into contact have the same colour wire soldered.

    Sleeve the 4 wires with some paracord, use heat-shrink tubing to seal each end, and then close up the DIN plug. See the picture above for the finished result.

    Using the crimping tool, install a 4-pin JST plug at the other end of the cable. Ensure that the wires are connected to the correct pins for charging as per the diagram. It does look a bit ridiculous, but all these connectors are necessary. Remember the importance of double checking that these wires are done correctly and methods to do so. If the charger is connected to the battery incorrectly, the battery could catch fire.

    Step 13: Upload the Arduino Program

    • Download the files from Github here: https://github.com/benlucy/Arduino-Portable-Portrait-Painter
      • Save the folder 'LiveOV7670' to your computer.
    • Copy "src/lib/LiveOV7670Library" and "src/lib/Adafruit_GFX_Library" to Arduino "libraries" folder (If you already have "Adafruit_GFX_Library" then you don't have to copy that).
    • Open file OV7670 in the Arduino IDE.
    • Connect the Arduino to your computer with a USB cable.
    • Go ‘Tools’ > ‘Board’ > ‘Arduino AVR Boards’ > ‘Arduino/Genuino Mega or Mega 2560’.
    • Go ‘Tools’ > ‘Processor’ > ‘ATmega2560 (Mega 2560)’.
    • Go ‘Tools’ > ‘Port’. Then select the correct USB port.
    • Click the upload arrow and wait for the program to upload.

    If you struggle with this step, complete the Adafruit.com basic Arduino tutorials so that you are comfortable with using an Arduino.

    Once uploading is complete. Disconnect the Arduino, place the baseplate into the box using the idler pulleys and the X-axis gantry as a handle, then fasten the baseplate in place using 4x M5 x 8mm bolts.

    Congratulations on completing the build! The machine is now ready to paint your portrait!

    Step 14: Operating Instructions

    1. Lift the presser foot, so that it won’t obstruct the loading
    2. of paper.
    3. Load a piece of paper into the paper clamps. With a little practice, one person can do this without creasing the paper.
    4. Turn on the machine (to ensure that the brush holder is at the correct height).
    5. Lower the presser foot.
    6. Loosen the thumbscrew a little and insert a brush-pen. Adjust the height of the pen so that the tip is very nearly touching the paper. Then tighten the thumbscrew.
    7. Press the ‘calibrate’ button. The machine will now begin moving the brush back and forth. The brush will be lowered for each new line. Once the brush has painted a line where the brush was in contact with the paper for the full length of the stroke, press the ‘calibrate’ button again. The machine now knows the minimum brush position that will ensure contact with the paper.
    8. Press the ‘camera’ button to run the camera.
    9. Press the ‘camera’ button to freeze the image (take a picture). If you don’t like the picture, just press the button again to return to live video. For best results, ensure the person’s face fills the screen so that the machine can pick out details.
    10. Once you have a picture you like displayed on the screen, press ‘paint / stop’ to begin painting. To cancel the print for any reason, press the button again.
    11. When a painting is finished, it is difficult to remove the paper without accidentally drawing squiggles on it with the brush. Therefore, remove the brush (or move the servo bracket to the 90° mounting position) before removing the painting.

    Note that the brush pen may bleed through the paper onto the next sheet or onto the wood. This is likely to happen if the brush is pressed against the paper while not moving the axes. If you have treated the plywood with spray-on lacquer, then the paint can be wiped off with a damp cloth. It’s best to have a couple of sheets of paper/card in the machine.

    Note that when the machine is turned on, the screen will flash a colour to indicate the battery status. Green = high, yellow = medium, red = low. When the battery is very low the machine might mis-behave and stop moving in the middle of a print or calibration. When the battery drops below ~10.5V, the battery discharge protector will kick-in and prevent the machine from being turned on until the battery has been charged.

    Step 15: Potential Improvements to the Design

    Increase the size of the gantry, to increase the detail via more pixels plotted

    The screen holds 160 rows of 128 pixels, however the current machine only paints every other row (80 rows). Therefore a more detailed painting could be created with twice as much information in it. Why haven’t I done this with the current machine?

    • The brush pen has a limited resolution. Currently it paints lines 2mm apart. Attempting to paint lines 1mm apart doesn’t work, as there is very little difference between the thickness of the thickest and thinnest brush stroke.
    • Therefore, the image itself must be made larger, so that the lines can remain 2mm apart.
    • Therefore a larger machine is required. The machine needs only to be 65mm wider, and then it will be able to cover the full width of an A4 sheet.

    A larger machine would come with the following limitations:

    A box this size is not available off the shelf so needs to be made custom.

    • Currently, it takes ~4:50 to do a painting (not including set-up time or time spent capturing the picture). Twice as many lines would take approximately twice as long at 10 minutes per painting. With the smaller machine, four people could have portraits within half an hour. A larger machine would take the best part of an hour. This would be a lot less fun and involving. However, a larger machine could have larger pulleys and therefore run at faster speeds which may largely offset this.
    • It would not be possible to fit the whole image in if rows are painted 2mm apart (therefore twice as tall) as the A4 paper is not wide enough for the painting to be twice as wide. The sides of the image would have to be cropped.
    • The larger box will slightly hurt the aesthetics & portability.

    Improve the rigidity of the axes

    Huge ‘racking’ motion of the gantry is visible as the X-axis changes direction. This is due to the uneven forces introduced by the H-bot, and the poor rigidity of the 3D printed Y-axis carriages. The Y-axis carriages could be re-designed to be larger & then incorporate a second beam extending alongside the X-axis to improve rigidity. This would slightly reduce the range of motion in the Y-axis, but there is already more range available than is needed.

    Fortunately, for the purposes of only moving from left-to-right, the racking motion is very consistent and therefore the quality of the painting is unaffected. However if you wanted to use the gantry with a different Arduino program which did more complex plotting motions, eliminating the racking motion would be essential.

    Improve the charging circuit so the machine can run while charging.

    I haven’t looked into this at all because of the prospect of confusing the charger, damaging the battery, and causing a fire. However I assume it is possible to do this safely.

    Make use of the tilt sensor

    A tilt sensor was included in the PCB design/make. Originally I envisioned being able to turn the machine 90° to make landscape paintings (perhaps of two people at once). I haven’t included that in the code and I don’t currently intend to. However, all the necessary pieces of code are there ready to be adapted, including a function to read columns of 160 pixels (rather than rows of 128) so you could do it yourself if I don’t do it in the future.

    Code ‘interrupts’ for the limit switches

    I haven’t got around to doing this, and now I probably won’t. It should be the case that if the machine crashes the limit switches kill power to the motors. This can be done using interrupts. The X & Y limit switches are wired to the interrupt pins of the MEGA.

    Ben Lucy. 2021.

    Automation Contest

    Runner Up in the
    Automation Contest

    Be the First to Share

      Recommendations

      • STEM Contest

        STEM Contest
      • Role Playing Game Challenge

        Role Playing Game Challenge
      • CNC Contest

        CNC Contest

      8 Comments

      1
      MrBulp
      MrBulp

      7 days ago

      Awesome!! i wonder if you implement some code to draw perfect circle or other shape right?

      0
      Ben Lucy
      Ben Lucy

      Reply 7 days ago

      Thanks! This would actually take quite a bit of work for a few reasons:
      1. The gantry isnt very rigid so there is unwanted movement. For drawing straight lines this isn't a problem because the movement happens immediately at the start of each line, so all the lines are aligned. For a circle it might have more of an effect, so the carriages would need a little redesign to eliminate the movement.
      2. The advantage of this plotter is that you don't need a computer, but that's also a disadvantage. If you want to draw a circle then you need to overwrite the arduino specifically to do this.
      3. You'd need to redesign the brush holder so that the brush is vertical to the page, so that the direction of movement doesn't affect the line thickness.

      2
      snowflake81
      snowflake81

      15 days ago

      Amazing work! Is there any chance that you could share the schematic or board layout in a graphic file other than gerber? I tried to open your files inn Altium but it gives an error. I'm interested in replicating the setup for arduino and pololu drivers

      1
      Ben Lucy
      Ben Lucy

      Reply 15 days ago

      Thanks! Yep I've now added the Autodesk Eagle files to the github (the '.sch' and '.brd' files) which you should be able to import into Altium

      1
      zolv
      zolv

      16 days ago

      Absolutely amazing project!

      Have You tried such an idea: print an image the regular way, then rotate the image 90 deg (both, in Arduino and the paper) and execute plotting again so it will print same image rotated on an already printed paper?? It could (theoretically) add vertical lines to an image the same way as horizontal lines. Maybe the "quality" will increase?

      0
      Ben Lucy
      Ben Lucy

      Reply 16 days ago

      Glad you enjoyed it!

      Thanks for the thoughts, I really like that idea and it would be fairly easy to add. The detail of the painting is limited by how thin the lines can be, but I think it would be a cool style/effect. If the perpendicular lines were diagonal I think that would look good too.

      1
      masoud256
      masoud256

      17 days ago

      It's Amazing! Very Nice.

      1
      Penolopy Bulnick
      Penolopy Bulnick

      18 days ago

      Impressive job with this portrait painter :)