Writing C# and Loving It

3D rednering in XAML. Why not?

I’m writing some C# for the first time in a while. And I love it. It’s code I wrote ten years ago, and it seems like yesterday. Visual Studio Code is a great place to work, but Visual Studio 2022 just blows it away for sheer usability. Nothing to load or add - everything you need under your fingertips.

I love writing Python - it’s fun to just write a program and see what it does. JavaScript is amazing in the way that you can use it to create mostly working solutions really, really quickly. And C++ and C are hilarious if you want to tickle hardware directly and don’t mind things suddenly stopping for no reason.

But with C# you feel like you’re using a really well crafted tool to create your code. All of your silly mistakes are caught before it gets to run. The debugging experience in Visual Studio is sublime. And I love building UIs with XAML.

I’m going to have to get back into the C# habit.

Rubber Hammer

It doesn’t look a bit like a murder weapon…

I bought a rubber hammer today. I used to have one, but it must have bounced away somewhere. I’ve got some shelves coming today that you just put together with a rubber hammer and so I thought I’d get one. Perhaps the best 3.50 I’ve spent in a while.

When the shelves arrive I plan to answer the door with the hammer in my hand and say “Aha! At last you’re here. Now I can begin…”

Then again, perhaps not.

Teenage Engineering OP-1 for sale

You know you want it

I bought my Teenage Engineering OP-1 few years back when I thought I might be a musician. This has turned out not to be the case (through no fault of the device itself). I now think I might be a photographer (so stay tuned for a few years hence when I think I might be something else and start selling all my cameras).

Anyhoo, in a bid to fund my photographic excess I’ve popped my OP-1 on eBay. I’ve hardly used it much (it is like new) and I think the price is reasonable. If I decide I want to get back into music I can always sell a couple of cameras and buy another one. You can find it here.

TTArtisan APS-C 25mm F2 is silly good

Really must replace that bulb

I’ve bought another camera. It’s ten years old and wonderful. I had to buy a lens to go with it and I happened across the TTArtisan APS-C 25mm F2. You can get this for the frankly silly price of 69.00 pounds.

My standard test shot came out pretty well too

The lens is metal bodied, immaculately presented and has a metal screw-on lens cap for extra class (although it makes it a bit harder to use). It’s manual focus and aperture, so you’ll have to adjust the settings yourself, but the quality of the output is wonderful. You would have to spend a lot of money to better it.

Stop your Circuit Python devices showing up as a disk drive

Click the image to watch the video….

Got a message from Chris over on YouTube. He’s built my PICO Chord Keyboard design (it worked - phew) and he was wondering if there was a way to stop it appearing as a storage device each time it is plugged in. This is a very useful feature of Circuit Python - it’s how you get the program code onto the device - but it can be irritating, as well as giving folks access to your device that you might not want. I sent a reply and then I thought I’d share it on the blog:

You can stop the device appearing as a usb storage by editing the boot.py file (or adding one if it is not there) on the device. Put the following in there:

import usb_cdc
import board

# Disable USB mass storage
storage.disable_usb_drive()

This should stop the device appearing as a file-store. But remember that if you do this it will be tricky to update the code in the device. You'd have to wipe the EEPROM to get your PICO back to a state when you can change the files.

More details here: https://docs.circuitpython.org/en/latest/shared-bindings/storage/index.html

Hull Pixelbot Rugby in HackSpace Magazine

There are some great gadget ideas too

My Hull Pixelbot rugby article is in this month’s HackSpace magazine. It tells you how to add WiFi to your Raspberry Pi PICO powered robot and then control the robot from a web page. And maybe make a rugby team out of them.

And if you pick up a copy of the Raspberry Pi MagPi magazine (also a cracking read) you will find my article on making a haunted red telephone.

Cheap Photography with the Canon 650

I think this camera works

Ages ago I bought a cheap old camera, just to get the lenses that came with it. Then I put a film in the camera just to see if it would work. It didn’t. The the pictures through the viewfinder looked sharp but the finished prints were full of blur. Now that I’m back into photography (in what seems like a big way) I thought I’d see about replacing the dodgy camera; a Canon 650, with another, less dodgy one. So I did. The replacement cost me ten pounds and came with a smart little case. I took it out for a walk today and shot a bunch of pictures.

Can you guess what time this picture was taken

This camera works a treat. It is fully automatic. It focusses, works out the exposure and even winds the film on after each shot. And it seems to be getting it all right too. I was using a “nifty fifty” (a prime lens with a 50mm focal length) that I happened to have lying around for these shots and they came out lovely and sharp. It allows full manual control too, if you want to make your pictures the hard way.

The whole thing brought home just how cheaply you can get into analogue photography. There is nothing wrong with the Canon 650 except hat it is out of fashion. It is very plasticky and a bit of an ugly lump. But that was the fashion in 1987 when it was released. As a first camera I think it would be hard to beat. You’ll have to find a lens for it (search for “canon ef 50mm”) and you will find that they tend to cost a bit more than the camera. However, you should be able to get started for less than the price of a modern video game. And there is always the chance that if you ask around the family someone might confess to having an old camera like this in the back of a wardrobe somewhere.

I’m certainly going to use my 650 quite a bit. While I quite like the process of working out the exposure and getting the focus right, it is rather nice to have a camera just do all that stuff for you every now and then.

Play My Gold Mine

Not sure why they make a big deal of “Open & Play”. We’ve been doing that with our games for years..

My Gold Mine is a nice little game. Particularly if you allow nice to mean “Setting up fellow players for a bit of dragon flambé”. The rules are simple enough. Each turn you have to decide whether to head for he exit or pick up some more gold and maybe move towards the dragon (a brave move).

The risk is that if you find yourself occupying the same position as the dragon you end up roasted and out of the round. Some of the moves let you mess with your fellow players, swapping places with them or dragging everyone towards the exit when you’re ahead in the game.

The game plays over three rounds and the tension racks up nicely as you head for the final that will decide the winner. It was great fun and comes strongly recommended. Even though I didn’t win..

Taking a Pentax 67 out and about

The light was really nice this morning

One of the things about old cameras is that they like a bit of exercise. And, with the weight of some of them they give you a bit of exercise too. Ho ho. (With the increasing use of ChatGPT in these hallowed pages I feel I must make it clear that I personally came up with that line). Anyhoo, I loaded the Pentax 67 up with a roll of film and took it round the block today. The good news is that the camera made all the right clunking noises when I pressed the button. I processed the film and the pictures are all in the right place too which is nice (and not guaranteed with this model of camera). You get an awful lot of detail with a big negative, and the perspective of the lens is really nice.

More of these are coming to our area thanks to the wonders of de-regulation…

Raspberry Pi 5 is really rather good

I didn’t order a brand new Raspberry Pi 5 when it was first announced. I think I managed to buy the earlier versions on release day, but for some reason this time I wasn’t that interested. However, I had a need for a fast Pi recently and so this week I finally got one.

It is really rather good.

When I got the Raspberry Pi 4 I was kind of expecting it to be a viable desktop alternative. After all, that is what some people were saying it was. It wasn’t. Browsing was slow and Visual Studio Code ran too slowly to be properly useful. But the Pi 5 is much more of a contender. Some of this might be down to the amount of memory available, my Pi 5 has 4G of ram which must help things along. I’m using it over VNC and I think I’d be happy enough to work there. Visual Studio Code seems to trundle along quite happily and web pages open instantly.

It is much more expensive than the original Pi. And of course you have to add the cost of the case, power-supply and micro-sd card to the total price. But for the money I reckon you get something pretty impressive and properly useful. And if you want to go back to the days of tiny, cheap Raspberry Pi’s you just have get yourself a Pi Zero.

Old School Lumix Lives

Not bad for a 20 year old camera

Took the Lumix DMC-LC5 camera for a walk earlier in the week and I’ve only just got round to getting the pictures out of it. The camera was created by Leica and Panasonic, has an amazing lens and a tiny (by modern standards) sensor. However it is particularly good with some colours, particularly red.

The water levels are quite high at the moment

I must get into the habit of taking these old devices out every now and then. They are quite fun.

Hardware Meetup

It was a quiet meetup on Wednesday this week. Just three of us chatting about 3D printers, life and the universe. It’s always fun to go down to Hull Makerspace and see what people are doing. If you fancy joining us the next one is on Wednesday 7th of February when we will be doing some Robot Rugby. Come along and pick a side. We’ll be starting at around 5:30 pm and going on until around 7:00 pm in Hull Makerspace in the Central Library in Hull.

Effortless Debugging with Your Pico Probe: No More Sudo!

Hey there, Raspberry Pi enthusiasts! Are you tired of summoning sudo every time you need to commune with your Pico debug probe? Fear not! Today, we're delving into a nifty trick to make your Pico probe obedient without the superuser incantations. And for those of you using Visual Studio Code, this trick is a game-changer.

Why Bid Farewell to sudo?

Summoning sudo for debugging is like wearing a full suit to a casual brunch; it's overkill and can be risky. Moreover, when you're using elegant tools like Visual Studio Code, running the debugger as a superuser inside the tool is a bit tricky. Let's simplify this, shall we?

The Power of udev Rules:

In the Linux realm, udev rules are like spells that control how the system interacts with various devices. By crafting a specific udev rule, we can grant ourselves permission to access the Pico debug probe without escalating our privileges to the superuser level.

Crafting the Universal Pico Probe Rule:

Most Pico debug probes share the same Vendor and Product IDs, so we can usually use a standard rule for all. Here's how to do it:

The Magic Numbers: For the Pico debug probe, the typical IDs are: Vendor ID 2e8a and Product ID 000c. We'll use these in our rule.

Creating Your Rule: Head over to /etc/udev/rules.d/ and conjure a new file called 99-pico-debug-probe.rules Sprinkle the following line into it:

SUBSYSTEM=="usb", ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="000c", MODE="0666"

This incantation essentially tells your system, "Hey, let everyone read and write to this device, will you?"

Enforcing the Rule: To make the rule take effect, use this spell:

sudo udevadm control --reload-rules && sudo udevadm trigger


What If My Device Is Different?

Got a different device? No problem! Plug it in, run lsusb, and look for the ID format VendorID:ProductID. Use these values to create a custom rule.

Post-Reboot Harmony:

Your new rule is like a loyal house-elf, diligently working after every reboot, ensuring smooth, sudo-free access to your debug probe.

Conclusion:

And there you have it! A simple yet elegant solution to make your debugging sessions with Raspberry Pi Pico as smooth as butter. No more sudo, no more hassle, especially when you're working in sophisticated environments like Visual Studio Code.

Happy debugging, and may your code be bug-free!

Author’s note: I didn’t write this. ChatGPT did. I worked with ChatGPT to solve my problem and then asked it to write a blog post about the solution “In the style of Rob Miles”. I’m quite proud of this, although I didn’t do much of the work….

Cold Battery Blues

Thanks again Dal-e

On Radio Humberside talking about cold batteries. Apparently Tick Tockers (whatever they are) have been noticing that they can’t make as many videos on their phone in the cold weather. This is what I said:

  • Low temperature increases the “internal resistance” of the battery. This limits the amount of power you can get from it.  It also means that to get a certain level of performance it takes more power out of the battery.

  • Electric cars are affected too. They heat up the battery in cold weather. If you have the car plugged in at home you can “pre-condition” the battery to warm it up. This can improve the range, which is a good idea in winter because cold substantially reduces range (at least by a third).

  • Always Be Charging. There’s no advantage in running your lithium battery right down before charging it (in fact flattening a lithium battery can destroy it). Keep your battery charged every chance you get. The only reason to let the battery run down is so that the phone can work out the battery life.

  • Keep your phone in an inside pocket so that you keep it warm.

  • If you give your phone something hard to do this will warm it up (although of course it will also flatten the battery). There are even “hand-warmer” apps that do this – but they are not a particularly good idea.

  • Charge the battery when it is warmer.

  • Warm your phone up before you do something that consumes a lot of power.

Another year of Cubeness

Nice work Dal-E. Not sure about the number of door handles though….

Our Nissan Cube is getting on a bit. As are we all. He’s not perfect, but he is good enough to pass the MOT test for another year. I’m going to get his underside comprehensively clarted with wax and whatnot to try and stave of the inevitable onset of rust (poetic prose) but it is nice to have him around for at least one more year.

Hardware Meetup Wednesday 17th January

Printer Poop produced when switching colours

We’re having a hardware meetup next Wednesday evening at Hull Makerspace in the Central Library in Hull. We’ll be opening 5:30 pm with a presentation of 3D printing lithophanes and the HueForge program starting around 6:00 pm. We’ll finish around 7:00pm

There’s no need to book, just turn up and look interested. If you’ve got anything to show off we’d love to see it.

Lithophane Colour Chart

I’ve Cropped off the very dark areas

I thought it might be fun to make a lithophane of a colour test chart just to get an idea of how well colours are resolved and what colours you could get. Above you can see the original chart. I ran it through Colour Lithophane Maker and then printed it.

This is 0.1mm layers with a 0.4mm nozzle

This is the lithophane that I got. Quite interesting. I think it might be worth running your images through a “posterise” filter of some kind before making the lithophane.