Skip to content

The Maker’s Den – Converting a box room into a home office/electronics workbench

August 29, 2014

image

The major works of our new house are still waiting for things like planning permission, and quotes from various suppliers. Oddly one issue seems to be how busy they are, since one company couldn’t even come give us a quote since they are booked solid for the next 4 months!

In anycase this leaves me still able to focus on the smaller jobs, and next on the list is the box room. Having turned one of our rooms into a study for my wife, the box room is mine. You might suggest that it is a little extravagant to have a study each, but my wife’s study is a very personal space for her, and whilst she lets me use it to work from home, she does so grudgingly ;-) Also I have a couple of specific requirements which don’t really fit well with sharing the study.

In our previous place I had a very small ‘workbench’ setup across two bed side cabinets in the corner of our guest bedroom. literally just a sheet of mdf painted white and balanced with just enough room to get a chair at it. It was just enough to prop up an oscilloscope, a soldering iron, and some boxes of components etc.
This time I have a whole box room to make my own (in addition to the garage, but that is another matter entirely) and for the sake of differentiation we’re calling it the ‘studio’. Mostly in reference to the fact that if I work from home it needs to be a good environment to take a video call from.
image

Most of the work was very similar to the study. That is, stripping wallpaper, removing the radiator to decorate behind it, several coats of white paint. a feature wall, mine is a deep purple, new laminate floor to replace the old carpet. new skirting etc. I also had to add a set of blinds as this room didn’t already have them.

The main point that things get different is the workbench. For the study we already had a desk which has done good service. For my studio I had to decide what I wanted. I looked at desk options, but ultimately decided that to serve as desk for home working and workstation for electronics etc, I would have a bench rather than a desk. Basically with no fixed feet/cupboard beneath it, I can sit the chair at any point along its length.

This decision meant that I could splash out a little on a nice solid walnut worktop, but not spend crazy amounts. The worktop is just mounted on some batons that run along the edges, and a single support near the front, this is what the support frame looks like.
image

Pretty simple construction, screwed to the walls at regular intervals, arguably the 2.2 metre span could use more support in the front centre than is provided by the basic frame, but we’ll see how it responds to use. mostly the heavy things will be near the corners/back, with only keyboard/trackball nearer the front.

Here it is with the worktop resting in place to check the fit
image

One feature is the provision of power onto the desk top without cluttering wires everywhere. For this I got myself a hole cutter as large as I could find and I cut a hole in each back corner of the workbench. Just below that point I mounted multi-way adapters. I used a hole cutter so that I could potentially use the plug to mostly refill the hole, or generally hold the wired in place.
image

Using a hole cutter on a workbench is pretty tricky. You really need to get the plunge very straight and perpendicular to the surface, and slight deviation means that the sides of the hole cutter start to rub against the sides of the hole they’re cutting. This quickly adds up to enough friction to stall the whole thing. It took me a while and several adjustments to get the cutter to plunge all the way through my worktop.

I found a decent deal on 3.5 metres of work top, which was over a metre more than I needed. So I was able to use the remainder to make a set of three shelves above the bench. This is one of those places that a bandsaw really helps. though I guess a table saw would do the job also. Stripping >1m lengths of 38mm thick walnut is not something I’d like to try with a handsaw.

Results
Here are pictures of the finished room. I’m really very happy with how it has turned out.

image

image

The walnut is finished with a few coats of Danish oil, this was pretty easy to apply, however I did have some trouble where I’d been moving the workbench around with hot sweaty hands, I should have used gloves or cloth to protect the bare wood, as it made it harder to get the oil to absorb evenly. I took better care when handling the shelves and it was much easier.

Now I just need to unpack my random collection of stuff into the room. I’m going to have to come up with some organisation solutions to try to keep things from getting very messy. I’m not a tidy person by nature.

Custom shelving

August 16, 2014

Last time I wrote about redecorating the study in our new house. I sort of claimed that this was finished at the point that we moved the desk in and it could function as a study. However, the truth of course is that a study is incomplete until the copious books can be unpacked onto shelves. In our rented house we had a few standalone bookshelves, but what is the point of owning a house if you don’t put up wall hung shelves?

Obviously it is fairly easy to buy shelf brackets and shelves and relative quick to install. However this needed to be more than just some shelves in stock sizes. My wife wanted a shelf spanning the entire back wall and coming around partially along another wall in a L shape. This pushes us into the real of custom made shelves specifically to fit an exact set of measurements.

The first decision was to go with a rail and bracket system. Last time I did wall hung shelves, I went with floor to ceiling, narrow shelves for dvds and small books, and I used individual brackets each mounted directly to the wall. 3 holes per bracket, I actually lost count of how many brackets, it was a lot. I vowed then that next time I’d just go with rails which can support brackets along their height.

So here are the rails installed and some brackets set in place

image

That part is fairly easy. we chose how far off the ground we wanted the lowest shelf, in this case dictated by the height of someone sitting on our futon which will eventually go in here (once the living room is redecorated) and then the length of each rail was dictated by how close to the ceiling we might want a top shelf.
Then you need to figure out the spacing, this is dictated by the material you intend to use for a shelf, different materials have different loading capacities and support requirements. If the supports are too far apart for the material you chose then they will sag, maybe not immediately, but with time.
Choice of materials is varied, last time I did this I used mdf, this time I decided to try something different and went with plywood. 18mm plywood has a maximum span between supports of about 60cm. I didn’t want to hit the maximum and I also wanted to have things evenly spaced across the wall.
Another factor was the L shape of the shelf, I wanted to have a support underneath the join point in the corner. My wife wanted the shelves to be 30cm deep, so I wanted a bracket around 20cm from the side wall. To make things look neat I put another at the same spacing from the opposite wall, then just divided the space between those two points into an even spacing that was less than 60cm.

The spacing on the other length actually had a slightly different considerations, where the end wall is an external brick wall, the side wall is internal and only a partition wall. For maximum strength I wanted to make sure I screwed into the studs, so I let that dictate the position of the rails. unsurprisingly the studs where similarly spaced to my requirements anyway, a little closer together.
With all that decided, it was time to measure the first rail into place, use a spirit level to get it vertical, and get it screwed in place. Once the first was up, every subsequent rail was measured relative to the previous one, getting the equivalent height using a spirit level from the base of the rail next to it.
This is important. You could mark out every rail based on the same height from the floor at each position, and achieve the same thing…right? well no, there is a very good chance the floor is not actually level over the span of the room. I could also have gone around marking out every position using my spirit level to match one marking to the next. However the thing about drilling into walls, is that things don’t always go absolutely perfectly where they should, maybe the drill wanders around a particularly hard bit, maybe you just don’t hold everything perfectly. In any case the actually fitted rail might be slightly off from the marked height, by measuring the next rail based on the actually fitted rail next to it, you constantly adapt for any slight variation. This does mean that you could wind up a little off over the span of the shelves, but never by very much in any given neighbouring pair, so everything should look ok in the end.

Hanging the rails is the easy part really, as now I needed to make shelves. My brother pointed out that it would be much much faster to just buy ready made shelves, but as I mentioned that is not going to fit exactly my space requirements. So I bought myself a few 2400×1200 sheets of 18mm plywood, and got cutting. My bandsaw is awesome, and 30cm is actually slightly deeper than it is really supposed to cut, however there is just enough room to setup a 30cm wide cut. So with help from my wife to position the sheets and support them through the cut, we quickly stripped out all the lengths we needed.
That was pretty straight forward, next though I had to use my router to cut away a section of overlap for where two shelves join at the L. Whilst this is not difficult, it is a little time consuming to set up a rail to work against to keep me routing in the correct area. By cutting this section of overlap, I could support that end of both shelf lengths on the same bracket.
Once that was done I then had to setup the shelves in their L shape in the garage so that I could round over the shelf edge and in particular around the inside corner where the shelves meet. This was not too bad, if a little precariously setup on anything I could grab to support the shelves. When repeated 4 time for each L shelf pair this all took a couple of days to work through. Though obviously I wasn’t exactly going at it full time.
image

image

At this point things look pretty good, all the shelves fit in place, and could almost be finished. If you didn’t mind the bare plywood look, you could load up the shelves and call it a day.
However, in my case the shelves were to be painted satinwood white. This means, at least one coat of primer, and at least one coat of satinwood. I got some nice stuff so that is all that was required, however it could easily have required multiple coats of each. Painting the shelves took perhaps 5-10 minutes per side per shelf per coat. The elapsed time of this effort is much higher than the spent time. You can only do one side of a shelf at once, allowing that coat to dry enough before you turn the shelf over to paint the other side. In the case of the satinwood coat, it has a drying time of 16 hours! With limited space to lay out shelves for painting I couldn’t do them all at once either. All in all a week or so of evenings and a couple of weekends was required to make my way through all the painting.
In addition I had issues with the supposedly furniture grade plywood from Wickes. Namely small voids in some of the layers. Good quality plywood is not supposed to have any. But this did, so along the cut edges there were little gaps and holes. Not too many, but enough that I needed to use some wood filler to fill them in. Sand it all down and paint over.
image

image

image

And finally they are done. Making your own shelves is a lot of work, it takes a long time. It is worth it. As with all such endeavours I get no small satisfaction from the knowledge that I built something essentially from scratch. That I know every mm of it, for better or worse, from my own attempt to make it as well as I can. Plus of course it is exactly to specification. My wife got to pick exactly how deep she wanted the shelves, precisely where on the wall they should finish, what kind of radius on the end corner, how chamfered to make the edges, how high and how far apart.

And finally, the study looks the part with full shelves :-)
image

Redecorating the study

August 2, 2014

Having recently moved, I’m back to the wonderful world of having lots of DIY to be getting on with. So much that is is hard to chose where to start!
Ultimately our decision was to get my wife’s study sorted first. She works from home one day per week, so it is helpful to have it finished for her. Also it was one of the relatively unchallenging rooms, no major works, wall removals etc. Just a medium sized room to be completely redecorated.

Foolishly I forgot to take pictures of the room before I started, it had wallpaper with a repeating pattern of dots. a thick red carpet, some old scrapy shelves. that needed to be removed, and a fairly dated and yellowing light fitting.

We decided to strip the wallpaper off,  which sadly was hung behind the radiator, so I had to take the radiator off also. That wasn’t so bad, except that there was a thermostatic valve on it which requires you to swap it out for a shut-off cap to be sure the valve is shut. These caps are provided with the thermostatic valve kits, however of course this is an old house and I did not fit the valve, so I did not have the cap. I did some searching to see if I could buy one on its own, but ultimately bought a cheap thermostatic valve kit just to get the shut off cap it came with.

Stripping wallpaper is a fairly horrible job. Even if it goes smoothly it is messy. but this room made me work for practically every inch of paper coming off. One wall was fairly amenable ot just peeling off, but the rest required me to scrub with a wire brush, and soak with a wall paper stripping solution, then scrape off in ribbons. It took me about 4 days to completely strip the room.
image

That was the hardest part, really, lifting the carpet was trivial enough, though it had been glued around the edges. My wife wanted laminate flooring down, so I made the decision to rip off the skirting board and replace it on top of the flooring. The exisitng skirting had been nailed to the walls with long masonry nails. This made life a little difficult getting it off, particularly behind the radiator pipes. Here I used my brand new bosh oscillating multi-tool to easily slice through the skirting just behind the pipes and allow me to pry it off in sections.
image

We gave the bare plaster 1 very diluted base coat, and about 3 other coats of basic white emulsion, followed by 2 coats of an extra reflective white paint top coat, except for the feature wall, which is a bold orange. It looks really good in the otherwise white room.
image

I replaced the light fitting with something a little more modern, always an interesting job, particularly when the instructions say ‘you will need an assistant’… pah! you just need something that can support the light fitting near the ceiling whilst you are wiring things in. I used one of the (plentiful) cardboard boxes in our house and balanced that on the step ladder to support the fitting. It worked fine.

The laminate floor went down pretty fast, it took most of a Sunday, but I got the whole floor down, and the new skirting fitted. I decided to use pre-finished skirting which really does save a lot of time and hasstle. That last day was pretty great, since the room goes from looking like a shell, to looking pretty finished very quickly. We moved the desk back in and I called that essentially ‘done’ for the decorating.
image

image

However, I know it isn’t really done until the shelving is up, and my wife wanted to go with wall hung shelves rather than the free-standing units she had when we were renting. So that work has just begin, brackets are up, but now I need to actually make the shelves to fit…

All in all its been a lot of hard work, but in truth I love it. It’s great to be back in a house which I own which I can improve as I see fit and change to meet our exact needs.

Total cost so far…~700GBP though in that I’m including some costs which have leftovers that will go into the next room (my study)

New House – new workshop

July 7, 2014

I’ve been a little quiet on the blog for a little while, because we’ve been in the process of moving house. Lots of packing and worrying about logistics etc.
Of course the biggest question mark was the moving of the workshop!

image

View from our new bedroom

Well now we’re finally in. The new house is amazing, and we’ve had a super sunny first week to really enjoy the new area we’re living in. One of the attractions of the house is that actually it needs redecorating throughout, so we still have boxes everywhere and a daunting task ahead to figure out what to do first and what exactly it is we want to do in every room.

The process of moving was, as always, massively frustrating and fraught with stress. Every time I go through it I wind up feeling two things strongly.
1) I’m never going to move again.
2) The whole industry of estate agents and solicitors is ripe to be completely revolutionised and swept away with maybe one big player intent to make it a modern process.

The first is fairly simple, and I really do not have any intention of moving again at this point. This house is perfect, and it was good enough for the previous owners to live in for 30 years, I consider that a challenge and am aiming to beat their high score.

The second always fades as I realise that I’m not planning on moving again. which I guess is what everyone does which is why it is still a horrific experience to try buying a house and why solicitors and estate agents get to operate as if the internet age essentially hasn’t happened.
There is really no excuse as to why initial introduction with solicitor doesn’t involve agreeing on a secure online form of communication which subsequently allows you to authorise all documents electronically. no need to post bits of dead tree around with ‘wet ink’ on them. Right there you could wipe a few weeks off the process.

If you are in any way inclined in the space of solicitors/conveyancing I really think the market is wide open for you to totally dominate the house moving market. I wish someone would, but that someone will not be me.

I am now just really happy to know I no longer have to deal with estate agents, with the small exception of recovering what I can of my deposit on the rental we moved out of. I sold off the house I was renting a while ago, but now I live in my own house again I really feel the full force of no more random calls with urgent repairs required by my tenant, and no more having to go through a lazy, inefficient estate agency to get anything fixed in my own property.

Just as moving out the workshop was a big consideration, now that we’re in, a big consideration is that I am once again faced with the chance to design my workshop layout. Last time I had restrictions of not bolting anything to the walls, since I was only renting. This time I can hopefully give myself much more decent bench space. Also last time I decided to put my lathe in the middle of the space, I felt previously I’d been a little restricted having it bolted to a wall particularly trying to hollow items. The swing of the tool would clash with the wall. However I think I really just need to give it a little more space out from the wall, it doesn’t need to be in the middle taking up more space. Of course this time around I know that I want to rebuild my cnc machine, so I will have to allot space in the plan for that. And  consider if I’m going to aim for a slightly larger build for this iteration.
image

There is so much to do in the workshop that I need to remember that first there are other priorities in the house itself. There may come a point of chicken and egg, there are good reasons to get some of the rooms in the house done first, however doing them will require tools which are currently buried in boxes in the garage, so may necessitate a certain amount of workshop sorting to get at them.

So, where to start? we have walls to strip of wallpaper, carpet to rip up and replace with various flooring, bathrooms to replace, a window we’d like to turn into a door,  a kitchen to replace, a fireplace to remodel, a workshop to set up…
Any tips or tricks I should consider? pitfalls to look out for? let me know!

Pan and tilt webcam – face tracking

May 10, 2014

So last week I wrote about building a pan and tilt webcam, and at the end of that I mentioned that the next thing was to come up with some kind of software control on the pc to allow it to be easily moved around.
This is a little google auto-awesome montage of how well things went

Software – processing.org
I wound up checking out processing.org after watching a video from SVSeeker that showed them using the same to control their in-development under water ROV.

I was very impressed by how easy everything was to pull together, over the course of perhaps 3 hours I achieved everything I set out to do.
I downloaded the processing.org environment and started to play.

First thing was to alter the interaction to the arduino based on some examples of a state machine interaction to select options. so you can just send a string of numbers divided by slashes, so for instance /3/2/9/170/, is interpreted as 3rd top level option (servo control), 2nd control within servo control, (write a value), use pin 9, set value 170. This immediately made things more flexible.

Capturing video from webcam

Second job was to get the camera feed from the webcam, this was straight forward with the video library, just get a list of connected webcams as an array, not that within this is an enumeration of the various resolutions and frame rates supported by each camera. For me I gout about 40 options, 20 for the webcam on the laptop I was using, and 20 for the external webcam mounted to my pan/tilt. I did think about putting a picker in to allow dynamic selection, but to get going I just hard coded the number of the one I wanted to use.

void setup(){
    String[] cameras = Capture.list();
    if (cameras.length == 0) {
        println("There are no cameras available for capture.");
        exit();
    } else {
        println("Available cameras:");
        for (int i = 0; i < cameras.length; i++) {
            println(i + ":" +cameras[i]);
        }
        // For the moment hardcoded to the one I know I want
        cam = new Capture(this, cameras[21]);
        cam.start();
    }
}

void draw() {
    boolean faceDetect=false;
    background(0);  // background black
    if (cam.available() == true) {
        cam.read();
    }
    image(cam, 0, 0);
}

Manual control

Next job was to put some controls on the screen, I found the ControlP5 library that provided a bunch of simple controls, each one you can just add specifying the name of the control, the range of values it should control and the deafult you want it to start at. Along with simple x,y and width,height values for placing the control.
Once added controls being moved triggers events to a handler method, just look up the name of the control in the event name and act accordingly.

tilt = controlP5.addSlider("Tilt",tiltMin,tiltMax,60,10,10,10,400);
pan= controlP5.addSlider("Pan",panMin,panMax,90,50,10,400,10);

So in a jiffy I had two sliders, one for the tilt control up the left side of the screen and one for the pan across the top. a little wiring up and now I can click around the controls on the screen and move my pan and tilt. Hurrah!

void controlEvent(ControlEvent theEvent) {
    if(theEvent.isController()) {
        if(theEvent.controller().name()=="Tilt") {
            tiltValue=round(theEvent.controller().value());
            myPort.write("/3/2/9/"+tiltValue+"/");
        }
        if(theEvent.controller().name()=="Pan") {
            panValue = round(theEvent.controller().value());
            myPort.write("/3/2/10/"+panValue+"/");
        }
    }
}

At this point I had basically done what I really though I was going to do and it had taken very little time. So I started to get creative with other features I could add.

Auto Pan

First thought was that it would be cool to have an auto-pan mode where it will just sweep back and forth based on some value to set how quickly it should do so. I decided to set it as another slider which sets how many seconds between individual increments of turn, so the fastest it will turn is one increment every 1 second, and the slowest would be really slow, 1 increment every 5 minutes. To control this I added a toggle button, and another slider to set the value. I considered here using an input box to allow any number to be set, but I quite like the interaction being entirely mouse driven with no keyboard input. plus no need to validate inputs etc.

if (autopan){
    //check when last move made
    if (millis() > lastMove+(moveDelay*1000)){
        lastMove=millis();
        println("Auto-move step");
        if(autoMoveLeft){
            panValue=panValue-1;
            if (panValue160){
                panValue=160;
                autoMoveLeft=true;
            }
        }
    //this line triggers the event handler which in turn writes to the arduino
    pan.setValue(panValue);
    }
}

To make this work I just keep track of when I last moved, and every time through the draw loop check the amount of time passed since that last movement, once I go over the set value I move again and set that as the last movement point. There is a little extra complexity which is which direction you’re travelling. I decided to keep it simple, always start out panning left, then when you get to the max value, flip a direction boolean and start heading right, until you hit the min value, flip again and repeat forever.

This worked nicely and immediately led to the obvious next option… take time lapse images. This is another set of controls very similar to the auto-pan. I want a value to set how often to take a picture, and a toggle to switch that mode on and off.

Timelapse

From an implementation point of view it turns out to be very simple to get a frame of the video as an image. There is even a mode that will auto-increment filenames for you, however I found it was using some internal frame counter such that whilst the filenames did increment in order, they were not sequential numbers. This caused problems for the app I downloaded to stitch images together into a little video so I decided to just keep track of my own frame counter. Plus a little logic to handle creating different folders every time you switch the mode on so they don’t overwrite each other.

if (timelapse){
    if (millis() > lastCapture+captureDelay*1000){
        lastCapture=millis();
        //
        //take picture to be stitched later
        //
        saveFrame("C:\\Users\\d.would\\Videos\\timelapses\\timelapse"+timelapseCount+"\\timelapse-"+frame+".png");
        frame++;
    }
}

Again so simple that I realised I still had plenty of time to carry on and this is when I got ambitious…face tracking.

Face detection

I’ve seen this kind of thing on youtube so it is hardly novel, however it is pretty freakin’ cool so I guess it was inevitable to try it. Going in I had no idea how hard it might be handling face tracking, and O.M.G. this stuff is so easy now as to be ridiculous.

Library – opencv. this library existed and was easily available to download from within the processing.org interface. Import the library, create the object and tell it you want the face identification mode (it seems like it has a few options for doing thinigs like filtering out moving objects from an otherwise stationary scene) Then just pass it frames from your video feed. In return it passes back an array of detected face objects. Its empty if it can’t find any.
For each face in the array you basically get given the bounding box within which the face exists. So x,y of the top left corner and width,height.
By iterating through the array looking for the ‘widest’ face you get a proxy for the closest face.

if (cam.available() == true) {
    cam.read();
    opencv.loadImage(cam);
}
Rectangle[] faces = opencv.detect();
int closestFace=0;
int widestFace=0;
faceRectX=0;
faceRectY=0;
faceRectW=0;
faceRectH=0;//use width as proxy for closeness, pick the one which is widest and follow it.
for (int i = 0; i  widestFace){
        closestFace=i;
        widestFace=faces[i].width;
    }
}

if(faces.length >=closestFace+1){
    faceRectX=faces[closestFace].x;
    faceRectY=faces[closestFace].y;
    faceRectW=faces[closestFace].width;
    faceRectH=faces[closestFace].height;
}
//draw frame from webcam
image(cam, 0, 0);
//draw rectangle at co-ordinates for face
noFill();
stroke(0, 255, 0);
strokeWeight(3);
rect(faceRectX, faceRectY, faceRectW, faceRectH);

So that was impossibly straight forwards, by using those values to draw a rectangle you can visually see on the screen where it has recognised faces.
That alone is crazily cool, when you think about what must be involved in detecting faces from an image.

Face Tracking

But once I have this information turning it into tracking controls is pretty easy. Basically I want to put the face in roughly the middle of the the screen. So I figure out the middle of the bounding box of the ‘closest’ face, then determine how far off centre on the x and y planes that is.
Anything outside of about 20 pixels of centre and I send a command to the arduino to pan or tilt in the appropriate direction to shift the face closer to centre.

if (faceTracking){
    int xpos = faces[closestFace].x + (faces[closestFace].width/2);
    int ypos = faces[closestFace].y + (faces[closestFace].height/2);
    if (xpos<(width/2) -10){
        //move camera slightly left
        if (panValue(width/2)+10){
        if (panValue>panMin){
            panValue--;
        }
    }
    if (ypos<(height/2) -20){
        if (tiltValue(height/2) +20){
        if (tiltValue>tiltMin){
            tiltValue--;
        }
    }
    pan.setValue(panValue);
    tilt.setValue(tiltValue);
}

There is something pretty compelling about building a device that reacts to you in the environment, moving to follow you. This is already very cool, but what I found was that it is fairly slow to keep up, and easy to move a little too fast for it. To remedy this I needed to scale the movement reaction based on how far off centre the face is. the farther from centre, the larger the movement it sends to the arduino. Close to centre yields single steps of corrective movement. right near the edge of video and it moves the camera in larger steps. This meant that the camera could do a better job of keeping up, though it is still fairly easy to outpace it.

Optimising performance

So this is all working great, however I realised that face detection was slowing things down a lot, I knocked up a quick FPS counter and sure enough doing detection on every frame drops the frame rate to about 4 frames per second. Which is pretty terrible considering the camera is producing 30fps.
So I played around with doing face detection on different fractions of the frame rate, it turns out that actually just doing it on alternate frames is enough to make a big difference, I got right back up to 20-25fps, and the face detection handling 10-14 updates per second, which is a lot better than the 4 I was getting trying to do it every frame.

Summary

This was crazily easy. from never having used processing.org or its libraries before, to a full interactive UI with manual controls and auto-pan, timelapse and face tracking modes in about 3 hours.

Now to set it up to take some interesting long duration panning time-lapses. I’ll have to think of suitable places to set it up, possibly in the workshop whilst I’m making other things.

Pan and Tilt webcam mount – arduino powered

April 27, 2014

A long time ago I built a little pan and tilt mount from some scavenged electronics (a stepper motor from a printer and a worm drive from a cd player) I connected it via a parallel port and used darlington arrays and direct pin out of the parallel port to control the whole thing from some script language, I forget which.
It was a little unreliable and fairly cumbersome but it got the job done, I used it to watch what my cats were up to whilst I was out at work. At some point I got tired of the very bulky and rubbish looking thing sat in the living room and it got decommissioned.

Spin on a few years and I have a few arduino’s laying around, and a higher budget to buy parts. So I decided to revive the pan and tilt camera mount using servos and an arduino to control things. I’m still going to need a pc application to talk to the arduino, but it handles the servo logic and the PWM stuff.

When I looked on line a lot of what shows up is very basic servos stuck to each other and a webcam stuck on the end. This works but looks a little rough and possibly not that robust. So I decided to go with something a little more ‘constructed’. It is probably overkill for just a camera but it could potentially serve for other purposes in the future.

image

Mechanical:

The design of the pan is around the use of a lazy susan bearing, this is where all the weight is supported, so in theory I could have quite a heavy load on top and the servo just needs to overcome rotational friction, it doesn’t also need to support the weight.  To make this work, I have a base board that attaches to the bottom of the lazy susan bearing, and centred within that I screwed one of the standard servo attachments, then just dropped the servo onto it. This then let me figure out the location to cut a hole to fit the servo body into for the board connected to the top of the bearing.
After a certain amount of drilling and chiselling I cut out a recess that snugly fit around the servo body, so that there is no weight pressing down on the servo, but in order for it to twist, it is twisting the whole top board.

image

With that base in place I could mount whatever I like on top, in this case I wanted a tilt mechanism. The basic idea is that you have a platform that can tilt back and forth, onto which I could mount a camera (or whatever else I wanted). The platform has a centre of axis around which it is going to rotate, on one side there will be the servo, on the other a free spinning axel of some kind to just support the weight. I used a bearing mounted into the side of the platform, and a wooden peg that fit on the inside of the bearing which was just stuck into a support strut. This allowed the platform to spin on the bearing supported by the peg. On the other side then I just needed a block to mount the servo into which brought its centre in line with my desired centre of rotation.

image

And that’s about it from a mechanical perspective. It is quite chunky by comparison to an off the shelf pan/tilt camera. I’m not sure what future purposes I might come up with, but it should be able to take a considerable amount of weight and still be able to pan at least.

Electronics:

As I mentioned the electronics comes in the form of an arduino. In theory this is very simple, but I had a couple of false starts. The important thing to realise is that whilst you can very easily get the initial sense of success by just wiring up the servo to the arduino for power and signals, this WILL NOT WORK. I know, you’ve done it, and it seems like it is working, but this is an illusion. It is unreliable to the point of being worthless. Servos draw a lot of power, I’ve seen indication that they can draw up to 1A each. depending on what they’re doing. The arduino is not able to provide that kind of power. The path I went down I wired everything up away from the mechanical setup, and everything worked! because the servos had absolutely no LOAD to move. so they drew relatively little power. I was also driving them only one at a time. But the second I had things inside the mechanical build, you’d get one movement, and the arduino would crash. If you were lucky on a small movement, maybe it wouldn’t, but basically everytime you try to do anything it crashes. So what is required is an external power supply to provide the power needed.

image

image

My second false start was in assuming I could plug that power supply into the arduino board via that convenient plug socket designed for the purpose. I bought myself a 9V 2.2A supplied and plugged it in. But this yielded the same crashing results. It turns out that the arduino power regulator simply isn’t rated to allow that much power draw through it even if the supply can provide it. So I needed to wire the power supply independently straight to the servos. And just bridge the GND line into the arduino. That bit is important as without the same reference ground level the servos won’t recognise the PWM signals coming from the arduino.

Once I had done this though, I was in business. I made myself a nice little ‘breakout’ board that just plugs down into the arduino to grab the signal pins I was using and the ground line, with some extra pins just to make the board somewhat stable when connected. This let me run the servo lines fairly neatly, and screw the whole assembly to the back of the platform. Whilst this is arguably still very scrappy compared to a commercial unit, it is leaps and bounds more slick than my previous attempt.

Control

Right now, control is via the arduino software serial console, where I sent it a pair of numbers to represent the position for the servos. The program running on the arduino scales whatever I give it to sit inside the range of valid movements for the servo. And actually in the tilt case it is more restrictive as mechanically it would crash into things if it moved the full range the servo is capable of.

I do want to play with making some kind of web interface to it that will both show the video feed from the webcam, but also provide controls to pan/tilt.
Not sure exactly how I’ll approach that yet, maybe see if there is some off-the-shelf software option that I can hook up. I seem to recall using something on linux when I made my first attempt. But I might use it as an opportunity to learn something new, maybe play with some ruby? I could just make a desktop app, but I think it will be more useful as a webapp.

Ultimately I was thinking of leaving it in the office as a little team camera that people can always check in on if they’re working away from the office and get a sense of who is around.

Improvised tripod and light box

April 17, 2014

I am often taking photos of projects that I’ve made, be it projects on my CNC router, or hand made using other more every day tools. Mostly the purpose of the photos is to use here on this blog or other places where I share progress etc.
Something I’ve noticed more and more is that the quality of photos is pretty variable for me, and other makers do a really nice job of taking great photos of their projects.
Recently I was taking pictures of a little wooden watch stand I made for my bedside cabinet, and only noticed after posting that a couple of the images were a little blurry and generally the images are a bit meh.
image

image

I feel like I’ve been at this blogging game long enough to feel I should have a better setup for taking photos/video of what I’m doing so I decided it was time to take action.

From doing a little reading the two basic tools I should have to take nicer photos of my creations are a tripod for my camera of choice and a light box to allow diffuse lighting of the subject.

Now it should be noted that the photo’s in this blog post mostly don’t benefit from either of these since I’m taking pictures of them, not with them.

The theory of the two items is pretty simple. a Tripod holds the camera steady, no more trying to brace my arms against something, in an attempt to keep things steady. A light box allows for good lighting of the subject but without hard direct light casting shadows all over the place.

The first thing I started with was a tri-pod. Now I could have made life easy for myself and bought one, or even just used my wife’s. However there is one point I’m being stubborn about. I take pictures with my phone. It is not the greatest camera in the world in terms of quality. However it is the camera that I always have with me, and always make sure is charged. It is also the camera that automatically backs up my photos to the cloud (in this case google+) and make it easy to share them. And even do some amount of editing on the phone.
This is important to me, since I don’t have to mess around with downloading pictures from a camera to my laptop, then uploading from my laptop to somewhere.
However this does make life awkward. a normal camera would just have a screw thread already in it for a tripod. But with my phone I had to devise a holder for it that would hold it firmly but also make it easy to get the phone in and out.

I *could* have just made a mount and have it attach to a standard tripod. However it turns out that standard tripods use an imperial thread, and its not so easy for me to pick up anything that isn’t a standard metric thread. So I decided that I’d just make the whole thing…

A tripod is a fairly simple thing. a collection of m6 bolts with wing nuts, a little time on the bandsaw and some holes drilled on the pillar drill and presto.
The only real measurements I made in the construction was to get the 120degree spacing for the 3 legs around the central circle.
image

Everything else I just did by eye for what looked about right. Mostly I was just working inside the scrap of cherry wood that I pulled off the pile to work with.
image

image

The tricky part was the ‘cage’ for the phone. I have a hard aluminium case for my nexus 4 which I stopped using because it degraded the signal and bluetooth performance. However it is perfect for this usage, I could build a structure that the case slides in and out of and then know I just need to drop the phone into the case and everything would fit nicely.

In this case I went with a ‘spine’ of wood that supports the buttom of the case, into which I cut a recess for the cases hinge to fit into. Then at either end I glued verticals that just hold the front and back of the case at each end. The spine piece was cut to the same width as the case, so everything just fits. The only tweaking required was to cut some recesses for the little dimpled feet of the case to fit into. This just made the whole fit more snug.
The only problem is that the contact area for the glue is not very large, I don’t think this would survive any real lateral stresses, however in normal usage it should not experience any real lateral force so hopefully it will be ok.

The spine of the phone cage just slots into the top part of the pivot mechanism and it holds pretty tight without any need for glue. With the phone in place it is easily able to hold it firmly in place and doesn’t suffer any wobble. To be on the safe side I have my phone camera configured on a 1 second delay, so if it does flex at all when I touch the phone to take a picture, it has time to settle before it actually takes an image.

image

image

For the light box the idea was to use a cardboard box, drape some a3 paper from the back to provide my backdrop with smooth curve to avoid any sharp corners/shadows in the backdrop. Then to cut holes in the sides and the top, line with tissue paper to diffuse light, then just set lamps around the edges to illuminate.
I thought the trickiest part here would be sourcing some plain white tissue paper. I wasn’t really sure where I would find that supplied it, but as it turns out the answer is W.H.Smiths, which had white tissue paper in pretty much the first place I looked.
With a box, some regular white paper, some white tissue paper and some cellotape. I set to work and quickly constructed a little light box.

Here are the resulting images. I didn’t really have any good lamps to provide light sources, so I relied on a little post-editing on my phone to get the final result. But all in all when compared to the original set of pictures I took of the same item I am pleased with the results.

image

image

image

Follow

Get every new post delivered to your Inbox.

Join 100 other followers