Gaslit by ChatGPT

I’m writing some code to drive a tiny mp3 player. These things are awesome. You can get them for a couple of quid each, pop in an SD card with some files on it and off you go. I’ve used them before, but I wanted a MicroPython driver to go with the Connected Little Boxes framework I’m building.

ChatGPT made me the driver, and helpfully included a demo program. I dropped it all in place and it worked, except that the music glitched after it started. This was a worry, so I spent a moment looking for power supply problems and checking the MicroSD card I was using. Then I took a proper look at the demo code that had been written for me:

df.play_track(1)
time.sleep(2)
df.pause()
time.sleep(1)
df.play()

Oh ha ha. The demo program pauses the playback and resumes it, giving me a glitch. ChatGPT was unmoved when I pointed this out. It told me it was just showing me another feature of the code…

Bit Drop at Global Gamejam 2026

University of Hull in “STill Looks Awesome” shock

I’ve not done a Global Game Jam for a while. But this morning finds us in Fenner Lab on the University campus thrashing out ideas and getting to work. The theme for the competition is “Mask” and we’ve decided that we’re going to do bitmask themed take on a falling block game. I’ve taken it upon myself to do the sound/music. This removes me from complex gameplay discussions and means that if my bit doesn’t work the game will still run. Double win.

We’re using a game engine called Godot. I’ve never used it before. After a day spent playing with it I reckon it is really rather splendid. You write your scripts in a language a bit like Python using an IDE built into the engine. This is the first time in a long while that I’ve written code in something other than Visual Studio Code. I quite like it. The syntax error highlighting is neat and once you get your head around how things are organised it all works very well. It is also very easy to create a web-based version of your game. If you want to know more about what we got up to, and hear my very primitive sound stuff you can find it here. The game doesn’t do much at the moment, but it runs and that’s a start.

Base Camp

We’ll be back in the lab tomorrow adding the finishing touches.

Don't forget your internal pullups

Behind the magic

I’m wiring a big red button onto a PICO. Above you can see the work in progress. Wiring buttons is easy, you just wire the button switch between an input pin and one of the many ground pins on the PICO. It should just work . Unless you’ve used AI to write the code (like I did) and forgotten to tell the AI to enable the internal pullup on the input pin. “What’s an internal pullup?” I hear you ask (actually I don’t, but let’s keep moving forwards).

Well, the principle of the circuit is that when I press the button it connects the input pin to the ground level, causing the input to go low. But that pre-supposes that the input pin is set high before the button is pressed. One way to do this to is to fit a fairly high value resistor (perhaps a few thousand ohms) between the input pin and the power rail. That works, but it means you have to find a resistor and solder it in place. A better way is to use an “internal pullup”. This is a switched resistor inside the microcontroller which you can turn on to pull the pin high. They are terribly useful, but only if you enable them.

pin = machine.Pin(pin_number, machine.Pin.IN, machine.Pin.PULL_UP)

You request an internal pullup by adding machine.Pin.PULL_UP to the constructor for the pin. If you do have a pullup resistor on your board (some hardware makers do this) then you should turn off the internal pullup to stop the two of them fighting…

Paying off AI Technical Debt

AT least I managed to get out and take some pictures

Just spent a day paying off Technical Debt. Technical Debt is caused by doing the expedient thing rather than the right thing. It’s a project development term for putting things in the loft rather than taking them to the tip. In this case the Technical Debt was accrued by telling the AI to write some code and then assuming that it had done the right thing… Anyhoo, things that I didn’t realise were broken are now all working. Which has got to count as progress I suppose.

Wireless Speaker Fun

When in doubt, start with a joke:

What do you call an underwater dog?

A sub-woofer.

Well, I like it. But it does bring to mind my “technical problem of the week”. On Friday I was seduced by a massively reduced massive sound system that I could bung underneath my telly to boost the sound a bit. On Saturday I gave the system a quick test and having found that it seemed OK I then drilled holes and fixed things to walls. Today I discovered that it doesn’t work properly. The sound from the sub-woofer (see joke above) was intermittent. My least-favourite kind of fault, and usually the hardest to fix. Oh well. That explains the reduced price.

The sub-woofer is the speaker that brings all the crunchy bass sounds to the party and without it you haven’t got much of a party. And with a sub-woofer for only half the time you have a party that makes you feel seasick after a while. So I did what any sane person would do. I did a quick search of the Internets. Fortunately, this was one of those increasingly rare occasions where my search took me to a useful answer. Apparently the wireless connection to the subwoofer can be upset by proximity to Wi-Fi hardware. Like the access point I had right next to the TV. I moved things around a bit and the woofer now sounds great all the time. So, if you’ve got wireless sound stuff which isn’t behaving you might like to check for interfering signals.

Weekend Scrapes

Notice how I’ve left off the Number scale on the side

I’m not the kind of person who obsesses over their blog traffic (or am I?) but I’ve noticed over the last few weeks that I get peaks in traffic over the weekend. Very strange. I don’t think it is people going “At last-it’s the end of the week and I can spend my leisure time catching up with Rob”. I think it is more likely that the net might be a bit quieter during the weekend and so that’s when systems go out and scrape it for words to train their large language models. My blog contains quite a few words, so I get a lot of hits on my pages.

This does mean, of course, that my writings are all being stolen without my knowledge or permission, and they will be incorporated into random systems to make them appear ever so slightly more human. Or, at least more Rob. I don’t mind this too much though, if this means that my gift to posterity is devices that sound a bit like me, then I’m OK with that. And, what that in mind, here’s my latest grate thort:

I’ve started wearing high-visibility clothing because my wardrobe is very dark inside.

Hardware Meetup Field Trip

Great fun was had on our first Hardware Meetup field trip today. We we started with a look through the proud possessions of an accomplished engineer who is sadly now no longer with us. There was some amazing stuff there at very reasonable prices. I’ve got no particular need for a “CRT Tester/Rejuvenator” although I was tempted, particularly as it has a setting marked “Super Rejuvenate”.

I picked up some soldering hardware and everyone else found something interesting. Then it was back into the cars and over to Ross’s (is that the right number of sses?) place for a look at his latest piano hardware.

Player Piano plus mechanism

This manual piano has been made automatic by adding a mechanism underneath the keys that pushes up the back of the key and plays a note. The piano also has keyboard lights that can show which keys are playing, or help teach you keyboard skills.

Driving the notes

These are the solenoids which drive the keys from underneath the piano.

The two pianos are linked together

Baby Grand

Ross and his team have been making pianos that play themselves for a while now. They’ve branched out into keyboard sensing too, so that they can change any piano into a MIDI device by simply laying a sensor bar across the top of the keys. Tunes played on the otherwise unmodified baby grand are duplicated on the receiving piano.

Finally we headed for dinner at the Helal Tandoori in Louth which was excellent. After that it was time to head home. The next hardware meetup will be on the 5th of February, back in Hull Makerspace.

Tim Berners-Lee: This is for Everyone

I saw Tim Berners-Lee talk at Scarborough a while back. He’s a great public speaker. Plus, he invented the World Wide Web. He also writes books. His latest, This is for Everyone, describes how he came to invent the web, what happened to his invention and where he thinks it should go next. It’s a first-class properly thought provoking read. For me the best bits are the first bit, where he describes the circumstances that led to the development of the web, and the last bits where he puts the latest technical developments, including AI, into a web context.

The middle bit is interesting too, but it left me feeling a bit depressed as it tells the story of a system invented to improve the lot of everyone being bent and twisted into shapes that benefit just the corporate few. Having said that though, it is very impressive that so many of the original. open ideals still underpin the web today.

The book is thoroughly upbeat about technology and it would be lovely to think that ideas such as Solid (which propose managed storage for all) could gain widespread acceptance. I’m going to have a look at the technology, and I suggest that you do too.

Back to being a "Duty Programmer"

I’ve been using AI to write code for a while. Up until recently I was just asking ChatGPT questions and then copying its answers into Visual Studio Code. This works fairly well and is good for me because I have a ChatGPT subscription. But, having seen what Claude can do inside Visual Studio Code I thought I’d give that a whirl.

At around 4:00pm today I decided to add rotary encoders to my Python powered Connected Little Boxes. I wanted an encoder manager that would generate events that other mangers could use to control things. Claude looked at the pattern for other managers and built the manager for me. Then I asked it to make a lamp manger that uses two encoders to control the brightness and colour of a pixel lamp. It did that too. But it didn’t quite work. I took a look at the code and had the following conversation with Claude:

This is exactly what I would have said to a human developer who had come to me and shown me their code (I typed the bit at the top). Claude took the input, modified the relevant source files and the device now works perfectly.

My first role when I graduated included working as the “Duty Programmer”. I sat in an office next to Computer Reception and any user with a problem could come along, show me their code listing and I would suggest how to fix it. I loved the work. New puzzles every day.

One of the best things about the job was that sometimes you didn’t have to have any understanding of the software being shown to you. The user would get half way through describing the fault and then say “Aha! That’s what it is!” and go off and fix it themselves. Turns out explaining a problem to someone else often ends up with you fixing it.

But on the occasions they were properly stuck I’d have to dig into their code and help them work out what was going wrong. After a few years I got quite good at it. And now I seem to have come full circle in my career. Only I’m not looking at code written by someone else, I’m looking at code written by something else. Interesting times.

Visually Explained Videos are Wonderful

Python is a wonderful programming language. But, like most languages, there are things about it that you just have to know. You can’t infer the existence of things like *args and **kwargs. You need to be told about them, what they do and how best to use them.

The Visually Explained series of videos does a fantastic job of placing Python elements in context. It covers lots of fiddly things about the language which are super powerful but you might not know about. They are impeccably presented and just the right length. If there’s something you’re grappling with, or you just want to broaden your Python horizons, you should take a look at them.

Polaroid OneStep

This is a nifty little camera from a while back. It takes Polaroid 600 film and has a funky flash flip up front. I got this one at the same time as I got the Polaroid MiniPortrait. I’m not sure which was thrown in with which. The camera works well. I love the way that when you move the slider on the left from tree to flower it slides in another lens to adjust the focus . Both lenses are plastic, so you don’t get anything tack sharp. But you do get pleasing colours and contrast.

There’s not that much more to say about it really. The flash normally fires for every picture. If you don’t want flash you can press the button which is wrapped around the release to trigger the shutter on its own (but you’d best brace the camera against something solid or you might be entering a world of camera shake).

If you want to dip your toe in instant photography you can pick these up pretty cheaply and they look really cool (I think) which is nice.

This shot shows the limits of the close focus. The bottoms of the vases are nice and sharp, but the flowerheads are a bit blurred because they are closer to the camera. But it made a good job of exposure and lighting.

Insights from Octopus

You don’t say

We had our gas and electricity meters replaced yesterday with new smart ones. The process was quick and efficient. Although it felt strange to be in a house where nothing worked for the hour or so it took to swap the electricity one. The data feeds seem to be working now, although it might take a bit of time for the insights to catch up.

I was looking forward to getting a gadget to put in the kitchen to monitor my energy usage, but these aren’t given away anymore. Apparently nobody uses them and they end up in the back of a drawer. Everything can be done via the app. I’m tempted to see if I can’t make something to provide a display.

We did have a brief go with Agile Octopus a while back but we gave up when the prices reached the point where it was impossible to do things economically for long periods of the day. Perhaps we’ll take a look at some of the more adventurous tariffs in the future. I’m just looking forward to not having to submit meter readings every month.