Careless People: Sarah Wynn-Williams

You should read “Careless People: A story of where I used to work”. The author is Sarah Wynn-Williams. She spent a lot of time at Facebook, at a level high enough to get to fly around with the boss in the corporate jet. Her story starts with a shark attack and then gets properly exciting.

Having identified a need for an ethical framework at Facebook and persuaded the company to take her on board to build it, she learns that the company doesn’t actually care about ethics. It cares about numbers. The number of users, the amount of their engagement, and the amount the company can earn from monetising all of this. Her carefully constructed checks and balances become just part of the campaign to get to more people and organisations and make bigger numbers.

People have reacted with surprise at some of the things revealed in this book. Not so much me. One of my theories (I have many) is that some people will try to get away with anything a given situation will let them. Great Power might come with Great Responsibility, as Peter Parker’s uncle said, but you can choose not to exercise any responsibility. If it takes time, costs money and reduces numbers you can just do what you like instead of worrying about bad things like law breaking and getting folks killed.

I’d love to think that there is an ending coming up where some of these chickens come home to roost. Where people find out that they are not above the law and that actions have consequences. But I don’t see that happening any time soon. And it will only happen if enough people read books like this one and start to think more about where the world is heading.

Italian for beginners

Are you embarrassed by your lack of Italian skills? Having bother telling your pancetta from your pana cotta. I present to your this handy way of remembering, and retaining your continental cooking cred.

  • pana cotta: babies sleep in cots, and they like drinking milk. So this is the creamy desert.

  • pancetta: cheetahs like to chase pigs, so this is the one that is a bit like bacon.

  • panettoni: Tony likes eating cake, so this is the one which is like cake

You’re welcome.

Turning off the Circuit Python storage device

When you connect a CircuitPython powered device to a desktop PC the device appears on the PC as a usb storage device onto which you can write your program and data files. If you don't want this to happen you can put a **boot.py** file on the device. When a CircuitPython powered device wakes up it runs the program in this file.

import storage
import usb_cdc

# Disable USB mass storage
storage.disable_usb_drive()

# Keep USB REPL enabled to allow deploying files via REPL tools
usb_cdc.enable(console=True, data=True)

# Remount the filesystem so CircuitPython code can write to it
storage.remount("/", readonly=False)

This program disables the usb storage, ensures that we can still deploy files using the REPL commands and then remounts the Circuit Python file system so that it can be written to.

Note: If you don't enable the REPL console you will have a slightly more secure device (it will not be possible to easily fiddle with the filestore via a serial connection). However, you will have to erase the current program in the device if you want to make any changes to it.

Recognising "Two" at the Hardware Meetup

The evidence is on the screen if you look closely

More fun at the Hardware Meetup last night. Brian had brought along an M5 Stack device that recognizes words that you say. Mostly. The idea is that you can use it to make your devices voice controlled. It’s very cheap, has a vocabulary of 42 words and nearly all of them work. Except “Two”. This stubbornly refused to be picked up until Ross turned up and managed to make it work. We think it might be his accent. Or lack of it.

If you don’t want to input numbers you might find a use for it. You connect via a serial port and it sends messages when it receives the wake word and words that it recognizes. The marketing blurb says that you can add extra words from a total vocabulary of 300 words, but at the moment it is not clear how to do this.

At the price I think it represents good value. It was certainly fun to play with.

Tidying up the home page

I’ve done some tidying up of this site. I’ve got rid of the word cloud thing, which served only to remind me that I’ve written lots of posts about things that no longer exist. In its place I’ve put some links to things that are ongoing and folks might find interesting.

If you think there are other things I could do which would improve “The Rob Miles on-line experience” please let me know in the comments.

Update: I’ve put the tag cloud back. You can now find it on the top menu. I’ve also added a “Bad Jokes” link.

Current Flow

You know that feeling when you put a teacake in the toaster, push down the lever and everything goes out. I do. It happened at teatime today. Turned out that a wayward raisin had bridged the gap between the element and the case of the toaster causing a current flow (yay!) which tripped the circuit breaker. It took me three goes to fix it, but now I can make toast again.

The Python Connected Little Box takes shape

I’ve been making Connected Little Boxes for ages. Up until now they’ve been powered by a large a complicated C program that I wrote a while back. I thought it might be fun to convert the code to Python and run it in a Raspberry Pi PICO. So last week I started putting it together.

The code controls an embedded device and is based around pluggable manager components which are automatically discovered and loaded when a device starts. Managers can have dependencies so that the MQTT manager won’t do much until WiFi is working, etc etc. There’s setting management, messaging and a console command interface too. It’s all coming along splendidly at the moment. I’ll have everything on GitHub once I’ve made it work.

Play Blokus - if you can find someone to play against

Red and Yellow were playing Blue and green

Blokus is a nice looking game with bright “tetris-like” pieces that players take it in turns to place on a grid. There is only one rule. Any piece you add to the grid must touch one or more pieces of that colour that you already put down - but only on corners. The winner is the player who gets the greatest number of pieces on the board before getting stuck. You start in the corners and then play inexorably moves towards the centre as folks try to carve out areas of their own. If you have two players each player controls two colours.

It’s a quick but highly tactical game. I’ve played it twice and won it twice so far. I’m running out of people to play it against. I might explain the rules to ChatGPT and see if it can rustle up an opponent for me.

Heated Discussions and Cyber Security at The Tech Sessions at Hull University

We had another great Tech Session tonight at Hull University. Free food and drink followed by a couple of thought provoking presentations. First up was Ben Foster who posed the question “What happens if you take a Language Model and connect it to your central heating?” It seems that the answer is that you end up in a room with an audience who are trying to persuade a haiku spouting AI to make all the rooms in your house into ovens.

I’m taking pictures of all the speakers using the big camera. Ben was kind enough to pose for me.

It was a splendid description of how you can take a programmer interface (in this case the one for the Tado range of heating controllers), give it to a large language model and then map natural language commands onto heating control actions. Ben has put a full description of how he got it to work on his blog.

I’ve got a heating control system a bit like Ben’s, so I might have a go at something similar at my house. I might not tell the system to reply to all commands in haiku format though, although it was fun seeing the way his system generated a poetic negative response when we asked it to give us the API keys for its connection….

Toim did a great job at short notice

The next session had a last minute change of speaker, with Tom Jackson from The Rybec Group standing in for an indisposed Alistair Kennedy. The topic was very, er, topical, being that of Cyber Security. I thought I knew all about this. Turns out I was wrong. Data is now the most valuable commodity in the world. We now have cars selling information about our driving habits to insurers. That’s why you sometimes have to click loads of consent forms before you can start the engine.

We have people who want to use your data, hide your data or just fiddle with it to see what happens. They could be a state agent, in an organised crime syndicate or attending the sixth form of your local school. Every technical innovation can be bent backwards to target us. Deep fake voices can persuade your colleagues to do things you haven’t asked them. Malign devices can be embedded into everyday objects (my favourite was the “free” usb power supply which came with a scary little extra). And some people seem to have a liking for single character passwords (with 50 password retries allowed).

If I think back to the software engineering courses I did as a student (and to my shame, perhaps a few of the earlier ones that I taught as a lecturer) the amount of time we spent discussing security was minimal. Nowadays it needs to be front and centre of everything we do. Tom did a very good job of making that point with lots of apposite examples he’d seen over the years.

This was another excellent pair of talks presented in a lovely university environment to an appreciative audience. Here’s to the next event.

Wild Style on Humber Street

I don’t know much about art. But I do know what I like. Liz Dees makes great art. And she’s got a show on at the moment in Hull. You can find out more here. We went along yesterday to take a look.

This is the venue.

Ian put the artwork on the walls. I think the fire extinguishers were there already.

Art as a Puzzle

They have free sweets too!

The work is up for sale at very reasonable prices, bearing in mind that you’re getting something that is individual and unique. If you are in the Hull area over the next couple of days you really should go along and take a look. And don’t forget to ask why one of the pictures appears to have graffiti all over it………

Using CircuitPython’s Two USB Serial Ports

If you want to find more Python Shorts you can find them here.

Making a CircuitPython program talk to a usb serial device is quite easy to do:

import usb_cdc

# Send a line of text to the host
usb_cdc.data.write(b"Hello!\n")

# Wait for a line of text from the host
while True:
    if usb_cdc.data.connected:
        try:
            line = usb_cdc.data.readline()
            if line:
                print("Received:", line.decode("utf-8").strip())
        except Exception as e:
            print("Error reading:", e)

Howwever, when using CircuitPython on boards like the Raspberry Pi Pico, it exposes two USB serial ports over USB:

  • usb_cdc.console → used for the REPL (interactive shell)
  • usb_cdc.data → intended for raw programmatic communication

When you use a browser that supports Web Serial (like Chrome or Edge), it might show both ports as separate choices. It's easy to accidentally connect to the console port instead of the data port. Your CircuitPython code ends up listening on usb_cdc.data, but the browser is sending to usb_cdc.console.

There are two ways you can fix this:

  • Try both ports while connecting
  • Or disable the REPL/console port in production using:
# boot.py
import usb_cdc
usb_cdc.disable(console=True)

Note that if you disable the console port you will not be able to interact with the device using tools such as Thonny. You will have to erase the EEPROM in the PICO and the re-flash it to get back control of the device.