Motorised Painting Handle
Recommendations: 347
About the Project
Ok, maybe it's not cool to admit it, but I'm the kind of soft sap who cries at DIY SOS - seeing people's lives changed beyond measure by the goodwill of a community of skilled people is incredible. So when I read Ryan's post about accessibility (https://www.beastsofwar.com/featured/roll-for-insight-wargaming-accessibility/) in the hobby, I figured "here's something I can get involved with". I was particularly inspired by the big button game controllers, and recall how one of the things John kept "banging on" about in his recent review of a painting handle is how comfort - in either hand - is important. Which got me thinking about people who maybe couldn't hold their miniatures comfortably, but still needed to be able to hold, position and rotate them for painting. Luckily, motors and electronics and making circuit boards is "my thing". So I set about making a motorised painting handle. Hopefully someone might find it useful. I plan to post the schematics, code, laser-cutting files and everything else needed should anyone else wish to make one too....
Related Genre: Game Aid
This Project is Completed
Where it began....
Ok, maybe it’s not cool to admit it, but I’m the kind of soft sap who cries at DIY SOS – seeing people’s lives changed beyond measure by the goodwill of a community of skilled people is incredible.
So when I read Ryan’s post about accessibility (https://www.beastsofwar.com/featured/roll-for-insight-wargaming-accessibility/) in the hobby, I figured “here’s something I can get involved with”. I was particularly inspired by the big button game controllers, and recall how one of the things John kept “banging on” about in his recent review of a painting handle is how comfort – in either hand – is important.
Which got me thinking about people who maybe couldn’t hold their miniatures comfortably, but still needed to be able to hold, position and rotate them for painting. Luckily, motors and electronics and making circuit boards is “my thing”. So I set about making a motorised painting handle. Hopefully someone might find it useful.
I plan to post the schematics, code, laser-cutting files and everything else needed should anyone else wish to make one too….
Now there are plenty of robotic arms readily available across the intertubes that, on the face of it, would be ideal to hold and manipulate miniatures for painting. You can buy entire robotic arms relatively cheaply (simply Google “servo arm” to see how many and how cheap they are).
In fact, my first thought was to create a servo arm but, having experience in this area, I remember how difficult it is to create “damping” at the extremes of movement; the arm doesn’t move softly from point to point – there’s no “ramping” up or down of the speed – it simply heads to each new position as quickly as possible.
It’d be no good placing a heavy lead/pewter miniature in the jaws, moving it into position and have the robot arm fling the mini across the room! What we need is something a little more controllable…..
....I can't begin to knowing...
The 28BYJ-48 miniature stepper motor is brilliant for all kinds of homebrew robotics projects. Firstly, they’re cheap. Like a quid-a-shot cheap (if you source directly from China via AliExpress or Taobao). I had loads of these hanging around. Secondly, they’re (relatively) easy to interface with.
I find sticking a ULN2003 (or a ULN2803A) array onto the pins the easiest way to get these motors spining, controlling them via a microcontroller (either Microchip’s PIC or AVR’s Arduino).
The other nice thing about these little stepper motors is that they are quite powerful. As in, for a small form-factor, and for a low voltage, they’re quite torque-y (yep, that’s a word, don’t bother checking). Inside the casing is not just a tiny motor, but also loads and loads of gears.
In fact, these motors are geared down to about 1:4000 or something crazy like that. In short, it means that they’re also quite slow. For home robotics, this might be a problem. For us, it’s exactly what we want!
Stepper motors aren’t quite as straight-forward as regular motors; you don’t just put power to them and watch them spin. They have a number of coils which need to be activated in a particular sequence. The order in which you activate the coils determines the direction that the motor turns.
The benefit over “regular” dc motors is that you can stop the stepper motor dead, after a specfic number of steps have been counted – this makes them perfect for exact/precision positioning. In fact, we’re using the motor more like a regular motor (it’ll either be on or off, in either a clockwise or anti-clockwise direction) but taking advantage of the gearing to give us strength we wouldn’t otherwise have (and did I mention, they’re cheap too!)
To make this motor turn clockwise, we need to provide it with 5v, and ground certain pins in sequence:
If, for example, we pull the orange and yellow connections to ground, this creates an electromagnetic field in both coils, pulling the centre of the motor into the “bottom-left” position (SW point in the diagram above).
Now, this is where we control the direction.
If we then pull the yellow and pink pins to ground, the centre of the motor is drawn towards the top-left/NW point in the diagram. From here, pulling pink and blue to ground creates a magnetic field which attracts the centre of the motor to the top-right/NE point, and finally, pulling blue and orange to ground attracts the centre of the motor to the bottom-right/SE point.
Start again from the first state, pulling orange and yellow to ground and the motor has completed one full revolution.
Obviously, to get the motor to turn in the opposite direction, you activate the pins in the opposite sequence (orange and yellow, blue and orange, pink and blue, pink and yellow).
(Note for all your techy-nerds: yes, we could also activate each coil individually, creating a micro/half-stepping sequence, but by activating two coils at each time, we keep torque to a maximum).
But I know it's growing strong...
Ok, song lyrics as titles aren’t going to get me through the rest of this project, so I’ll leave that alone right now.
Now we’ve got our motors spinning, it’s time to get super-nerdy. (Skip this post if you’re not much bothered about how it’s made, and I promise, on the next one, I’ll do a bit more on the what/why).
I decided to use two back-to-back motors for the up/down movement, and a single motor on the top, to create the left/right rotation. As we’ve seen, driving stepper motors requires a bit more work than simply switching power to them, so I thought I’d shove an Arduino on to control them (normally I’d use PICs but Arduino seems to be really popular and, if this is going to go open-source so anyone can create their own, it makes sense to use what most people are comfortable with).
Here we’re using one set of signal wires to control two ULN2003 transistor arrays but if you look closely, you’ll see that one set are numbered 1,2,3,4 and the other 4,3,2,1 – this acheives the same result as driving one stepper motor in the opposite direction to the other.
The schematic helps with the placement of wires and traces when making a custom PCB.
Creating laser cut files
I tried 3d modelling software. I’ve love to be able to create 3d models, get all the measurements just right, and then simply send to a printer/laser cutter. But I just can’t seem to get my head around it.
I’ve spent a small fortune of Udemy courses, trying to learn Blender, 3DS Max, Fusion 360 etc. but I just can’t seem to “think in 3D”. Since the shapes are cut from flat sheets, I tend to think in 2D, draw the necessary shapes, cut them out, throw half away, amend the drawings and repeat, until something workable appears!
Drawing are then tidied up, removing all the guidelines and other nonsense shapes I’ve used to get distances and tolerances about right, and sent to the laser cutter.
Then the whole thing bolted together and checked for clearance, and to make sure all the moving parts move as required. At this point, all that’s required is some “firmware” on the Arduino controller and we can try this thing out….
Motorised painting handle - first test
One of the great things of having access to a laser cutter and few litres of ferric chloride is that it’s pretty easy to design, etch and manufacture your own PCBs in about an hour or so.
Here’s the current design, hooked up to the motors via a plug-in breadboard prototyping system. In the final design, things will be much neater and all the nasty wires hidden away, but for developing and debugging, being able to easily unplug pins to work out what’s going on is invaluable!
So far, it’s just a two-axis movement. But it should be more than enough for 90% of miniature painting. I might stick a third axis on it (to allow the entire base to rotate) but that would mean introducing tricky stuff like shift-registers as there aren’t enough pins on a regular Arduino Mini to control four stepper motors AND up to six input buttons.
One quick amendment I made after testing was to add a speed controller. Even at 4,000 steps per revolution, with a delay of just 2ms per step, the motors were making one complete revolution every few seconds. This might sound slow, but given the size of the frame the motors sit in, this actually translates as a lot of movement over a very short space of time.
A simple voltage divider on one of the analogue input pins means I can now change the delay between steps from anywhere between 2ms and 50ms – thus speeding up or slowing down the motors significantly.
Now to build a button interface and see how it all works out!
Adding a joystick
I started thinking about adding a third motor, and how this would require a whole load of other pins to be used and possibly even a complete overhaul of the current electrical circuit.
With up to six buttons (let’s call the axis pitch, yaw and roll, but I’m almost certain that those are not correct) and a speed controller, plus four pins for each of three motors – that’s a lot of input/output line for what was supposed to be a quick-and-simple over-the-weekend kind of project.
A quick rummage through my bits box (while many people have Space Marine arms and legs and heads and blaster guns in their bits boxes, mine has stuff like resistors and sensors and pushbuttons) and I found what I was looking for…
Nothing screams “disability friendly” like big chunky buttons.
And for users with poor fine-motor skills, they’re an absolute godsend. But this project is less about providing for users with fine-motor issues and more about creating a painting handle that is more comfortable, and easier to use, than simply gripping a miniature for extended periods of time.
So I figured that a relatively small joystick – that still requires a degree of motor skill to operate – would be suitable for manipulating the electric motors; it also frees up a few input pins (always useful) and, most importantly, provides both direction and speed control in two different axes.
The joystick works by placing two potentiometers (variable resistors) at right-angles to each other. This means that, instead of simply and up/down command (as we get with pushbuttons) the joystick generates a range of values, depending on how far it’s been pushed.
The pushbutton is only really activated when the joystick is in the centre (so you can’t, for example, push down the button and move the joystick at the same time – moving the joystick causes the button to release).
However, having a pushbutton means that we can simply cycle through each of the motors to put it under control of the joystick; this gives us the option of being able to control one, two, three or any number of motors, using the same joystick.
Time to change that PCB layout (again).
This time it’s going to be awesome!
Testing an analogue joystick and stepper motors
In theory, having an analogue joystick should mean about 500 degrees of control in each direction (since the joystick returns values 0-1023 for the x-axis and 0-1023 on the y-axis, if the centre point is 511,511 we should expect a nice range of values from one extreme to another).
In practice, getting a nice wide range on the joystick is really difficult. It has a large “dead spot” at the end of each travel, meaning the tiniest amount of movement makes the input values change by about a hundred. Just a few millimeters of movement and the joystick has “maxed out”.
With this in mind, I changed the code to change the speed of the motors over just a few discrete positions.
- Barely touch it and the motor barely moves
- Push it a little bit, and the motor turns at about 1/3 speed
- Just before maxing out the travel on the joystick, the motor is running at about 2/3 speed
- At the full limit of movement, the motor runs at full speed.
When connected up to a couple of motors, we can see how not only can the maximum speed of the motors be limited, but just by using the joystick (instead of constantly fiddling with the speed controller) we can get them to spin at faster/slower speeds
Finally getting somewhere....
While it’s fun to connect motors to microcontrollers and mess about making them spin, it’s really only when they’re actually connected to something that it makes much sense.
So far, the PCB supports a “simple” painting stand – you can rotate the top and you can angle the vertical support. In fact, during testing, it seems like this gives a really good range of angles to attack your miniature from, while painting.
I still quite fancy the idea of putting the entire thing onto a round base that can rotate, just to cover all “degrees of freedom”. Maybe that’ll come in a future development.
A friend once told me that “finished is better than perfect”. I’ve never quite understood; until it’s perfect, how do you know if it’s finished? That’s probably why I’ve a workshop full of unfinished projects, each filled with “potential to be awesome”!
But, for a “quick” weekend project, I think this is as done as it needs to be. Obviously, I’ll put together a nice enclosure, get all those nasty tangle-y (yep, that’s also a word) wires tucked away and stick a micro USB socket on the pcb (so you can run it from a phone charger, instead of requiring its own dedicated power supply).
Look out for the code and PDFs of the circuitry, PCB layout and laser-cutting files in the coming days, so you too can make your own!
Arduino code for motorised painting handle
Grab yourself an Arduino, plug in the usb port and upload this code to it.
You’ll have your own motorised painting handle up and running in no time!
In danger of scope creep
I’m still not sure about this. I quite like it. But I’m not sure it’s entirely necessary. In which case, I’m not entirely convinced it needs to stay. But, it is pretty cool!
An archway of LEDs helps reduce (note, not necessarily completely eliminate, but does reduce) shadows across the miniature.
There are two ways to further reduce shadows: increase the quantity/intensity of the LEDs (which could then become an issue if they shine directly at your face while painting) or to reduce the size of the “arch” to put the LEDs closer to the miniature.
So far we’ve got three-degrees-of-freedom (I think). There are two motors in the horizontal direction, but one of them is connected to an upright which tilts backwards and forwards (so isn’t necessarily fixed in the horizontal plane).
I might keep the third axis (though it works perfectly well with just two) I’m just not sure about the LED ring. Comments….?
Nearly the weekend.....
So, if I get a few hours in the workshop this weekend, I think it’s time to take a proper look at this. First up, it’s got to have that third motor/axis; I thought that maybe two might be sufficient, but I reckon that having an overall “master” rotation is going to be important.
That means I’ll have maxed out all the i/o lines on my microcontroller. Yet I wanted to add even more stuff.
Now, sure, I could add in shift registers and clever trickery like that, to free up some i/o pins on the Arduino, but in all honesty, this project has already taken up more time that I expected it to – and adding in extra complexity like shift registers is just going to chew into the few hours I’ve got available to work on this.
One thing I do think it needs, are sensors to give it a “home” position (from which we can move to any angle/rotation). Since we’re using stepper motors (yes, we… you are building along, aren’t you?) it means that each individual axis can be positioned, accurate to about 1mm (excluding “slop” or “backlash” in the motor gears) by simply counting the steps;
If 4,000 steps are one complete revolution, and we know that the motors will be moving from the same starting position each time, then, in theory, it should be possible to record the position of each motor as it moves – and enable the user to create a number of pre-defined positions to move to.
Now having a list of pre-defined positions and being able to select/enter a name for more (as they are saved to memory) means requiring some kind of screen and a user interface (UI). That’s going to take up more i/o pins, not fewer!
So I figured that we could ditch the joystick and use a smartphone/device for both controlling the motors and as a user interface for the creating/saving settings. That means I can talk to the motors using the (currently unused) serial pins, and connect my “home position” sensors where the joystick used to be.
I’ve already used hall effect sensors quite a lot in my interactive playing surface. They’re brilliant little sensors – physically small and can detect the presence of a magnet when placed nearby (the photo above shows how we can use the hall sensor to make an LED light up when a magnet is placed in close proximity).
I thought that we could use hall sensors and magnets affixed to the frame of the painting handle to send the microcontroller a message once a specific position has been reached.
The hall sensor on the vertical part of the frame is triggered when the magnet embedded inside the moving section passes over it. When this happens, we know that the vertical piece is at its furthest extent.
The same applies on the rotating “tabletop” that the miniature stands on – the magnet sits on the rotating part, meaning that we don’t have to worry about wires getting tangled or wrapped around the axle, no matter how many times the top spins around.
The same principle can be applied to the base – although the movement of the entire structure is restricted to just 90 degrees on the base, we can use a hall sensor in the bottom and a magnet embedded into the rotating part, to work out just where in 3D space the thing actually sits!
One week later....
It’s been over a week since the last update on this project – mainly because of real life and work commitments getting in the way, but also, partly, because I’ve been waiting for an order from China to be delivered, filled full of lovely electronics goodies.
In this parcel was a bluetooth controller, allowing me to send serial data commands to the device wirelessly. This is going to be really important. We’ll see why in a minute….
Before we can do anything clever with our bluetooth module (like hooking it up to a smartphone/tablet app) we needed to make the motorised painting handle a little more intelligent than it was.
Namely, the device didn’t know where it was in real-world space; it knew if you moved the joystick to activate some motors, but it had no concept of what those motors were driving, or why, why where the “arms” on the painting handle where at any one time.
This needs to change – because one of the things we wanted to add to our “smart, motorised painting handle” was the ability to move to pre-defined positions – which means the device needs to know where it is, before it can move to a given position.
So I changed the firmware inside the microcontroller to do two things when it very first “boots up”. The first is to move the motors until the hall sensors (that we added at the last post) trigger – once a sensor triggers, that motor stops moving. When all three motors stop moving, the device is in it’s “start position”.
The next step is to then move from the “start” position to the “home” position – i.e. from a known starting point to a desired position (in this case, straight up, with the top rotating plate facing forwards).
The video should demonstrate this in action – on reset, the device moves the motors until it sees the sensors being activated (note that some motors stop moving while others continue – this is normal). Only once all motors have come to rest does the device move to the desired position.
So far, so good.
With this in mind, it’s time to break out one of those new bluetooth modules and try controlling the painting handle from a phone…..
Pretty well done?
After adding “homing sensors” to the motorised painting handle and hacking some simple code together in Abode Animate (formerly Flash) our motorised painting handle finally comes to completion.
(yes, Unity would also be a fair cross-platform choice, but the final .apk files it creates are about twice the size of Flash-based apps)
At first I did a quick prototype in Unity3D complete with a fancy 3D model of the device, and some clever swipe/twist/rotate gestures to control it. But looking back at the original brief – to make painting more accessible to people with problems with their fine motor skills – I quickly realised that this wasn’t really appropriate.
So the interface is deliberately simple.
It has big, chunky buttons that you can prod with a stubby finger; when you press down, the motor(s) start to turn, when you lift off, they stop.
When the painting handle is in a position you’re happy with, and might want to return to again in the future, you can save the motor settings to the “bank” of slots. This gives you one-touch access to multiple pre-set, and entirely user-customisable positions – helping the user to quickly and easily get their model into position, ready for painting.
Another project ticked off.
Well, at least, complete. Well, fully working.
The last stage will be to re-create the device in acrylic (mdf is great for prototyping but just doesn’t quite have the same visual impact as laser-cut plastic), tidy up the firmware and post all the files online for you to make your own!
Controller app
Let’s take a quick look at the controller app for our motorised painting handle…
This is the main (and, let’s be honest, only) screen in the controller app. It shows a representation of the motorised painting handle, with a couple of big, easily accessible buttons to control the motors.
Press any of the large round buttons to make the device start to move. Release the button and it stops. It really is as easy as that!
Though, of course, no app would be complete without some utterly baffling settings to mess things up with….
The most important setting is the motor speed.
Given the diminutive side of the device, it’s very easy to “overshoot” your target position if you’re not totally paying attention. So you can speed up and slow down all of the motors at the same time with a single slider bar.
I found that a speed of between 20-30 gives a nice responsive action – not so fast that you end up going back-a-bit-forward-a-bit, damn, too much, back-a-bit, sod it, forward-a-bit, that’ll have to do but also not so slow that your brew goes cold while you’re waiting for it to get into position.
There’s also a home button. I know, right?
This allows you to set your “favourite” starting position. When the device boots up, all of the motors rotate to their furthest extent – but this isn’t necessarily a particularly great starting position, so when you’ve got the handle in a position you’re happy with, hitting this button makes it remember to start at this point when it first wakes up.
At any time, when you’ve got your miniature positioned into just the perfect spot for reaching into one of those tricky, hard-to-reach places, you can save the motor settings to memory.
Hit the “save” icon (on the main screen) and it brings up a pop-up window. Simply type in a meaningful name and hit the red “plus” button.
In future you can set it back to this position with just one-click….
Hit the “open file” icon on the main screen and another pop-up appears, similar to the save screen.
Instead of saving motor positions to memory, here we’re recalling them. Just click the tick button alongside the previously save position and bzzzt, bzzzt, click! Hey presto – you’re back where you left off…..