Author Archives: martinjonestechnology

Windows 10 Boot Problems: error 0xc000000e

Monday morning. Arrive at the office with lots to do. Switch on the computer, and…

IMG_20190129_104214

That’s not what I wanted to see. There’s lots of advice out there on the web about fixing this problem, but it turned out not to be so straightforward.

The first step was to get hold of a bootable Windows 10 installer. That entailed installing a desktop and web browser on my office Debian Linux machine which normally runs withou a monitor. Downloading the image from Microsoft was easy enough, though it’s 4.5GB in size so takes a while. I wrote it to a USB stick (which I had to go and buy, of course) and…nothing. It turns out that the Windows 10 .iso image is only suitable for writing to a DVD, and is not a ‘hybrid’ image which can work also on a USB stick. Of course, I didn’t have any blank DVDs lying around, did I?

Luckily Linux was able to mount the .iso image so I could see the files inside it. That meant it was possible to reformat the USB stick, creating a single partition formatted FAT32, and copy the files on to it.

IMG_20190128_151537

This ran in to a problem because the main archive of Windows files, /sources/install.wim, is just over 4GB in size and thus can’t be written to a FAT32 filesystem in its entirety. I tried to fix this by formatting the stick in ExFAT or NTFS, but my PC’s motherboard (an Asus Z77-Wifi) can’t boot from those filesystems so that didn’t get anywhere. I suspect the right answer is to use UEFI boot, creating a FAT32 partition with the EFI folder on it, and a separate NTFS partition with the other files on. But I was in too much of a hurry for that and decided to just put up with a slightly truncated install.wim file.

Now I had a bootable Windows 10 recovery/install USB stick. Great! The advice from Microsoft is to use the ‘fix startup problems’ option available on the menu. So I did that, and it spent a while diagnosing, then proclaimed that it couldn’t fix my PC. Great. I tried the other options (returning to a system restore point, removing the latest updates) but they all denied that my PC had Windows 10 on it at all.

This is getting annoying. Time to break out the command line, which is probably the most useful tool in the Windows 10 recovery toolkit. The official advice from Microsoft is to do this:

bootrec /scanos
bootrec /rebuildbcd
bootrec /fixmbr
bootrec /fixboot

But the /rebuildbcd stage failed for me, with a ‘The requested system device cannot be found’ error. The next advice I found was to manually reconstruct the BCD (the Boot Configuration Data, which tells the boot process where to find the operating system) by doing:

bcdboot c:\windows

But that didn’t work either.

IMG_20190128_172005

I had to dig deeper. Luckily I’m not the only person to have had this problem. This page at screwloose.com.au explained more advanced use of bcdboot, in which it’s possible to tell the tool where the Windows installation lives, and where the System partition which holds the boot information is. I had to rummage round with diskpart to find the right drive letters, because the layout of the partitions on my drive meant that they were not the same as during normal operation. However, I came up with the following:

bcdboot e:\windows /l en-gb /s g: /f all

which worked! It completed successfully! Reboot and…the error was still there. Looking more deeply with diskpart, it turned out that the 100MB partition (drive G:) that was supposed to be the startup partition was formatted NTFS and wasn’t marked as active. The screwloose page indicates that the startup partition needs to be formatted as FAT32 and marked as active. Clearly, formatting it FAT32 deleted all the data on it, so I ran the bcdboot command again to re-create it.

Success! After a shutdown, the PC booted and came up as if nothing had happened. I’m happy that it’s working again, but it’s still a mystery how the error occurred. Something must have got corrupted, but I can’t believe that the entire contents of the startup partition got erased and replaced with an NTFS filesystem.

 

Sony WM-D6C Walkman Pro DC-DC converter repair

This story starts with the long drive from Cambridge, UK to Warsaw, Poland. I like to be able to listen to music to while away the hours in the car, and I decided to use cassettes. Why? Our car radio is faulty, so much of the time there’s hardly anything to listen to. It has a CD player, but almost all of my CDs are stored away, having long since been converted to MP3s. There’s a handy AUX IN jack, so I can plug in my smartphone. But there’s simply no way to operate a smartphone without looking at it, and I’m not taking my eyes off the road at Autobahn speed.

My solution? Cassettes! I’ve got lots of them, generally high quality recordings, which I’ve never digitised, so they’re not stored away. They’re easy to operate with one hand without looking at them, too. But the car has no cassette player. Sorry, had no cassette player. A little judicious eBay shopping got me a Sony WM-D6C Walkman Professional in immaculate condition for a somewhat lower-than-average price because it didn’t work.

IMG_20190101_132309

The WM-D6C is widely acknowledged to be one of the finest portable cassette machines ever made. It’s pocket-sized, if you have large pockets, and has sound quality and features that rival full-sized hi-fi cassette decks. It can also record, which is extremely unusual for a Walkman-format machine.

This particular example is a very late one. It doesn’t have the posh amorphous head of the original models, but the electronics are mostly easy-to-access surface-mount components rather than the gruesome bird’s nest of wire-ended parts that the early models had. I remember servicing an early one for a student radio station and it wasn’t a lot of fun. I think this one must have expired quite early in its life and been left on a shelf, because there’s no perceptible head wear and the casing is unmarked.

Putting batteries in and pressing play resulted in the ‘BATT’ LED coming on but absolutely nothing else. No clicks in the headphones, no motor whirring, nothing. Fortunately the service manual is readily available on line. ‘Supplement 4’, dated 2001, accurately describes my example.

Browsing the circuit diagram revealed one of the secrets of the WM-D6C’s excellent performance. Most Walkman-type cassette machines used a pair of ‘AA’ cells, so all the electronics had to run from just 3 volts. That’s common enough in 2018, but back in the day it was a real challenge, so the capabilities of the motor and electronics were compromised. The WM-D6C not only runs from four ‘AA’ cells, for a 6 volt supply, but does even better. Almost the first thing it does is step up that supply to about 11 volts. That rail then runs nearly everything, including the motor and audio circuits. A nice generous supply voltage is a good start for getting top performance, especially with 1980s-era technology.

A quick prod with the multimeter revealed the problem. This boosted supply was entirely absent. Seeing as how it powers most of the machine, that would explain the lack of results. The supply rail comes from a much-feared component, the DC-DC converter (CP304). Inscrutable in its little screening can, labelled ‘SONY’ on the right hand side of the picture of the Walkman’s entrails below, it’s often considered unrepairable.

IMG_20181002_151808

The service manual includes a somewhat misleading diagram of its innards. I think the diagram is actually back-to-front, showing the output and input swapped, because that’s the only way it makes sense. The NPN transistor makes a boost converter in a variation on the classic ‘joule thief‘ circuit, and the PNP one with works with the zener diode to regulate the output by depriving the switching transistor of bias if the output voltage rises too high.

WM-D6C DC-DC converter

The converter wasn’t too hard to remove and dismantle, given reasonable desoldering tools and a powerful iron to unsolder the can. Here’s what’s inside. There are components on both sides of the board, and a certain amount of grey silicone which is easy enough to peel off. Back in the 1980s this would have seemed intimidating in its compactness, but it’s easy to work on given modern tools.

Finding the fault was a case of looking for the ‘usual suspects’: there were two tantalum bead capacitors sitting there looking guilty.  The one on the input was short-circuit, which had killed off the 22uH inductor connected to pin 3, the large green component on the right.

I replaced the faulty components, using a higher-voltage-rated tantalum and a ceramic chip in parallel to replace the capacitor, and a surface-mount inductor with bits of wire soldered on to it. The values aren’t very critical and I just used what happened to be lying around. A quick test, giving it 6V from a bench power supply, revealed a healthy 11V or so at the output.

After reinstalling the converter and reassembling the machine (watch out for the little ‘speed tune on/off’ knob at the back) it worked! It shows signs of having had attention from the phantom twiddler. The head azimuth adjustment screw was tightened up, but good quality sound returned when it was properly adjusted. The peak level meter seems rather unenthusiastic so may need adjustment, and I haven’t checked the recording bias yet. There’s also a forest of little surface-mount electrolytics waiting to dribble corrosive ooze all over the PCB, but that’s a job for the long winter evenings. For now, it’s working. Being able to play cassettes has turned out to be unexpectedly useful. We rediscovered a tape of nursery rhymes from Domowe przedszkole, a classic Polish children’s TV programme, which granted us peace on a long trip recently!

Fixing printing from Quicken 2002 under Windows 10

It’s admission time. I still run the financial side of my business on Quicken 2002 and yes, it really is 16 years old. It does what I need and is reliable. Over the years I’ve developed various handy Python scripts for manipulating its QIF file format (more about those another time) so I’m quite invested in it. Quicken apparently stopped support in the UK in 2005 but I didn’t notice. Unfortunately this means that upgrading to a newer version is next to impossible, so this one just soldiers on. One day I’m sure I’ll be forced to get hip with the kids and let my accounts float off in to the cloud, but I’m not looking forward to it.

q201819111

At the end of last week, Quicken 2002 blotted its copy book by refusing to print invoices any more. This would have a detrimental effect on my business’s turnover, so it needed fixing. It wouldn’t even show the setup dialog any more. It was tricky to sort out, so I’m noting it here in case anyone else has this problem.

I was all ready to blame the problem on last week’s Windows 10 update, but a bit of digging on the web revealed that such problems can be caused by the WPR.INI file. This link: https://www.quicken.com/support/printer-setup-window-wont-open indicates that it should live in C:\ProgramData\Intuit\Quicken\Config, but my system doesn’t have that folder. There were WPR.DAT and WPR.INI files in C:\Program Files (x86)\QUICKENW but moving, renaming or deleting them had precisely no effect at all.

To find the instances of the file that Quicken was actually using, I brought the very handy Process Monitor in to action. This tool lets you see all the file and registry accesses being performed by a process. Setting a filter for the process named “QW.EXE” and then watching the log while I opened the print setup dialog box caught it red-handed.

q201819112

The file was actually in C:\Users\cmj\AppData\Local\VirtualStore\Program Files (x86)\QUICKENW\WPR.DAT. Why didn’t I guess?

q201819113

The file was nearly quarter of a megabyte in size, which seems awfully large for some printer settings. After taking a backup copy, I deleted it and re-ran Quicken. Joy! The printer setup dialog box opened again and I was able to select a printer and thence print invoices. The creaky old application lives to account for another day.

Quick-and-dirty partition resize with Acronis True Image

A little embedded Linux magic comes in unexpectedly handy. Years ago, I started using Acronis True Image to back up my office PC. Other backup packages are available, as they say, but it’s worked well enough for me. This week I had reason to use it in earnest.

img_20180619_112420

The PC is set up with two main partitions on the disk. There’s one for the operating system (Windows 10) and applications, and another with data on it, analogous to the /home partition on a Linux system. Inevitably, it turned out that the boundary between these partitions was in the wrong place. The operating system partition was full, and things were starting to fail. Time to make sure the backup is up-to-date and then to restore to differently-sized partitions.

The operation fell at the first hurdle. Acronis True Image will create a ‘recovery’ USB stick from which the PC boots. This contains a small Linux distribution (Acronis Linux) and a GUI for managing the recovery operation. My backups are on a network drive, which happens to be an Apple Time Capsule. Would the Acronis recovery system connect to the Time Capsule? Would it ever. I couldn’t even persuade it to ask for the username and password, though it could see the Time Capsule on the network.

In Acronis Linux, pressing ctrl-alt-F2 in time-honoured fashion brings up a command line. Yay! Power! A bit of digging reveals a command called asamba which can connect to SMB shares. Using that, I could connect to the Time Capsule absolutely fine and mount it to the local filesystem. So why couldn’t the GUI do it? Annoying.

My next trick was to copy the backup from the Time Capsule to a USB hard drive using another Linux PC. It took a while for the several hundred gigabytes, but it got there. Acronis recovery will read USB drives, so the next step should be easy, right? No. My USB drive happened to be formatted ext4. Though Acronis Linux is perfectly capable of mounting ext4 filesystems, the recovery GUI only acknowledges the presence of FAT and NTFS discs. Aargh!

The solution was to mount the USB drive on my Linux PC, then share it using Samba. Acronis recovery found and let me log on to the Samba share, and could thus see the drive and backups.

Changing the partition sizes was the next problem. The GUI only allows you to shrink partitions or to grow them in to free space. My disk didn’t have any free space. It was all partitioned and in use. I thought that shrinking the data partition would create free space that the operating system partition could grow in to, but I was caught out by the presence of a 500MB ‘recovery’ partition which Windows had sneaked in between the two. I don’t know what it’s for but I didn’t feel like taking the risk of destroying it. There are no tools in the Acronis GUI for deleting partitions and starting again, so I was stuck.

img_20180619_113338

Command line to the rescue! Ctrl-alt-F2 again, and there’s a perfectly good copy of fdisk available. It was a moment’s work to delete the existing recovery and data partitions, then ctrl-alt-F1 to the GUI. Restart the restore process and there’s free space available for the operating system partition to grow in to, and plenty of room to create new recovery and data partitions.

img_20180619_112939

The restore took a few hours, as expected, but was successful. The only wrinkle was that Acronis recovery had marked the recovery partition as active rather than the boot partition, so the PC complained that there was no operating system. Another trip in to fdisk to mark the boot partition active sorted that out, and now I’m typing this very text on the PC restored to working order.

Footnote: there is another Acronis restore tool intended for restoring backups to dissimilar hardware. This may have handled the partition resizing more elegantly, but I didn’t try it.

Good accuracy from a low cost Real Time Clock

One product I work on has a built-in data logger. This helps us a lot if a problem occurs: we can see the history of any faults. Every log entry is time stamped, which is important. We need to know when it’s been used and how often. However, good timekeeping is a challenge. The product has no Internet connection, it gets stored and moved around a lot, and it’s nobody’s job to check or adjust its clock, so there’s a real problem with clock accuracy.

The real time clock is based on the Microchip MCP7940N chip. The chip uses a standard 32.768kHz crystal for its timekeeping. These crystals are fickle beasts, partly because of the very low-power oscillator in the chip. The oscillator frequency, which is critical for accurate timekeeping, is very dependent on the load capacitance, which itself can vary with different builds of the PCB. The heat of soldering during manufacture also affects the crystal. I’ve seen plenty which have failed altogether, and others whose frequency has shifted significantly. Note the soldering on the crystal’s load capacitors C9 and C10 in the photo below, part of an attempt to find the optimum load capacitance on a prototype board.

img_20180530_100756

All of these issues mean that just assembling the PCB and hoping for the best doesn’t work well. The frequency of an apparently working crystal can be anything up to 100ppm (parts per million) wrong. That doesn’t sound like much, but it works out to nearly an hour’s error per year, which is pretty bad.

Fortunately the MCP7940N has a neat feature which helps a lot. One of its registers, called CAL, holds a value which speeds up or slows down the clock by a small amount, like the regulator on a mechanical clock. But how do we know what the error is, and whether it’s been successfully corrected?

The MCP7940N also has a pin which can output a 1Hz square wave derived from the oscillator. With a sufficiently accurate timer, it’s possible to measure the error in the crystal’s frequency this way.

Checking the correction is more difficult. Because the chip only works on whole oscillator clock cycles, it does the adjustment to the clock’s speed by adding or removing a few clock cycles each minute. It’s therefore necessary to measure the period of exactly 60 of the chip’s seconds to find out how long its minute is, and therefore how accurate the whole clock is.

Getting a sufficiently accurate timer is the first problem. My aim was to get the MCP7940N to be accurate to within 1ppm, or about 30 seconds per year. A useful rule of thumb in metrology is that the measuring instrument needs to be ten times more precise that the quantity being measured, so we need a timer accurate to 0.1ppm, or one part in ten million. To the rescue comes my trusty Hewlett Packard 5335A universal counter. It’s an oldie but a goodie. Mine is fitted with the optional oven-controlled crystal oscillator, an HP 10544A. I checked it and set it up against a Rubidium frequency standard about 8 years ago and it hasn’t been touched since. I checked it this month against the same frequency standard, and it still agrees to within 0.1ppm. Not bad, and certainly good enough for this job.

Measuring the initial clock error is easy enough: connect the counter to the MCP7940N’s 1Hz output and look at the error. The 5335A counter has handy built-in maths functions to make this easier, so it will directly display the difference between its idea of a second and the chip’s attempt.

To measure the corrected clock output over a minute needs a bit more trickery. The 5335A counter has an external ‘arm’ input, and can average a period reading over the length of the ‘arm’ signal. All that’s needed is to arm the counter for 60 seconds and the counter will do the rest. I couldn’t find a way to make the counter do this for itself, so I cheated and used a spare Arduino mini that happened to be lying around. All it had to do was wait for a clock pulse on a GPIO pin, take another GPIO pin high to arm the counter, count 60 clock pulses, then take the arm signal low. Simple.

The test setup looked like this. The scope is there for ease of probing (note the cable from its ‘sig out’ connector to the counter) and it also includes a Tektronix 7D15 timer/counter module connected to the chip’s output. The 7D15 is a lot less accurate (about 1ppm) than the 5335A but it’s good enough to give an idea of what correction is required. The Arduino mini is just about visible at the bottom of the photo.

img_20180427_171833

Here’s a closeup of the scope screen, showing the measured period of the clock’s 1Hz output, 999.9818ms. That’s just over 18ppm too fast.

img_20180427_171723

This the setup screen of the product, showing the 18ppm correction applied to the MCP7940N’s CAL register.

img_20180427_171715

Finally the error in the measured minute, calculated by the 5335A counter gated by the Arduino.

img_20180427_171823

It’s showing that the corrected minute is 301.3 parts per billion, so 0.3ppm, too fast. That’s as good as it’s going to get – about 10 seconds per year. With the clock set up using this process, it has a fighting chance of staying accurate in the real world.

Hacking child barriers

This post contains no electronics or software, just woodwork.

Our house is full of traps for the inquisitive toddler. There’s cat food and litter, an office full of sharp tools, a fireplace, and most tricky of all, a staircase descending from the corner of the living room guarded only by a coffee-table-height shelf.

Fortunately, there is a handy range of wooden barriers available from various sellers on allegro.pl (search for ‘bramka’ or ‘barierka’ to get started). It’s a sort of modular barrier system, with a basic unit 91cm wide, though other widths are available. The sections screw together with plastic couplings that allow them to hinge. Wall mounting brackets and feet are available, as are sections with a child-proof gate built in. They’re cheap and simple enough that hacking them for specific jobs is easy and worthwhile.

Here’s a set across the end of the living room, protecting the fireplace and cat flap to the garden. These are almost freestanding, but tied to the bannisters at one end with string and blu-tacked to the floor by the window.

IMG_20180311_144905.jpg

The steps up to the office are guarded by these two sections. I added the cat flap in one of them so that the cats can get to their food and litter tray.

IMG_20180318_152052.jpg

The stairs down from the living room are guarded by another hacked set of barriers, cut to length and with an aperture provided for our eldest son’s favourite bookshelves.

IMG_20180311_144822.jpg

I used the leftover upper and lower rails from the segment I’d cut down in length to make a rail to hold the ends of the uprights above the bookshelves. There’s a join in the middle done with one of the plastic hinge pieces and a not inconsiderable amount of wood glue.

The barrier is held up using zip ties through plastic corner blocks screwed to the underside of the wooden shelf top, so the screw holes won’t show when we eventually remove it. Felt pads on its feet stop it scratching the wooden floor.

RIAA phono preamp for Tascam M-1B Line Mixer

In the workshop I have a couple of these Tascam M-1B line mixers. They’re a very useful box: they have eight inputs, each with a level control and pan pot, which are mixed together and fed into a master volume control. There’s also a pair of headphone outputs with their own volume control driven by a headphone amplifier with enough voltage swing to drive 600 ohm headphones properly. Into the mixer I typically feed the sound output of my PC, other audio sources such as a cassette player (yes!), and a spare cable lying around on the workbench ready to connect to whatever I’m working on, or my phone. The output is connected to the workshop speakers. With this setup I can hear all the sources at once without fiddling around, switching anything or unplugging anything.

IMG_0608.jpg

Tascam M-1B Line Mixer

The workshop I set up a couple of years ago turned out to have space for a new audio source: a turntable. Great! I can listen to vinyl (not ‘vinyls’, please). I had a spare turntable on the shelf, so I put it in place. The trouble is, the turntable has a magnetic cartridge which can’t be connected straight to the line inputs on my trusty mixer. It needed amplification and RIAA equalisation. I could have just gone and bought an off-the-shelf preamplifier, but where’s the fun in that? Looking at the back of the Tascam mixer, there’s a blanking plate which looks perfect for adding a preamplifier, neatly built in. No worries about trailing cables or yet another power supply to plug in. Now to find a suitable circuit.

IMG_0609.jpg

A quick web search pulled up an application note from National Semiconductor for their LM833 audio op-amp which shows a simple preamplifier circuit. It then goes on to describes the circuit’s deficiencies and how a two-stage design can improve on it, but I decided to stick with the simple version.

I didn’t have any LM833 op-amps in the spares box, but did have some NE5532s, which are not only an excellent audio op-amp but live two to a package. Finding the passive components in the spares box also proved to be a challenge. Getting the right component values is one thing, but finding two identical ones of each proved to be impossible. However, all was not lost, so I thought. The RIAA equalisation curve needs three time constants, of 75µs, 318µs and 3180µs. I found pairs of resistors and capacitors that gave the same time constants as R1C1 and R2C2 even if their values weren’t what the original design specified. Here’s a circuit diagram with my substitutions marked in red.

riaa-schematic-modded

I built up a small piece of matrix board and tried it out. It worked, but didn’t sound quite right: there was a noticeable lack of bass. I decided to check the frequency response. The application note shows a useful table of the RIAA response at various spot frequencies, so I had something to compare my results with. I used the ARTA STEPS program with a PC sound card to measure the frequency response of my circuit. It took a bit of fiddling with the levels to get good results, since the phono preamplifier has a lot of gain, but the result looked like this.

response-first-attempt

The curve looks convincingly like the RIAA curve, but it should be +17dB at 50Hz (relative to 1kHz). In fact it’s more like +13dB in my version, so I’ve lost 4dB of bass. At the other end of the spectrum it’s more accurate: at 20kHz it’s at almost exactly -20dB as it should be. (Note, when taking readings from the plot, that the level at 1kHz is about -3dB. It’s the relative levels that are important).

What I’d neglected in my component value calculations was that the relative values of the two RC networks are also important. The National Semiconductor application note actually goes on to explain more about this, but I hadn’t read any further than the circuit diagram. Rather than delving in to the maths and risking discovering that I needed more components I didn’t have, I started playing with the values I actually did have. Here’s a plot of the before-and-after empirical results.

response-first-and-second-attempt

The green curve is the modified version. The level at 50Hz is now +17dB relative to the level at 1kHz, as it should be. Below 50Hz there’s a bit of a rolloff, but that’s not something I’m worried about – my speakers don’t go down that low and it makes for a useful rumble filter. The modified circuit is shown here.

riaa-schematic-modded-v2

I had to change both RC networks to get a good result. The time constant of one of them (11k/6n8) is still 75µs, but the other (180k/22n) is more like 4000µs than 3180µs. I suspect it’s interacting with the time constant of R0C0 to give roughly the right result.

IMG_0616.jpg

It fits neatly in to the slot in the back panel of the mixer. The toggle switch connects the output of the preamplifier to inputs 1 and 2. Switching it off leaves those inputs available for normal line-level use if desired. There’s also an earth terminal.

IMG_0617.jpg

Time for some testing. What were the skies like when you were young?

IMG_0621.jpg

The Euroquadruped, or the solution to wall wart Tetris

Having relocated from the UK to Poland, the change in mains plugs has never quite been resolved. All the equipment that came from the UK has 13A plugs on it, and all the local sockets are the CEE 7/5 type. Then there are locally-acquired bits and pieces  which generally have two-pin Europlugs. No matter how many adapter cables and extension leads I make, or change the plug or socket on, there’s always something that doesn’t fit, or won’t reach the nearest compatible socket.

Of particular annoyance are various chargers and wall warts. They’re all bigger than a standard Europlug, and there’s no standard for which way the ‘lump’ of the charger will be attached, so connecting several of them in to a multi-socket extension lead doesn’t work well. Often one charger will obscure one or more sockets in such a way that all the things you need just won’t fit, or the whole assembly becomes so big and unwieldy that things start falling out under their own weight.

It is therefore with some relief that I announce the debut of the Euroquadraped: one 13A plug with short cables to four Europlug sockets. It reminded me of an octopus but only has four ‘legs’, hence the name.

IMG_20180211_221335.jpg

Getting all four cables in to the 13A plug was a bit fiddly, but choosing a roomy plug helped. The little Europlug sockets are neat. I’ve only seen them here in Poland. The finger ring to discourage pulling on the cable is a nice touch, and doubles as a cord grip internally. They even (finally) have safety shutters on the socket holes, roughly 60 years after shutters became standard on the British 13A socket…

The great advantage of this thing is that each socket is independent of the others and can find its own equilibrium with whatever electrical carbuncle is plugged in to it.

IMG_20180211_221527.jpg

It’s trivially simple, but it’s going to save a lot of frustration in the workshop.

Canon S100 Shutter Button Fix

This is my Canon S100 digital camera. After long, somewhat arduous service, the shutter button started playing up: it would focus but not take the photo. Eventually I got a mobile phone with a better camera and quietly forgot about the Canon. The S100 has been extensively frozen, boiled, soaked, rattled and trodden on, so I figured that the shutter button problem was just due to the abuse. It doesn’t owe me anything. However, it’s still useful for some things the phone camera won’t do: it fits a tripod, and has good long exposure and manual control facilities including a handy neutral density filter.

IMG_20180204_165606.jpg

Trying to use it to take some tricky oscilloscope photos the other day, the shutter button got really annoying. I searched on line for the problem and discovered that it’s quite common. That sounded like an interesting problem to me. Here’s my attempt at fixing it.

Before we start, don’t try this unless you’re used to dealing with annoyingly tiny things and have the tools to match: jeweller’s screwdrivers, tweezers, a very fine soldering iron and either amazing close-up vision or a good magnifier.

The camera comes apart surprisingly easily. There are six little black screws on the outside: two on each end and two on the bottom, close to the tripod mount. Take those screws out. The back comes off very easily – take care not to lose any of the buttons though.

IMG_20180204_165751.jpg

The front also comes off easily, though there’s a little FFC connector to the setting ring round the lens. Unplug it carefully. It doesn’t have a locking bar so the flex PCB just pushes in and out. There’s also a foam gasket round the lens and the plastic cover for the HDMI and USB sockets. They’ll fall on the floor.

IMG_20180204_165854.jpg

The shutter button and other controls are underneath the top cover. There are two more screws to remove: one on the front near the lens and one on one end. They’re different lengths so take note of where each came from. Before removing the top, there’s one more FFC to unplug. This one connects to the microphones. Again it has no locking bar so just pull gently. It’s the middle of the three FFCs in this photo.

IMG_20180204_170148.jpg

With the top cover off, the controls themselves are revealed. On the left here, the function selector rotary switch, then the shutter button and zoom switch, then the power button, and on the right the big square thing is the GPS antenna.

IMG_20180204_170233.jpg

If you put the battery back in, the camera actually works fine in this dismantled state, so it’s easy to try experiments. I prodded and poked the shutter button. Sometimes it worked, sometimes it didn’t. I doused the button with my favourite contact cleaner (DeoxIT D5) to no avail. I looked on the web for replacement buttons: “double action tactile switch” seemed to be the best thing to search for. There are lots out there which might fit, but they’d take a while to get hold of and would be really fiddly to solder, especially with the zoom switch so close by.

I wondered about a mechanical solution, extending the plastic rod from the outside shutter button that presses the switch to give it more poke, but sometimes the switch just refused to work no matter how hard I prodded it with a screwdriver, so that probably wasn’t worthwhile.

Given that it wasn’t worth spending a lot of time on what’s effectively a life-expired camera, an alternative engineering solution was called for. The first stage of the shutter button, the half-press to lock the focus and exposure, still works reliably. What if I just wired it in parallel with the shutter release contact? Then there would be no way to lock the exposure and focus, but at least the camera would take photos.

Some fiddly soldering with a fine iron bit and some polyurethane-insulated mod wire later, the two opposite corner contacts on the button are connected…

IMG_20180204_172823.jpg

…and the S100 lives again. It’s not a full fix, call it a workaround, hack or bodge, but it’s good enough for me to take pictures. Oh yes, and assembly, as somebody once said, is the reverse of disassembly.

Garage door opener life extension

This little thing is really annoying. It’s the remote control for our electric garage door, and I use it several times a day to get my bike in and out. Luxury, pure luxury. Or it would be, if it worked properly. The trouble is that about half the time after pressing the button, it locks up, stuck either on, with its little red LED lit, or off, so it won’t open or close the door, and drains the battery. The only way to fix it is to pull it apart, take out the battery, and put it back in without losing any of the bits of plastic. You can imagine how much fun that is with gloves on, in the rain, when you’re in a hurry. Yeah, yeah, first world problems, I know. But there doesn’t seem to be any way of opening our garage door manually, which is a nuisance.

IMG_20171215_155448.jpg

Inside is a little PCB containing a PIC12F635 microcontroller and a simple 433MHz transmitter circuit using a couple of transistors and a resonator. I did all the obvious things: replace the battery, clean the board with solvent, all of that. Nothing helped. It seems there’s a bug in the PIC’s software which makes it prone to locking up. The switch under the button is rather worn and thus suffers from contact bounce, and I think that’s what’s upsetting it.

I tried filtering the signal from the button to the PIC with an RC network. That didn’t help: the PIC didn’t even respond to the button any more. Presumably it needs a fairly quick risetime to trigger an interrupt, or something similar.

There is a second button which is less worn. It transmits a different code which doesn’t seem to do anything on our garage door, but it never crashes the PIC. I considered swapping the switches over, but they’re surface-mount and glued down, and the chances of removing both of them and successfully soldering them down again undamaged were slim.

I wondered about rewiring the PCB so that the input to the PIC is always active, and the button just switches the power to the PIC. A quick test by adding a blob of solder and removing and reconnecting the battery showed that wasn’t going to work: the PIC just didn’t transmit. It needed to have the power applied and then have the button activated.

There was another issue to address. The button, when it worked, was prone to getting pressed by accident as the bunch of keys rattled around in my pocket. That led to the garage door opening itself at odd times, which wasn’t great for the security of our bikes. Somehow modifying it to be less prone to accidental operation would be nice. 

Design changes were called for. Since the second button is redundant, I decided to convert it in to a power switch, so it has to be held down while the real button is pressed, and releasing it will guarantee that the power is cut from the PIC so it can’t remain locked up. I cut the power track to the PIC and took advantage of the PCB layout to add a P-channel MOSFET in series with it, then cut the track from the second button to the PIC’s input and wired it to the MOSFET’s gate. The buttons both have one terminal to battery negative. A pullup resistor between gate and source completes the circuit.

IMG_20171215_155001.jpg

Here’s the modified board. You can see the remnants of some of my previous repair attempts, and the extra MOSFET and pullup resistor at top right. Now, to open or shut the door, I have to hold down the button on the right and press the left button, rather like using a shift key on a keyboard.

It seems to work reliably now, so leaving the house and returning are considerably quicker and less stressful. 

Incidentally, I did the repairs and modifications in the office, which is several miles away from the offending garage door. To check that the remote was actually transmitting properly, I used my Tektronix 7912AD programmable digitizer with 7A29 vertical plugin. Originally intended for high-speed laser and nuclear physics research, it’s kind of overkill for testing a garage door opener, but its 700MHz bandwidth is plenty fast enough to get a clear picture of the transmission using just a loop of wire connected to the input. Analogue technology at its very finest. Here’s its TV output connected to a little LCD monitor showing the 433MHz signal from the remote.

IMG_20170814_130325.jpg