Tiny FreeCAD

There is also a viewer for the output

I’ve been playing around with Python programs in FreeCAD for a while. It’s great fun. But FreeCAD is a big install. So I wondered if it was possible to make something which had the same Python API as FreeCAD does, and implements just the functions that I use. I asked Claude to build it, and less than 12 hours later, here it is. You can download it here.

The repository includes FreeCAD Python code I created for the Python in FreeCAD series of articles I wrote for Raspberry Pi Magazine. It’s not a complete implementation of the API but it is enough to be useful. The great thing about it is that everything you need to run the examples is in the repository. There is nothing else you need to install. I’m using it in the Thing Maker and it seems to work very well.

Enter the Thing Maker

I’m building a Cyberdeck. This seems to be very fashionable at the moment. It needs a case. I could have designed one and left it at that. But I wanted something that could make lots of configurations, and other boxes too. So, on Saturday I gave Claude a detailed description of a program that I wanted to it to build for me. I pointed Claude at some other things I’ve made and told it what I wanted. And, after while of using words like “nooodling”, it dropped out “The Thing Maker”. I then spent the next couple of days bouncing backwards and forwards and refining the design and now, here we are:

A case design is expressed in a JSON file that specifies boxes, what is in them and the hinge that joins them. You use a snazzy interface to place your devices inside your boxes. The device specification includes cut-outs for the connections (you can see them in red above) which you can enable on a per-connection basis. The box (base and lid) is made around the devices and then their cut-outs make sure that the holes line up. You can also make devices “sticky” so that they will move when the box size changes. It’s been great fun to make, and it might even turn out to be useful. You can even import stl files that describe assemblies and add them to the design, along with mocks, cut-outs and supports.

It’s the kind of thing I would build if I had the time. But now I don’t have to, because Claude has built it for me. We do live in interesting times…..

Don't forget the Raspberry Pi 3a

This is a great time to be building systems. Unless of course you need to buy any hardware. In which case the device you want will be either super-expensive, unobtainable or both. If you fancy a Raspberry Pi 4 or 5 look forward to some hunting and a big bill at the end. But remember that you don’t always need the latest and greatest. If you want to make something to monitor a bunch of sensors and host a website, or run in a little interactive display, you might find that an older (and much cheaper) Pi will do the trick. You will also have a lot more luck getting one for a not-extortionate price.

Which brings us to the Raspberry Pi 3a. This is basically the same hardware as my favourite (but totally unobtainable) cheap Pi, the Pi Zero 2 W. But the 3a comes with proper usb and HDMI ports and even an audio output. It is also available to buy right now for a not too eye watering price. Worth a look.

The universe really does have a sense of humour

Amazon gave me a refund for something I hadn’t sent back. This offended my honesty. Plus I was worried about them catching up with me. So I got in touch. Talked to an AI assistant that was useless. Then got put onto a supervisor which might have been a slightly more expensive AI model. But were very helpful nonetheless. They/it told me to take the win and smile. So I did. Then something that costs almost exactly the same as the refund broke and I had to buy a new one. From Amazon. Life eh?

Blade Support when 3D printing

3D printing is great, but some things can be a problem. Printing gently curved surfaces can be tricky, particularly if they are on the top. The limited vertical resolution of the printer means that the layers of the print really show up, making the surface look like a contour map. One solution is to print the piece at an angle. This works well, but it might mean that you need to print a lot of support underneath your print. The chap above has come up with a neat way of making angled prints quicker and less wasteful. Rather than support the entire surface, he uses just a “blade” to support one part of it. The video explains how it works and how to do it. Worth a look.

Clicky Test Keyboard

For the finished keys I’ll fill in the gaps in the legends

Me and Claude (well, mostly Claude) are making a Cyberdeck Keyboard. I’ve decided to use very cheap and tiny surface mount clicky switches underneath the keys. Which led to a concern. I was worried that if I put a long key (for example space bar) on top of the keyswitch the key would pivot if you pressed the edges and not trigger the switch. I wondered if it would be a good idea to mount long keys on two switches.

This is not the kind of thing that you can decide by just thinking about it so I asked Claude to make a mock PCB with spaces to insert the switches I’m using, and then build a test keyboard around it. You can see what I ended up with above.

There are two versions of each long key, one supported by two switches and the other supported by one. It turns out that the 4u key on a single switch works fine. The space bar tips when you press one end, but not far enough to stop the switch from registering. Using two switches actually makes things worse, as you seem to have to press both of them down to make the key work. And now I’ve got a nice little fidget toy to play with…..

Tiny Software Engineer at the Hardware Meetup

Ross showed me the video above, which describes a tiny software engineer. You can connect it to your AI agent and it mimics what the agent is doing, whether it is thinking, typing or finished. It uses a bunch of servos, an ESP32 and 3D printed components. I want folks in the Hardware Group to have a go at building it and then we can try to get a bunch of them working together. If you fancy having a go, come along to our next Hardware Meetup. There’s one on Wednesday next week (the 7th October).

Cyberdeck Keyboard

I’ve decided to try and make a keyboard for a Cyberdeck I’m building. I’m using Claude to do all the work. I want to use it to design a printed circuit board, case and 3D printable keys. The starting point will be a JSON file which describes everything. So I also need a design program. Claude “thought” for a while and came up with the above program. I showed it my programs for FreeCAD which make the wordsearch clock and told it to use that idea to make a keyboard design.

The keys printed out rather well. I’ve now asked for the design to be inverted so that I can print the keys with the text close to the print bed, which will make them a lot smoother. I’ve got a policy of not fiddling with what has been produced because I want to see how far AI can get on its own. So far it is doing very well.

Batman: Legacy of the Dark Night on Switch 2

When the Lego “Batman - Legacy of the Dark Knight” first came out I read the reviews (everyone seemed to like it) and decided to wait for the Switch edition as I like playing games on the Switch. I normally download games directly from the Nintendo store because I’m lazy, but this time I ended up buying the physical game because it was quite a bit cheaper on Amazon. This of course makes no sense.

When the box arrived I discovered that what I had actually bought was a cartridge that serves as a key to download and run a copy of the game. So anyone getting the boxed version to try and avoid buying more storage for their Switch will be disappointed.

The game itself is, er, fine. From the reviews I was expecting things to have moved along a bit from earlier games, which I enjoyed a lot, but no - you get the usual stuff (including a really annoying driving mission early on). The cut scenes are very good, the city is well rendered and everything moves along nicely. If you’re thinking of buying it you could do worse.

The Innkeeper is not always your friend

We played Dominion tonight. It’s a great game. I had this theory that going all in on innkeepers might be a great plan.

It wasn’t. You get through lots of cards, but you always seem to end up with the same amount of treasure.

Oh well. I think it is worth going for if you have got yourself a few gold coins. Which is what I plan to try next time it comes up.

When .local Stops Being Local

I have a Raspberry Pi server called bigbrain. Normally I can reach this machine on my local network using:

bigbrain.local

This works using mDNS (Multicast DNS). Addresses ending with .local are handled specially. Rather than asking an outside world name server to resolve a name to an address, when a device sees an address ending .local it will use a local service that listens for devices that broadcast addressing information on the local network. On a Raspberry Pi, mDNS is normally provided by a service called Avahi. Avahi announces the name of the machine on the local network so that other devices can find it without needing an entry in a conventional DNS server.

This morning I noticed that bigbrain.local didn’t work any more. This was a bit worrying, it’s the machine that hosts the custard cream server, among other things. I logged in using the Raspberry Pi Connect service and was pleased to discover that the machine was still working. The first thing to I needed to check was whether or not the Avahi service was running. I opened a terminal window and typed:

systemctl status avahi-daemon

Avahi was running, but the output contained an important clue:

Host name conflict, retrying with bigbrain-2

and:

Server startup complete. Host name is bigbrain-2.local.

This explained why bigbrain.local wasn't working. Avahi thought that another machine on the network was already using that name. Rather than create a conflict, it had renamed its mDNS identity to:

bigbrain-2.local

Was there another Bigbrain?

My first thought was that I might have booted another Raspberry Pi containing an old copy of the bigbrain system. If two machines both have the hostname bigbrain, they will both attempt to advertise themselves as bigbrain.local.

But I wasn't certain that I'd actually done this, which raised a slightly less comfortable question: was an unknown device appearing on my network?

Fortunately, the system log provided some more information.

The conflict had occurred at 02:55 on 22 September:

Sep 22 02:55:17 bigbrain avahi-daemon[585]:
Host name conflict, retrying with bigbrain-2

Looking at the Avahi journal around this time showed something interesting. For several minutes before the conflict, Avahi had been repeatedly registering and withdrawing network addresses.

At 02:55:17 it withdrew the addresses associated with both network interfaces and then registered them again. Five seconds later NetworkManager reported:

dhcp4 (eth0): state changed new lease, address=192.168.7.107

So something was definitely happening to the network at the same time that Avahi decided there was another bigbrain.

The missing piece

I use a system called eero to provide Wi-Fi access at home. It turned out that the eero network had automatically updated its software earlier that morning. The update caused the network infrastructure to restart. At 02:19 on 22nd September. That provided a much more convincing explanation.

As the network came back, DHCP leases, IPv6 addresses, multicast groups and mDNS advertisements all had to be re-established. The Avahi logs showed exactly this kind of activity.

There was another complication. bigbrain was connected to the same local network in two different ways:

              bigbrain
             /        \
          WiFi       Ethernet
           |             |
    192.168.7.22   192.168.7.107
           \             /
            local network

Both interfaces were therefore participating in mDNS on the same network and both represented the same machine with the same hostname.

Normally this works. But during the disruption caused by the network restart, Avahi apparently saw enough conflicting information to conclude that somebody else was already advertising bigbrain.local.

It did the safe thing and changed its advertised name to bigbrain-2.local.

Once the network had settled, restarting Avahi:

sudo systemctl restart avahi-daemon

allowed it to register bigbrain.local normally again.There was no evidence here of an unknown machine or a security compromise (which was nice). The hostname conflict occurred during a period of substantial network reconfiguration following an eero software update. But the incident did expose an unnecessary complication in the server configuration.

The Raspberry Pi was connected to the same LAN using both Ethernet and Wi-Fi.

There are situations where having multiple network interfaces is useful, but a fixed server generally isn't one of them. Two connections to the same network mean two IP addresses, two routes onto the LAN and two interfaces participating in multicast protocols such as mDNS. Most of the time the networking software sorts everything out. When the network is being restarted or reconfigured, however, things can get more interesting.

For a Raspberry Pi being used as a server, the simplest rule is therefore:

If you have a wired Ethernet connection, use Ethernet and turn WiFi off. If you need WiFi, use WiFi and leave Ethernet disconnected. Don't routinely use both to connect the server to the same local network.

I’m going to disable the Wi-Fi on bigbrain. Networking is complicated enough without giving the packets a choice of doors.

Friday Widescreen

Friday finds us at a presentation at the National Science and Media Museum in Bradford. It was all about widescreen movies. Back in the days when movies were things you went to, not things you made, a plucky band of souls formed the Amateur Widescreen Association. Impressed by the widescreen movies of the day they tried to create the same experience using films and equipment available for home use. At the time cameras and projectors were entirely mechanical, so the task was to use different lenses, film gate shapes and film sizes make the biggest and most impressive wide screen effect. Every year they held an event where they all gathered to show off their latest creations. They built some amazing hardware, including one presentation that used 3 synchronised projectors. Each year they had a competition to pick the best films, and we got to see a bunch of test films, along with some of the winners. It was great fun.

Of course, nowadays widescreen is an option you click on your phone camera and image quality is just something you take for granted. But the presentation showed that with determination and ingenuity you can make tiny negatives really sing on the big screen. Some of the movies were projected as film, in one case it was the original celluloid that went to Afghanistan, was exposed and mixed there in camera and then brought back for development. Lots of material ends up as being of historical interest, as we saw scenes of places that no longer exist. Thanks to Guy Edmonds and the rest of the team for doing such a great job of bringing the past back to life.

The presentation was part of a larger Widescreen Weekend in Bradford which runs once a year. There are lots of movies on show. Maybe next year I’ll sign up and spend an entire weekend eating popcorn…