Adventures with the wrong lenses

I really should have pushed the bricks together before taking the picture

There is a lot of fun to be had in photography putting lenses from old cameras on the front of newer ones. The picture above was taken with an old Mamiya lens that was, through the magic of adapters, connected to a more modern digital camera. I’m especially impressed with the way the colours have been rendered and how the background is out of focus in a very pleasing way.

Sigma DP1S

An unconventional angle on the deep

I’ve got into the habit of taking old cameras out for a walk. Today it was the turn of the Sigma DP1S that I bought around 10 years ago. This camera is interesting because it has a sensor which reads all three primary colours at the same positions. The Red, Green and Blue detectors are stacked on top of each other. This should improve the way that colours are rendered. I took the camera around the Deep, a lovely place to be.

This is a more conventional view of the deep

Hull Tidal Barrier

The camera doesn’t have the low light or focusing performance of even a cheap smartphone from today, but I do rather like the pictures.

The Bluetooth Chord Keyboard Lives

I want to use this keyboard with my left hand and move the mouse with my right…..

The last few days have been fun. I’ve been creating the software for the PICO Bluetooth Chord keyboard, otherwise known as “Blue-Chords”. I’ve been batting with CMake (which I’ve never previously had to tangle with much). It turns out to be a bit fiddly. I mentioned it to number one son and he was able to build a free-standing version of the example code which was terribly helpful.

Anyhoo, today I dropped the chord reading code into the software and I now have a working chord keyboard which can talk over Bluetooth. Next stop is to build the case….

Lovely OLED driver for the PICO

It can say other words as well…..

I spent a chunk of the day trying to get the OLED display working on the keyboard I’m building. It works fine under Python, but it was a bit reluctant to work under C++. In the end I found this lovely OLED library: https://github.com/daschr/pico-ssd1306 It's very lightweight and easy to configure and use. It worked a treat. The display that I’m using is the monochrome version and it looks really, really good.

Extracting footprint information from KiCAD

The source design I was working from

Sometimes being lazy is really hard work. I’ve got the PCB design for the Bluetooth Chord keyboard and I want to extract the key positions for the case. I’ve discovered the really useful KiCadSetupUp plugin for FreeCad CAD that lets me import my PCB as an object in drawing, but what I really want to do is get the positions of keys on the PCB so that I can cut holes in the case in exactly the right positions.

I could spend five minutes copying the values from the KiCad PCB design. But I’m lazy. I’d much rather spend most of a day discovering how I can run Python code inside KiCad and write a program that does it for me. There is a bit of method in my madness, in that if the design of the PCB changes (I’m going to have to move the keys a little bit to stop the keycaps from clashing) I just have to run my program again. There’s probably some kind of integrated manufacturing trick that lets you automagically import this kind of information into FreeCAD but I’m really too lazy to learn how that works. Instead I wrote this little program:

file = "C:\\Users\\rsmil\\pcbs\\keyboard\\flippedkeyboard.kicad_pcb"

board = pcbnew.LoadBoard(file)

o = board.GetOrigin()
x = o.x / 1000000.0
y = o.y / 1000000.0

l = []

for f in board.GetFootprints():
    b = f.GetBoundingBox()
    ref = f.GetReference()
    p = f.GetPosition()
    px = (p[0] / 1000000.0)-x
    py = (p[1] / 1000000.0)-y
    height = b.GetHeight() / 1000000.0
    width = b.GetWidth() / 1000000.0
    print(ref)
    t = '    makeKey("{0}",{1:.2f},{2:.2f},{3:.2f},{3:.2f})'.format(ref,px,py,height,width)
    l.append(t)

l.sort()
for t in l:
    print(t)

It prints out a function call for each footprint. This is what I get from my design:

makeKey("Control_1",100.07,21.29,17.38,17.38)
makeKey("Control_2",100.07,38.43,17.38,17.38)
makeKey("Control_3",100.07,55.58,17.38,17.38)
makeKey("Control_4",100.07,72.72,17.38,17.38)
makeKey("Control_5",100.07,89.87,17.38,17.38)
makeKey("Index_1",64.51,17.16,17.38,17.38)
makeKey("Index_2",64.51,33.99,17.38,17.38)
makeKey("Little_1",11.17,21.29,17.38,17.38)
makeKey("Little_2",11.17,38.43,17.38,17.38)
makeKey("Little_3",11.17,55.58,17.38,17.38)
makeKey("Little_4",11.17,72.72,17.38,17.38)
makeKey("Little_5",11.17,89.87,17.38,17.38)
makeKey("Middle_1",46.73,17.16,17.38,17.38)
makeKey("Middle_2",46.73,33.99,17.38,17.38)
makeKey("Ring_1",28.95,21.29,17.38,17.38)
makeKey("Ring_2",28.95,38.43,17.38,17.38)
makeKey("Ring_3",28.95,55.58,17.38,17.38)
makeKey("Ring_4",28.95,72.72,17.38,17.38)
makeKey("Ring_5",28.95,89.87,17.38,17.38)
makeKey("Thumb_1",82.29,21.29,17.38,17.38)
makeKey("Thumb_2",82.29,38.43,17.38,17.38)
makeKey("Thumb_3",82.29,55.58,17.38,17.38)
makeKey("Thumb_4",82.29,72.72,17.38,17.38)
makeKey("Thumb_5",82.29,89.87,17.38,17.38)

This runs inside my little Python layout program that builds the box (which I really need to write sometime). It turns out that it is very easy to run code inside KiCad, although some of the help online seems to be a bit out of date. You also need to be very careful with some parts of your code. If you get the path to the file wrong this won’t just crash your program, it will take out the KiCad program completely. I tried a number of different ways to catch the exceptions and errors that might be thrown by the LoadBoard function but I was never able to stop the crashing. Just make sure that your path is correct and that any backslash path separators are properly escaped as you can see above.

Achievement unlocked: First PCB built

The bag was very hard to undo, but worth it

A parcel arrived from PCBWay today. These are the boards that I designed last week. They turned them round in double quick time and they look great.

These are the key positions for right handed use

I lost no time soldering the key sockets into place and getting a test program into the PICO. I have made a few mistakes with this board. The key spacing is a tiny bit close. I had to file a bit off a couple of keytops to make them move smoothly. The next version will have the keys a mm or so further apart.

It is traditional that your first board needs a fix or two….

I’d also made a mistake with one of the OLD display sockets, reversing the clock and data lines. But I managed to fix that and get the board going with some Python code. The good news is that the left handed versions is wired perfectly. I’m going to build one of those too just to see if it is easy to learn to use the keyboard with your left hand. Now I have to write the C++ code to read the keys and send the keypresses over Bluetooth.

Camera auditions

One of my favourite spots on the planet

We’re preparing for a trip away. Everybody else is worrying about where to stay, how to get there, what to eat and stuff like that. Me, I’m trying to decide which camera to take. I took one of the contenders out for a walk over the weekend. It’s a 10 year old Fujica X-A1. I put the wacky wide angle lens on it. I’m not unhappy with the results

Looks a bit like the start of star wars….

Sometimes you getgood results if you just press the button to see what happens

Fuji cameras are good with green

You can find all these pictures (and a few more) on my Flickr page.

Connected Little Clock

Use your skill and judgement to work out when this picture was taken

I’ve had a connected little clock in the hall for a while. It used to light up with a pleasingly bright blue display. Then, after a while gaps appeared here and there as the leds seemed to wear out.

I’ve replaced the blue ones with red ones, which I hope will last a lot longer. If you fancy one of your own (which will be remote controlled via the web) I’ll have the new software out soon.

3D printed camera is now light - tight

I’m actually very happy with this picture

The picture above was taken using my 3D printed camera. The lack of any light on the image is actually very pleasing. While the film was in the camera I took it outside, shone torches and bright lights on it and generally waved it around in the brightest areas I could find. And the picture came out completely black. Which means I think that after a whole of of painting and masking it is now light tight.

I’m going to put a spirit level on the camera so I can tell when it is level…

I took the camera out for a walk and came back with this, which I’m quite happy with.

Coronation Curtains

We watched the coronation today. At least, we watched the interesting bits. One thing that struck me is that Marvell do a much better job with their costumes that we do. The Guardians of the Galaxy have much better threads than this lot. I suppose that back in the day the outfits of all the great and the good seemed much more impressive. Most of the things I saw people wearing today left me thinking that someone’s front room curtains now have great big archbishop shaped holes in them….

Ordered my PCBs - another easy job

Another job this week that turned out much, much easier than I expected was getting the PCBs ordered for the Bluetooth chord keyboard I’m making.

When I made the original chord keyboard PCBWay reached out to me with an offer of a sponsorship of my next board, which I’ve only just taken them up on. I added the PCBWay plugin to KiCad and ran it to see what happens. What happens is that all your design files get sent to PCBWay, their site opens up and within a few seconds you have a price for the job. All I ended up having to pay was for quick delivery - because I’m an impatient sort. The boards arrive next week and I’m rather excited about this. It turns out that getting a custom PCB made is affordable and easy. I can see me using this service a lot in the future. And I’d really like to have a go at having a PCB made and populated.

The latest version of KiCad lets you put artwork and text on your PCB. I really think everyone should have a go at making their own boards. You might not put much circuitry on it, but you could make it look very pretty.

May Meetup Fun and Games

Apologies to Ross who arrived to late to be in the picture.

We had our May meetup last night. We had some great chats about this and that. I was showing off the latest release of the Connected Little Boxes system and it actually worked.

Brian has been experimenting with a cheap lidar system. The spinning bit has a distance sensor and should be able to “see” objects around it. I want to try putting one on a pixelbot. Brian is getting data out of it, but it is not terribly sensible just yet. However, that’s not stopped me buying one to play with. If you fancy getting one too you can find them here.

Connecting Domains to Azure Web Applications is much easier than you think

I love it when a job turns out to be much easier than I was expecting. I’m building a portal site for the Connected Little Boxes project. It is going rather well. I’ll be giving folks access to it soon so that they can create their own devices and control them from anywhere via the web. The site is hosted on an Azure web application that has been great fun to build. But I want the site to have its own domain, rather than https://clbportal.azurewebsites.net/ (although this works fine). This morning I thought I’d sort it out. I was a bit worried about fiddling with domain names and Azure settings and whatnot. But I had the whole thing working before my coffee break. I bought the domain clbportal.com from namecheap . It cost me around 12 pounds. Then I followed this really useful howto which took me through configuring the domain and setting it up on Azure. If you are making anything you want to make public you really should give it a custom domain. It makes it look a lot more professional and it makes it much easier to move from one provider to another.

The only thing that caught me out was the way that https seems to work on my new domain. You can browse to the site using http://clbportal.com but if you do this you end up being served pages which are not secure. If you go to https://clbportal.com you get the secure version. Normally the two work interchangeably, but one of the things that my site does is connect to your device over the serial port on your computer. This only works if you are browsing from localhost or a secure server. There is talk of an Azure setting that you can tweak to make sure your site is always served as the secure version but I can’t find it anywhere. So instead I’ve changed the internal references so that when you navigate around the site you get sent to the secure versions.

Importing STL files into FreeCAD

One of the light leaks in my leaky camera was because the lens mount had some mounting holes in it that I’m not using. These made for some thinly printed areas which let light in. I wanted to make a modified version of the part without the holes and with a slightly larger lens opening. The problem was that I only had the file as an STL file, not in something that can be edited using FreeCAD. However, it turned out to be quite easy to import the design and then convert it into a FreeCAD model. The first thing you do is use the import dialog to bring in the STL file, select the loaded mesh and switch to the Part workbench and use the commands Part->Create Shape from mesh and then Part->Covert to solid. After that you can work with the part as you would any other.

Remember to convert at the highest possible resolution

This is powerful magic, as it means you can take any STL mesh and work with it. I’ve put the procedure in the blog so that I know where to look when I need to do it again……

Fixing a leaky camera

The hair is probably one of mine. I need a haircut.

My 3D printed camera leaks light. It works perfectly fine indoors but take it out into the sunlight and things go badly wrong. The pictures have an “other worldly” quality but I’m not always going for that. Number one son suggested that I wait until it gets dark, put a powerful light inside the camera (there’s plenty of room) and then see where the leaks are. The first discovery was that some of my black painted areas were not very black. So yesterday I spent some time painting my hands, trousers, shoes and camera with more black paint. The paint ran out to the point where the spay only worked when held vertically, so I had to hold things in front of the nozzle to paint the bits that needed an extra coat. Hence my attack of “black fingernail”.

Tonight I spent a happy half hour in the dark looking for leaks and applying copious amounts of black tape to leaky joints in the camera. I think it is mostly light tight now.

Adventures in Spot Metering

I’ve bought a new photographic gadget (audience looks shocked - several people at the front faint with surprise and have to be carried out…..). It’s a spot meter. You use it to get the best possible results when you take a photograph. Film can only handle a certain range of dark to light. When you set the exposure of the photograph you want to map the range of the film onto the areas of light and dark in the scene that you want to see in the image.

You look through the spotmeter and it shows the light levels in a tiny portion of the scene. You get the levels of the dark and light regions and then set an exposure that will work over that range. I’ve started with a very simple approach. I’m just finding the darkest area and then setting the exposure to two stops below the reading I get from the meter. The spotmeter gives a reading assuming that it is looking at something which is grey. If I push that grey value down towards black I should get a sensible exposure.

I think I’m getting better

Achievement unlocked: designed KiCad circuit board

I’m rather proud of this. Please don’t find a fault in it…

I’ve finished my design for the chord keyboard. There are lots of key locations but you only put one switch in each column. This makes it easy to make left or right handed versions. I’ve added connections for a tiny OLED screen. You fit the display the the side that you are not using.

Next thing to do is to send it off to get some boards made. Rather exciting.

The KiCad selection filter is awesome

the work of a genius

One of the great things about KiCad is that it seems to have been built by engineers for engineers. This makes it a bit tricky to get your head around when you start, but once you start using it you appreciate they way that things have been built to make using it easier.

One case in point is the amazing Selection Filter you can find in the PCB editor. There are lots of things in your PCB design and it can really tricky to just select one thing when you are editing. Tucked down in the right-hand corner of the editor you can find the Selection Filter. This lets you set what you want to be able to select with the mouse. If you are moving footprints around to place them on the board you only want to select them, so you set it as above. If you want to work with tracks you can do that too. Really useful.