Thought for the Dazed

I've had to give up that Distance Learning course as I was having trouble seeing the teacher.

Flickr
www.flickr.com
RobMiles' items Go to RobMiles' photostream
Twitter
C# Yellow Book

Search entire site
Thursday
Mar212013

Just the Wrong Size

IMG_6046.jpg

So today I had a go at printing out my designs. Above you can see the result. And I’d made a mistake that I’ve made before. I made the holes exactly the same size as the things intended to fit into them.

Do. Not. Do. This.

Of course they don’t fit. One thing just sits on top of the other looking exactly the same. Wah. I did think I could solve the problem by filing a bit off. Not a win.Turns out that PLA is actually quite tough stuff. After about ten fruitless minutes and quite a bit of pain (who knew you could get splinters from plastic things) I gave up and went back to the software. The good news is that I just have to tweak a couple of values and rebuild everything. I’ve even added a feature where objects can cut holes in the entire finished piece, so that the SD card and the screen can cut slots for themselves.

Ongoing.

Wednesday
Mar202013

Making Boxes with Software

BaseDesign

This is the base design I came up with. You can also see one of the Gadgeteer part designs where it will be fitted in the finished product.

I’ve been designing a box for the “Door of Mystery” Gadgeteer device that I built for the Red Nose Day event. But I’m very lazy. I don’t want to have to lay out the various elements by hand and position them individually. I want this to happen automatically. So I’ve wanted to write a program to do this. Peter likes OpenSCAD, so I went there first.  OpenSCAD lets you create 3D images programmatically. It is really easy to use, and you can preview your designs very quickly.

module panel(width, height, x, y)
{
    translate([x,y,0])
    {
         cube(size=[width, height, baseDepth]);
    }
}

I used this tiny snippet of OpenSCAD to place a panel on the drawing surface. I move the axis to the position of the panel and then create a box of the required size. You can perform unions to merge things together and differences to cut one shape from another. In no time at all I was programmatically creating bases for the Gadgeteer devices. And then I hit a brick wall. What I really wanted to do was have the program work out where each device goes in relation to the other ones and lay out the box contents.To do that my program has to keep track of where things have been put. This means that I need some variables.

OpenSCAD does not provide variables as such. It provides constants (such as baseDepth above) but these are evaluated at compile time, and so I can’t use them to keep track of things as the program runs. This is not necessarily a criticism of OpenSCAD, it isn’t really meant to run programs, but it does mean I can’t use it.

So I went back to my old friend FreeCAD. I first used this ages ago, when I made the case for my Tweet Printer. FreeCAD can be controlled by Python programs and I’ve always fancied learning a bit of Python, so of I went. The designer has a Python console into which you can paste and run lumps of code. You can also add libraries and user interfaces on top, but I was happy to cut and paste for now. All the actions you take in the designer are exposed as Python calls via the console, which makes it quite easy to figure out how to do things. You just do it in the designer and then look at what comes out on the console. There is also an API reference which tells you how the commands work.

def makeBoard(self,x,y):
    b = Part.makeBox(self.width,self.height, 5, Base.Vector(x,y,0))
    return b

This method is a member of my “Filler” class which places the filler (which has a width and a height) at a particular place on the design. Note that the filler is 5mm thick in the above code. The program can take the object that is returned and fuse or cut it with other shapes as you build up the finished design. By the end of all my fiddling I’ve got a class hierarchy of Gadgeteer device specifications and a layout engine that will place them in a box of a particular size.

def MakeTop():
    doc=FreeCAD.newDocument()
    f1 = Filler("Filler", 5,25)
    f2 = Filler("Filler", 6.5,25)
    f3 = Filler("Filler", 6.5,20)
    rfid = RFIDReader("rfid", "landscape")
    camera = Camera("camera", "landscape")
    display = DisplayT35("display", "portrait")    
    topComponents = [rfid,f1,camera,f2,display,f3]
    test = Layout(91,121,topComponents)
    board = test.layout()
    Part.show(board)
    Gui.SendMsgToActiveView("ViewFit")
    Gui.activeDocument().activeView().viewAxometric()

The MakeTop method creates the top of the box which contains an RFID reader, a touch display and a camera. These are laid out in an area with a dimension of 91x121 mm. Each component can be either “landscape” or “portrait” orientation and you can create filler elements to push things around in their row. The design method is given a list of components and an output area. The finished design looks like this:

TopDesign

These elements cut extra holes for themselves so that they show through the front of the box. The layout method also creates the sides and puts fixing holes in them, so that I can join the top and the bottom together. If I want different size of panel thicknesses I just change the static members that control these values and run the method again. If I want to make a different design I just create a new method which contains the devices that want.

The system is not completely automatic, what I end up doing is fiddling with the output from the method and then changing the orientation and adding fillers until I get what I want. The good news though is that it provides a really quick way of making Gadgeteer boxes. I’m going to have a go at printing the designs later in the week.

I find it fascinating that I’m now writing programs where the output is a physical artefact. We do live in interesting times.

Tuesday
Mar192013

New Kinect SDK now out

image

The new SDK for the Kinect sensor is now available for free download. This brings with it a whole ton of upgrades for those who want to make their computers more aware of their surroundings. There are new sensor modes and all kinds of good stuff. There is also a sizeable gallery of sample programs which you can just play with. This makes it worth a look even if you don’t intend to write any programs for the sensor, but just want to get a feel for the kinds of wonderful things it can do.

The highlight, which I’m really looking forward to playing with, is “Kinect Fusion”. This lets you use the sensor as  kind of hand held 3D scanner. You wave the Kinect around a scene and the program will build up a 3D model of what is in front of it. You’ll need a fairly beefy graphics card in your PC to make it work quickly (it uses the power of the GPU to crunch the scene data), but the results look really impressive. I’m really looking forward to printing little plastic models of me that I can give as Christmas presents…

You can download the SDK from here.

Monday
Mar182013

TechDays 2013 Sessions Now Online

image

If you want to see a proper Gadgeteer session, not in rhyme, but with working demos and a lot more detail, then you can get hold of my TechDays session on gadget development by clicking on the above image. If you want to see all my Channel 9 sessions (including the ones on Windows Phone Agents and Windows Phone Speech) you can find them here:

http://channel9.msdn.com/Events/Speakers/Rob-Miles

Sunday
Mar172013

Red Nose Day Lecture now online

image

I’ve lovingly rendered the entire lecture, along with slides, into a 28 minute or so action packed video which is packed with action. You can find it above. Thanks again to everyone who came along. To Simon and Peter for taking the videos and Amanda for collecting money. I’d also like to thank the lovely folks at Gadgeteer (particularly Scarlet and Clare) for sending me such a wonderful prize. If you want to do something with Gadgeteer (and you really should) you can find out more about the platform here:

http://www.netmf.com/gadgeteer/

Oh, and there have been some mutterings about the fact that I did manage to raise a thousand pounds but did not perform the lecture wearing a tutu. Turns out that I passed the target last night (Saturday) and the lecture was on the day before (Friday). So this means that there was (and is) no need for any kind of tutu sporting.

And anyway, I think the audience had a lucky escape. The ever-helpful Simon Grey prepared an artist’s impression of what I would look like:

image

..although I don’t think my arms are quite as muscular as the ones above.