Blog

  • True Sounds of the Halifax Donair

    You know that this is what donairs really sound like …

    Video from Donair Cam. Audio (CC0) from Freesound.

  • Soltec HM-102S: unboxing a 30 year old multimeter

    Hey! I don’t have this meter any more. The scanned manual is all I can help you with (see link near end of article)

    Graham Green had a stall at Make Change yesterday. Graham’s the former manager of Active Surplus, the much-missed Toronto surplus emporium. He had some military-surplus multimeters that hadn’t seen daylight since I was in school. That’s a while back: this (unfortunately) was #1 the week I left school. So I bought one of Graham’s meters just to see what was inside …

    Neatly packed in mil-spec cardboard with a date code of 7/86. There’s a fair chance that Papa Don’t Preach was on the radio somewhere when this was sealed
    Inside the box, the meter’s sealed in a pouch. Mil-spec doesn’t allow anything to rattle about, after all. Unlike some surplus stuff, this looks 99.999% mouse-piss free
    Under the meter was this battery pouch, which exhibited the qualities of both “crunchy” and “squishy”. Neither of these are things I look for in a battery, so these weren’t going in the meter
    Battery pack dated January 1986. This isn’t going to be good.
    Daylight … for the first time in 31 years! On first glance, everything looks okay, but three decades of phenolic off-gassing was much in evidence — pew!
    Despite the hermetic seal, the elastic band had rotted to dry pasta consistency. Note expired elastic band ichor on the manual cover
    The test leads are still bright, shiny and very pliable. I suspect they might be silicone-encased, as PVC of this age has a habit of turning brittle (ask me about my late lamented Konix Navigators)
    The meter. unpacked. A clear (if small) dial, complete with mirror scale to reduce parallax error in reading. Hidden under the frosted cover is a small “Made in Korea” mark
    Handy-dandy fold-out carrying handle that also doubles as a stand
    Inside the case, ancient tooling marks. The plastic is thick and seems fairly robust. The captive mounting screw was a nice touch
    A very analogue meter. Lots and lots of 1% tolerance resistors on the main board, plus a great big thumbwheel potentiometer for zero adjustment. The foam battery pad up top was as good as new
    Up and running: no auto-off battery saving mode here! The test lead jacks didn’t have the shrouding we’d expect these days, so you won’t be able to use newer probes without modifying them
    Things I Don’t Miss from Analogue Meters, #1: setting the 0 Ω point. Expect fiddliness and drift.
    The test subjects: a 3.6 V Li/SOCl₂ ½-AA NVRAM battery (new: tests at 3.68 V on an Agilent U1242B meter), a 7.5 kΩ ± 5% resistor (tests at 7.52 kΩ) and a 39 kΩ ± 10% resistor (tests at 41.3kΩ)
    Battery test: the Soltec reports 3.8 V, or within 5% of expected. This is where I really miss auto ranging
    Not so good is the 7.5 kΩ resistor: the Soltec reads just under 6 kΩ. Blame faulty zero setting from me, as it really is fiddly and I just set this up quickly.
    The 39 kΩ resistor (which is really more like 41 kΩ) indicated 34 kΩ on the Soltec. Again, my dodgy zero set is most likely to blame, but reading this little log scale isn’t the easiest

    Would I recommend the Soltec as a general purpose meter? Not really. There are more capable multimeters available for about the same price, and you don’t need to go as far as the unbelievably expensive Agilent DMM I use (or even the strictly ornamental analogue ex-Forces Bach-Simpson 635 multimeter that graces/clutters my workbench). It would need a video to show where analogue meters excel: in showing changing values and getting a rough idea of the limits. It would make a great battery tester, or — if coupled with a micro-controller with PWM or DAC ouput — part of a demo rig. If nothing else, it’s a great way to learn how to appreciate modern test gear and all it does for us.

    I’m probably going to regret this, but here’s a scan of the Soltec HM-102s manual:

    PDF link under image. I say I regret doing this, ‘cos every cheapo ebay seller of these things is now likely to download this and splat their own horrid watermarks over it, making the file huge and ugly. But the market’s gonna market, and I wouldn’t want to make a free manual inaccessible with DRM. By contrast, my watermark’s quite tasteful and doesn’t interfere with readability in any way …
    Postscript: you think I’d just throw away that expired battery pack without peeking inside? If so, allow me to call you Wrongo McWrongison of that erroneous ilk! The ‘Hipower Super’ cells weren’t looking so super: the leaked electrolyte had dried into a gritty, stinky layer. I couldn’t even find the terminals on the 9 V battery to try and test it, so grotty was the corrosion. Amazingly, the slightly-less-nasty AA cell at the front tested at 1.52 V, almost as good as it could have been in the mid-80s. Doesn’t mean it’s not going in the HHW bin with the others, though.
  • The All-Seeing Googly Eyes of Lisa Frank

    … or what you get if you video concentric RGB LED rings and put them out of focus.

    No shortage of lens flare here

  • my last one

    my last one

    my last one

    Instagram filter used: Normal

    View in Instagram ⇒

  • rainbow cables

    rainbow cables

    rainbow cables

    Instagram filter used: Lo-fi

    View in Instagram ⇒

  • Ubu Imprimatur

    Ubu Imprimatur

    Ubu Imprimatur

    Instagram filter used: Normal

    View in Instagram ⇒

  • fritzing: Generic 4×4 Keypad part

    This needs work, but I made this keypad part for Fritzing:

    Part file (zipped): Generic_4x4_Keypad.zip

    You’ll see these parts described as variations on “4×4 Matrix 16 Keypad Keyboard Module 16 Button” on ebay. They’re very simple: if you press a button (say S7), the row pins (R1-4; R2 for S7) and the column pins (C1-C4; C3 for S7) are connected. So pins R2 and C3 are connected when S7 is pressed. You can use the Arduino Keypad library to talk to these, but do remember they use up 8 I/O pins.

    It’s not internally routed in Fritzing, and you likely won’t be able to use it for any kind of schematic work, but who uses Fritzing for anything other than pretty pictures?

  • Teensy USB Keypad

    in which I finally learn about Fritzing’s wire alignment facility …

    I’ve had a couple of Teensy boards for a while, but a misunderstanding that they needed a load of of extra software installed (they need one thing, and it’s easy) had kept me away. They’ve got really impressive specs, and they’re especially easy to turn into USB devices like keyboards.

    Super-heavy CEECO keypad

    Here’s a little demo that turns a phone keypad — in my case, a ridiculously solid CEECO solid metal keypad designed for institutional use — into a simple USB keyboard. Plug it into any machine (including a Raspberry Pi) and it will be identified as a keyboard. No drivers are required.

    The code is based on the standard Arduino Keypad library basic demo. That code was meant for a different keypad, so I eventually found a configuration that worked in the Sparkfun 12 button keypad datasheet. Rather than printing characters to the serial port, I used calls to Teensy’s USB Keyboard library instead.

    The pinout is (from left to right, key side up):

    1. do not connect
    2. Column 2
    3. Row 1
    4. Column 1
    5. Row 4
    6. Column 3
    7. Row 3
    8. Row 2
    9. n/c

    There’s no reason why this wouldn’t work with those very cheap 4×4 button matrix keypads for Arduino too with only minor modifications. Those keypads use 8 data lines, and they’re arranged (I think) as rows 1-4 on pins 1-4 and columns 1-4 are pins 5-8. columns 4-1 then rows 1-4 from the top of the pin connector down:

    The Teensy USB keyboard isn’t limited to sending single characters: a single button press could trigger sending a whole string. I haven’t yet thought out any major uses for this (except “Crypto!”, which is my usual idea when I have no idea what I’m doing), but you might have better plans.

    Update, 2020-04: These keypads don’t have diodes on every key to prevent key ghosting if you press multiple keys. Despite what the Arduino Playground Keypad section might tell you, you can’t do useful multi-key/rollover detection with them.

  • SuperLanterns Last All Summer Long

    I’m Scottish. For Hallowen, it’s traditional to make lanterns out of turnips. How this was done before power tools, I’ll never know.

    In 2015, I decided to make a traditional neep (that’s Scots for turnip) lantern. Yes, I used a holesaw, and turnip goo went everywhere.

    Neep Lantern — Age: 0 days

    It looked pretty good on the day:

    Neep Lantern — Age: 1 day (Halloween)

    Unlike pumpkins, turnips last. I left it out in the front garden.

    Neep Lantern — Age: 43 days

    It went very wizened:

    Neep Lantern — Age: 124 days

    It disappeared towards the end of May 2016. This was the last time I saw it:

    Neep Lantern — Age: 203 days
  • Creating a systemd user service on your Raspberry Pi

    Flushed with success from yesterday’s post where I made my first systemd service, I got carried away and wanted to show you how to create a service that runs as a regular user.

    A fairly common question on the Raspberry Pi Forums is “How do I run a script every time I reboot?”. The traditional answer (and one I’ve given more than once) is to add a @reboot clause to your crontab. This will indeed run a command when the computer reboots, but it will run pretty early on in the boot sequence when there’s no guarantee of network or time services. So the usual remedy is a bit of a kludge:

    @reboot sleep 60 && …

    This waits a full minute after rebooting, then executes the command. Network and time services are really likely to be available, but it’s not very elegant. Cron also has some weird gotchas with PATH settings, so while it’s ubiquitous and has worked for decades, it’s not easy to get working. Systemd, however, has a much better way of doing it, and better yet, you can do it all without ever hitting sudo.

    I’ll take as a basis for this post the forum query “python and crontab”. The asker wanted to log the time when their Raspberry Pi had rebooted, but they’ve hit the usual problem that the clock didn’t have the right time when their script was triggered, so the log was useless.

    (I’m not going to do exactly what the forum poster did, but this is more a demo of a systemd user service than recreating their results.)

    First off, here’s the script to log the time to a file (saved as ~/bin/boot_time.py):

    #!/usr/bin/python3
    from time import strftime
    with open("/home/pi/logs/boot_time.txt", "a") as log:
     log.write(strftime("%d-%m-%Y,%H:%M:%S\n"))

    I’d have done this as a shell script, but the OP used Python, so why fight it?

    FUN FACT: Under most Linux flavours, if you create a bin folder in your home directory, it’s automatically added to your path. So I could just type boot_time.py and the shell would find it.
    (You might have to log out and log back in again for the shell to review your path.)

    In order to get that to run, I need to do a little housekeeping: make the script executable, and make sure the logs folder exits:

    chmod +x ~/bin/boot_time.py
    mkdir -p ~/logs

    Now we need to do the bits that pertain to systemd. First off, you must make a folder for user services:

    mkdir -p ~/.config/systemd/user

    NOTE: mkdir -p … is useful here as it makes the directory and any parent directories that don’t exist. It also doesn’t complain if any of them already exist. It’s kind of a “make sure this directory exists” command. Make friends with it.

    And here’s the service file, which I saved as ~/.config/systemd/user/boot_time_log.service:

    [Unit]
    Description=boot time log
    DefaultDependencies=no
    After=local-fs.target time-sync.target
    
    [Service]
    Type=oneshot
    ExecStart=/home/pi/bin/boot_time.py
    
    [Install]
    WantedBy=default.target

    The service file does the following (even if I’m slightly mystified by some of the headings …):

    • Unit
      • Description — a plain text name for the service. This appears in logs when it starts, stops or fails.
      • DefaultDependencies — as this service runs once at boot-up, it doesn’t need the normal systemd functions of restarting and shutting down on reboot. Most service files omit this line.
      • After — here we tell systemd what service targets must be running before this service is started. As we need to write to a file and have the right time, the local-fs.target and time-sync.target seem sensible.
    • Service
      • Type — this is run once, so it’s a oneshot rather than the usual simple service.
      • ExecStart — this is the command to run when the service is required.
    • Install
      • WantedBy — tbh no idea what this does, but if you omit it the service won’t install. Found the answer in this SE, and it works. So I guess what it does is make the service not fail …

    Finally, you enable the service with:

    systemctl --user enable boot_time_log.service

    Next time you reboot, the time will be appended to the log file ~/logs/boot_time.txt.

    Unlike most (that is, Type=simple) services, it’s perfectly fine if this one spends most of its time inactive:

    $ systemctl status --user boot_time_log.service
    ● boot_time_log.service - boot time log
     Loaded: loaded (/home/pi/.config/systemd/user/boot_time_log.service; enabled;
     Active: inactive (dead) since Sun 2017-10-22 22:17:56 EDT; 1h 5min ago
     Process: 722 ExecStart=/home/pi/bin/boot_time.py (code=exited, status=0/SUCCES
     Main PID: 722 (code=exited, status=0/SUCCESS)

    It has executed successfully, so the process doesn’t have to stick around.