<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Essential scrap</title>
<link>http://essentialscrap.com/</link>
<description>All articles on http://essentialscrap.com/.</description>
<atom:link href="http://essentialscrap.com/rss.xml" type="application/rss+xml" rel="self" />
<image>
    <url>http://essentialscrap.com/rsslogo.png</url>
    <link>http://essentialscrap.com/</link>
    <title>Essential scrap</title>
</image>
<item>
    <title>Book binding press</title>
    <link>http://essentialscrap.com/bookbindingpress/index.html</link>
    <guid>http://essentialscrap.com/bookbindingpress/index.html</guid>
    <description>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;div id="content">
    &lt;h1 id="articletitle">Book binding press&lt;/h1>
    &lt;div>
        &lt;a href="http://essentialscrap.com/bookbindingpress/complete.jpg">
            &lt;img src="http://essentialscrap.com/bookbindingpress/complete-thumb.jpg" class="marginimg" title="Completed book binding press" />
        &lt;/a>
        &lt;a href="http://essentialscrap.com/bookbindingpress/box_open.jpg">
            &lt;img src="http://essentialscrap.com/bookbindingpress/box_open-thumb.jpg" class="marginimg" title="Small toolbox fits between the top rails." />
        &lt;/a>
&lt;p>This bookbinding press combines many functions into single, compact device.
My aim was to make something that doesn't take too much space to store, but is sturdy and useful.
&lt;/p>
&lt;p>Most DIY bookbinding press designs consist of two plywood sheets and four threaded rods.
This is simple to make and likely works well, though I expect it is somewhat slow to use because of the four screws with low pitch.
Fancier versions usually have one central screw, often with a trapezoidal thread.
Sometimes separate plywood boards are placed in between the press for specific tasks, such as forming the book back.
&lt;/p>
&lt;p>I wanted my design to be low profile for easy storage, preferrably so that other stuff can be stacked on top of it.
I also felt that there is no reason not to integrate other functionality, such as hole punch guide, in the same device.
&lt;/p>
&lt;h2>Design&lt;/h2>
&lt;p>I've wanted to make wooden threads for a while now, and this was an excellent opportunity.
I made a split thread design, where the clamps engage with side threads but permit free movement in their fully open position.
This allows quickly moving the pressing board to the correct height and then tightening to press it down.
Split threads do not provide lateral positioning, so a vertical brass strip is added to keep the boards aligned.
&lt;/p>
&lt;img src="http://essentialscrap.com/bookbindingpress/bookbindingpress.png" class="centerimg" title="Main design features" />
&lt;p>Choice of the thread pitch is a compromise between wood strength and adjustment range.
I estimated that 10 mm thread pitch would be reasonably strong.
To allow positioning the platform at any height, I needed the thread to move by 15 mm within the 90° rotation of the clamp.
That way there are always two possible thread positions for any book thickness.
I calculated that with typical human hand grip strength, the clamps would provide 50 kg of compression each.
&lt;/p>
&lt;p>One edge of the boards contains pockets where a long brass strip can be inserted for pressing the shoulder ("french groove") in the spine of the book.
The top board also has holes every 10 mm to act as a guide when punching holes for sewing thread.
&lt;/p>
&lt;p>On the opposite edge, the bottom board extends further than the top board.
This side is useful for trimming page edges with a knife, where the bottom board provides support for the pages being cut.
The side rails are square and the press can be oriented vertically for working on the spine of the book.
&lt;/p>
&lt;h2>Build&lt;/h2>
        &lt;a href="http://essentialscrap.com/bookbindingpress/surfaces.jpg">
            &lt;img src="http://essentialscrap.com/bookbindingpress/surfaces-thumb.jpg" class="marginimg" title="Pressing surfaces are made of birch plywood, finished with beeswax." />
        &lt;/a>
        &lt;a href="http://essentialscrap.com/bookbindingpress/threads.jpg">
            &lt;img src="http://essentialscrap.com/bookbindingpress/threads-thumb.jpg" class="marginimg" title="Split threads on the clamps permit free movement when fully open." />
        &lt;/a>
        &lt;a href="http://essentialscrap.com/bookbindingpress/clamps.jpg">
            &lt;img src="http://essentialscrap.com/bookbindingpress/clamps-thumb.jpg" class="marginimg" title="The clamps needed some sandpaper glued to them to provide enough friction." />
        &lt;/a>
        &lt;a href="http://essentialscrap.com/bookbindingpress/holeguide.jpg">
            &lt;img src="http://essentialscrap.com/bookbindingpress/holeguide-thumb.jpg" class="marginimg" title="Holes every 10 mm make it easy to punch holes into signatures." />
        &lt;/a>
        &lt;a href="http://essentialscrap.com/bookbindingpress/trimming.jpg">
            &lt;img src="http://essentialscrap.com/bookbindingpress/trimming-thumb.jpg" class="marginimg" title="Offset edge provides support when trimming page edges." />
        &lt;/a>
        &lt;a href="http://essentialscrap.com/bookbindingpress/shoulder.jpg">
            &lt;img src="http://essentialscrap.com/bookbindingpress/shoulder-thumb.jpg" class="marginimg" title="Removable brass strips can be used for forming the shoulder of the book." />
        &lt;/a>
&lt;p>Material choices:&lt;/p>
&lt;ul>
&lt;li>&lt;b>Top board:&lt;/b> 15 mm birch plywood, with 25 mm birch edge strips&lt;/li>
&lt;li>&lt;b>Bottom board:&lt;/b> 30 mm birch plywood (two 15 mm sheets glued together)&lt;/li>
&lt;li>&lt;b>End rails:&lt;/b> birch&lt;/li>
&lt;li>&lt;b>Clamps:&lt;/b> unknown hardwood, chosen for strength and darker color&lt;/li>
&lt;/ul>
&lt;p>I cut the threads on a CNC router, using 2 mm endmill.
Some sanding was needed afterwards to smooth them out.
The design is oriented so that wood grain supports the threads well.
The end rails of the bottom board are further supported by long screws driven in from the bottom, which reinforce it against the vertical pull force.
&lt;/p>
&lt;p>Rest of the build is basic woodworking.
&lt;/p>
&lt;p>
I applied edge strips to all plywood edges for aesthetics, though some of them also add to the strength of the build.
The 30 mm bottom board is probably overkill, but I calculated that with 200 kg of total compression a single 15 mm plywood sheet would deflect by almost a millimeter.
The top board has extra support provided by the edge rails.
For reduced weight, it would have been possible to put wider edge rails on the bottom board and leave the bottom hollow, but on the other hand the weight provides stability in use.
&lt;/p>
&lt;p>
All surfaces were finished with a beeswax and paraffin oil mix.
This provides some protection against glue sticking to it, while being durable against wear on the sliding surfaces.
I had calculated that the screw pitch would result in a self-locking thread, but I neglected to consider how much a wax finish would reduce the friction.
To fix this, I hid some sandpaper under each clamp, which provides friction proportional to the clamping force.
Small magnets help hold the clamps fully open when lifting the board.
&lt;/p>
&lt;p>To accompany the press, I made a small toolbox for various bookbinding tools.
The knife is made of an old hand saw and sharpened so that one side is flat, to cut flush to the edge.
The awl is made of a bicycle spoke.
&lt;/p>
&lt;h2 class="noskip">Results&lt;/h2>
&lt;p>The end result feels very sturdy. The hole punch and trimming functions in particular work very well.&lt;/p>
&lt;p>The clamps are a bit cumbersome to get started, as you need to get all four clamps started on the thread before you can start tightening them.
It's probably still faster to do than screwing down 4 regular nuts would be.
The maximum book thickness is limited to about 4 cm. Making the end rails taller would extend this height.
&lt;/p>
&lt;p>I don't have a scale suitable for measuring the clamping force. I made an attempt to estimate it by measuring the pressure in a bicycle inner tube, which gave 0.6 bar pressure for 1 meter × 4 cm contact area. This puts the force at about the same as my design calculations, around 200 kg.&lt;/p>
&lt;p>I made this as a gift to my wife. She binds her own watercolor sketch books to have a wider choice of paper type used.
Apparently it is also significantly cheaper to buy the paper in bulk instead of prebound books.
Her initial comments of the press have been positive, which I have to trust as I have zero bookbinding experience myself :)&lt;/p>
&lt;p>The FreeCAD / Ondsel design file is 
        &lt;a href="http://essentialscrap.com/bookbindingpress/bookbindingpress.FCStd">available here&lt;/a>
    . It has the basic design correct, but some dimensions and details may be a bit off, as I didn't really look at the drawings that much when building.&lt;/p>
&lt;/div>
    &lt;p class="signature">– Petteri Aimonen on 4.9.2024&lt;/p>
    &lt;p class="commentcount">
        &lt;a href="http://essentialscrap.com/comments/bookbindingpress/">
        Comment on this page
        &lt;!--#config errmsg="" -->
        &lt;!--#include virtual="/comments/${DOCUMENT_URI}?cmd=count" -->
        &lt;/a>
    &lt;/p>&lt;/div></description>
    <pubDate>Wed, 04 Sep 2024 00:00:00 +0000</pubDate>
</item><item>
    <title>Repairing stripped internal gear</title>
    <link>http://essentialscrap.com/gyrodriver/index.html</link>
    <guid>http://essentialscrap.com/gyrodriver/index.html</guid>
    <description>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;div id="content">
    &lt;h1 id="articletitle">Repairing stripped internal gear&lt;/h1>
    &lt;div>
        &lt;a href="http://essentialscrap.com/gyrodriver/gyrodriver.jpg">
            &lt;img src="http://essentialscrap.com/gyrodriver/gyrodriver-thumb.jpg" class="marginimg" title="Black &amp;amp; Decker Gyro Driver" />
        &lt;/a>
&lt;p>After a decade of hard use, a plastic gear in my Black &amp;amp; Decker Gyro Driver screwdriver gave up.
I really like the small form factor and precise control, but the model is no longer manufactured.
Therefore I set out to repair the one I have.
&lt;/p>
&lt;h2 class="noskip">What is a gyro driver?&lt;/h2>
&lt;p>Gyroscopic screwdrivers only have a single push button.
Rotation direction and torque is controlled by turning it.
Turn it clockwise and it spins that way, turn a bit further and it spins faster.
&lt;/p>
&lt;p>I find this works great in practice and makes it easy to control the torque precisely.
The Black &amp;amp; Decker one also has a clutch on the output, making it possible to apply even more torque by hand for final tightening.
&lt;/p>
&lt;p>There is a good teardown of the device on 
        &lt;a href="https://www.youtube.com/watch?v=YocXYbjXaX8">YouTube channel Daft Old Man&lt;/a>
    .&lt;/p>
&lt;h2>Stripped gear&lt;/h2>
        &lt;a href="http://essentialscrap.com/gyrodriver/stripped_gear.jpg">
            &lt;img src="http://essentialscrap.com/gyrodriver/stripped_gear-thumb.jpg" class="marginimg" title="Stripped middle gear level" />
        &lt;/a>
&lt;p>The motor has two sets of planetary reduction gears, which share a common ring gear made in plastic.
The high torque set had stripped the teeth off its section in the ring gear.&lt;/p>
&lt;p>The low torque set uses plastic gears as the planets, but the sun gear on the motor is made of metal.
In the high torque set both sun gear and planets are made of metal, but the ring gear is plastic.
It seems reasonable to use metal for a more durable replacement.&lt;/p>
&lt;p>However, I don't have machinery needed to directly manufacture inner gears in any material.&lt;/p>
&lt;h2>Repair plan&lt;/h2>
        &lt;a href="http://essentialscrap.com/gyrodriver/gear_comparison.jpg">
            &lt;img src="http://essentialscrap.com/gyrodriver/gear_comparison-thumb.jpg" class="marginimg" title="Comparing gear geometry to closeup photo" />
        &lt;/a>
&lt;p>I started by measuring the gear geometry.
I did this by taking a closeup photo and comparing against gear outline generated in Inkscape.&lt;/p>
&lt;ul>
&lt;li>&lt;b>Pitch:&lt;/b> 1.5 mm&lt;/li>
&lt;li>&lt;b>Pressure angle:&lt;/b> 30°&lt;/li>
&lt;li>&lt;b>Planet gear teeth count:&lt;/b> 23&lt;/li>
&lt;li>&lt;b>Ring gear teeth count:&lt;/b> 56&lt;/li>
&lt;/ul>
&lt;p>The gears appear to have 
        &lt;a href="https://en.wikipedia.org/wiki/Involute_gear">involute gear profile&lt;/a>
    , but the pressure angle is uncommonly large at 30°.
I think it may be selected to make the plastic teeth more durable.
It makes my task easier, as the teeth are very close to being 55° triangles.
&lt;/p>
        &lt;a href="http://essentialscrap.com/gyrodriver/measurements.png">
            &lt;img src="http://essentialscrap.com/gyrodriver/measurements-medium.png" class="centerimg" title="Target measurements for the steel sheet milling" />
        &lt;/a>
&lt;p>I figured I could use a 60° carbide V-bit to make grooves in a steel plate, which would then form triangular teeth between the grooves.
The sheet metal could then be rolled up into a circle to make the gear.
Bending the sheet reduces the angle between adjancent teeth by about 6°, getting it very close to the 55° target.
The old plastic teeth will be milled away, and the replacement glued in place.
&lt;/p>
&lt;h2>Results&lt;/h2>
&lt;p>Cutting the gear sheet was easy on 
        &lt;a href="https://jyväskylä.hacklab.fi/wikipage/cnc-jyrsin/">Hacklab Jyväskylä's CNC&lt;/a>
    . There were some burrs that needed manual removal with a file and sandpaper.
I left about 0.2 mm thick spine behind the teeth.&lt;/p>
        &lt;a href="http://essentialscrap.com/gyrodriver/gear_plate.jpg">
            &lt;img src="http://essentialscrap.com/gyrodriver/gear_plate-thumb.jpg" class="marginimg" title="Milled steel sheet" />
        &lt;/a>
&lt;p>I rolled up the ring using a round pipe. The last teeth on each side needed to be separately bent using pliers.
The clutch ring was useful for alignment while soldering the ring together.
After soldering I filed it smooth.
&lt;/p>
        &lt;a href="http://essentialscrap.com/gyrodriver/soldered.jpg">
            &lt;img src="http://essentialscrap.com/gyrodriver/soldered-thumb.jpg" class="marginimg" title="Soldering the ring together" />
        &lt;/a>
&lt;p>Positioning the plastic housing for accurately milling out the old teeth was more difficult.
I clamped the nose part on a vice, to avoid deforming the part with the gears.
I made initial alignment using camera on the CNC.
To get more accurate centering, I made first cuts so that they just barely touch the gears, and adjusted on-the-fly X/Y offsets until milling sounds were equal on all sides.
&lt;/p>
&lt;p>On first fitting the ring didn't quite go in, so I milled 0.1 mm further in radius.
In retrospect this was unnecessary and the initially calculated fit would have been more accurate.
I had to insert a few shims during glueup to make the ring stay centered.&lt;/p>
        &lt;a href="http://essentialscrap.com/gyrodriver/before_glueup.jpg">
            &lt;img src="http://essentialscrap.com/gyrodriver/before_glueup-thumb.jpg" class="marginimg" title="Before gluing the gear in place" />
        &lt;/a>
&lt;p>After gluing the ring in place with some epoxy there was only assembly remaining.
I applied new grease to the gears and ran the motor for a while.
Everything ran smoothly, though the seam in the ring makes a small click every time the metal gears pass it.
&lt;/p>
        &lt;a href="http://essentialscrap.com/gyrodriver/gears_installed.jpg">
            &lt;img src="http://essentialscrap.com/gyrodriver/gears_installed-thumb.jpg" class="marginimg" title="Gears in place" />
        &lt;/a>
&lt;p>Fully assembled, I tested the driver to the limits of its motor torque and the glue held up fine.
Hopefully this fix will give it another decade of operation.
I may have to replace the battery at some point, but it is a standard 18650 cell so that should be an easy task.
&lt;/p>
&lt;/div>
    &lt;p class="signature">– Petteri Aimonen on 12.8.2024&lt;/p>
    &lt;p class="commentcount">
        &lt;a href="http://essentialscrap.com/comments/gyrodriver/">
        Comment on this page
        &lt;!--#config errmsg="" -->
        &lt;!--#include virtual="/comments/${DOCUMENT_URI}?cmd=count" -->
        &lt;/a>
    &lt;/p>&lt;/div></description>
    <pubDate>Mon, 12 Aug 2024 00:00:00 +0000</pubDate>
</item><item>
    <title>BGA inspection using plastic prisms</title>
    <link>http://essentialscrap.com/bga_prism/index.html</link>
    <guid>http://essentialscrap.com/bga_prism/index.html</guid>
    <description>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;div id="content">
    &lt;h1 id="articletitle">BGA inspection using plastic prisms&lt;/h1>
    &lt;div>
&lt;p>BGA (Ball Grid Array) packaging for microchips is getting more common as devices become smaller.
It's quite feasible to solder with a basic home reflow setup, but verifying the results is difficult.
The gold standard would be X-ray imaging, but short of that you can use optical verification with simple prism tools.
&lt;/p>
&lt;h2>Optical verification principle&lt;/h2>
&lt;p>The idea is to shine light from the side, so that it passes between the ball rows beneath the chip.
This will indicate any short-circuits between the rows, but will not show any missing balls.
It will, however, show insufficiently melted solder paste or uneven distribution of solder.
So if the chip began with all balls present and the solder paste was applied evenly on the PCB, you can be reasonably confident that any faults would be visible.
&lt;/p>
&lt;img src="http://essentialscrap.com/bga_prism/principle.png" class="centerimg" />
&lt;p>If there were no other components on the PCB, you could simply hold the PCB edgewise against a bright background and observe from the side.
You would then see the balls as dark shadows against the background.
&lt;/p>
        &lt;a href="http://essentialscrap.com/bga_prism/bga_side.jpg">
            &lt;img src="http://essentialscrap.com/bga_prism/bga_side-medium.jpg" class="centerimg" />
        &lt;/a>
&lt;p>
However, practical PCBs don't have much space around the BGA chips so this is rarely possible.
Instead, we can use a thin prism to redirect light in 90° angle around the corner of the chip.
By cutting and polishing 45° angle in a transparent piece of plastic, 
        &lt;a href="https://en.wikipedia.org/wiki/Total_internal_reflection">total internal reflection&lt;/a>
     makes it act like a mirror.
The light from a LED will be directed under the chip, and any light that gets through is mirrored upwards towards the viewer.&lt;/p>
&lt;img src="http://essentialscrap.com/bga_prism/principle2.png" class="centerimg" />
&lt;h2>Making the prisms&lt;/h2>
        &lt;a href="http://essentialscrap.com/bga_prism/pieces.jpg">
            &lt;img src="http://essentialscrap.com/bga_prism/pieces-thumb.jpg" class="marginimg" title="Prisms made of 2 mm acrylic" />
        &lt;/a>
        &lt;a href="http://essentialscrap.com/bga_prism/plastic.jpg">
            &lt;img src="http://essentialscrap.com/bga_prism/plastic-thumb.jpg" class="marginimg" title="Thin plastic from shaving blade cartridge" />
        &lt;/a>
&lt;p>I made my first prototypes from 2 mm thick acrylic.
But then I found out that many PCBs leave only about 1 millimeter of space around BGA chips.
I didn't have any flat sheets of plastic that thin, but searching through my shelves I figured that Gillette shaving blade cartridges are made of thin transparent plastic.
&lt;/p>
&lt;p>I cut the pieces into small rectangles and used increasing grids of sandpaper to form the edge and polish it.
After 1200 grit, I used 1 micron polishing paste and then Displex plastic polishing paste.
This gave a reasonably clean edge, though with some guides I could have gotten it more straight and flat.
&lt;/p>
&lt;h2>Light source&lt;/h2>
        &lt;a href="http://essentialscrap.com/bga_prism/lightsource.jpg">
            &lt;img src="http://essentialscrap.com/bga_prism/lightsource-thumb.jpg" class="marginimg" title="Light source before attaching the prism" />
        &lt;/a>
        &lt;a href="http://essentialscrap.com/bga_prism/lightsource_in_use.jpg">
            &lt;img src="http://essentialscrap.com/bga_prism/lightsource_in_use-thumb.jpg" class="marginimg" title="Light source in use" />
        &lt;/a>
&lt;p>The light source needs to be very bright to be visible though the two prisms. It helps use colored LEDs, which are more easily seen against other ambient lighting.
&lt;/p>
&lt;p>I used 11 pcs of 0603 high-intensity green LEDs, soldered in parallel side to side.
Resistors are used to limit the current to 20 mA per LED.&lt;/p>
&lt;p>The prism is superglued onto the LEDs. Superglue has similar refractive index as most plastics, so it reduces losses in the optical interface.
It is a good idea to let the glue cure in front of a fan, as otherwise superglue vapours can fog up the prism surfaces.
&lt;/p>
&lt;h2>Results&lt;/h2>
        &lt;a href="http://essentialscrap.com/bga_prism/tools.jpg">
            &lt;img src="http://essentialscrap.com/bga_prism/tools-thumb.jpg" class="marginimg" title="Inspection tools" />
        &lt;/a>
        &lt;a href="http://essentialscrap.com/bga_prism/in_use.jpg">
            &lt;img src="http://essentialscrap.com/bga_prism/in_use-thumb.jpg" class="marginimg" title="BGA inspection setup" />
        &lt;/a>
        &lt;a href="http://essentialscrap.com/bga_prism/through_prism.jpg">
            &lt;img src="http://essentialscrap.com/bga_prism/through_prism-thumb.jpg" class="marginimg" title="View through the prisms" />
        &lt;/a>
        &lt;a href="http://essentialscrap.com/bga_prism/through_prism2.jpg">
            &lt;img src="http://essentialscrap.com/bga_prism/through_prism2-thumb.jpg" class="marginimg" title="View through the prisms" />
        &lt;/a>
&lt;p>The prisms work reasonably well. I could probably make them a bit more accurate, and if I made them out of optical quality glass the reflection would probably be clearer.&lt;/p>
&lt;p>Even with these quickly made prisms it is easy to see the balls of a 0.5 mm pitch BGA chip.
The prism surfaces are not perfectly flat because I held it by hand while polishing.
This causes some distortion and extra reflections in the result image.
&lt;/p>
&lt;p>The biggest drawback of optical inspection is the sensitivity to any flux residue underneath the chip.
I have found that freshly reflow-soldered chips are fairly clean underneath after a bit of rinsing with isopropyl alcohol.
But when reworking BGA chips it is common to apply an excess of flux, which tends to harden after cooling.
Even though it is soluble in isopropanol, cleaning it away takes a lot of effort as it is difficult to get liquid flowing underneath the chip and any brushes won't fit.
&lt;/p>&lt;/div>
    &lt;p class="signature">– Petteri Aimonen on 26.4.2024&lt;/p>
    &lt;p class="commentcount">
        &lt;a href="http://essentialscrap.com/comments/bga_prism/">
        Comment on this page
        &lt;!--#config errmsg="" -->
        &lt;!--#include virtual="/comments/${DOCUMENT_URI}?cmd=count" -->
        &lt;/a>
    &lt;/p>&lt;/div></description>
    <pubDate>Fri, 26 Apr 2024 00:00:00 +0000</pubDate>
</item><item>
    <title>Relay multiplexer for lab instruments</title>
    <link>http://essentialscrap.com/relaymux/index.html</link>
    <guid>http://essentialscrap.com/relaymux/index.html</guid>
    <description>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;div id="content">
    &lt;h1 id="articletitle">Relay multiplexer for lab instruments&lt;/h1>
    &lt;div>
&lt;p>
I have been adding programmable equipment to my home lab: USB connected power supply, electronic load, multimeter, oscilloscope and function generator. This is great for doing parameter sweeps and long term tests. But often I have more than one thing I want to measure with the multimeter. In this project I build a simple relay multiplexer for selecting signal sources.
&lt;/p>
&lt;h2>Existing alternatives&lt;/h2>
&lt;p>There are many USB relay cards out there. Cheapest include 
        &lt;a href="https://sigrok.org/wiki/ICStation_USBRelay">ICStation ICSE014A&lt;/a>
     and clones of it. Unfortunately it has a very poorly designed protocol which results in accidental changes of relay states when software is restarted. It also tends to draw quite a lot of current when all relays are on, often exceeding USB port 500mA limit.&lt;/p>
&lt;p>Better boards like 
        &lt;a href="https://www.robot-electronics.co.uk/products/relay-modules/usb-relay/usb-rly08c.html">Robot Electronics RLY08C&lt;/a>
     work fine, but are not very convenient for lab usage. I wanted a board that has banana binding posts for cables, and that switches both negative and positive signal as a pair.&lt;/p>
&lt;h2>Schematic design&lt;/h2>
&lt;p>First thing to choose was the relays to be used. I ended up choosing 
        &lt;a href="https://www.digikey.fi/en/products/detail/panasonic-electric-works/TQ2SA-5V/251782">Panasonic TQ2SA-5V&lt;/a>
     for its low coil current and low wetting current requirements. Wetting current in particular can be a problem for lab usage, as the contacts may oxidize on relays designed for high power when the load current is only microamperes. Signal relays have gold coating on the contacts, which does not handle as high current but avoids oxide problems.&lt;/p>
&lt;p>The relays are divided into two groups, with 4 relays each.
This allows to use the groups in parallel for two separate instruments or for 4-wire measurements.
Alternatively the inputs can be joined with pieces of wire to form a single group with 8 relays.
&lt;/p>
&lt;p>I chose 
        &lt;a href="https://www.digikey.fi/en/products/detail/stmicroelectronics/STM32F042F6P6TR/7313042">STM32F042&lt;/a>
     as the microcontroller handling USB connection, because it does not require an external crystal. 
        &lt;a href="https://www.digikey.fi/en/products/detail/toshiba-semiconductor-and-storage/TBD62783AFWG-EL/5514115">TBD62783A&lt;/a>
     handles driving the relays. It has integrated flyback diode and input pull-down resistors, making the schematic easy.&lt;/p>
&lt;p>I added two push buttons for convenience: first one cycles through each relay in turn, and second one opens all relays.
This can be quite useful when you are making connections to test equipment, as you can check that everything works before starting the measurement script on PC.&lt;/p>
&lt;p>Even though the relays chosen have relatively low coil current, the total current for 8 relays and the indicator LEDs still climbs to over 250 mA. To avoid voltage spikes when all relays get switched simultaneously, a large enough capacitor is needed.
The 470 µF I chose is probably larger than needed, but better play it safe.
Having more than 10 µF capacitance on an USB device requires inrush current control to avoid voltage dips when the device is plugged in.
To handle this I used 
        &lt;a href="https://www.digikey.fi/fi/products/detail/texas-instruments/TPS2552DDBVT/6217608">TPS2552D&lt;/a>
    .&lt;/p>
&lt;div class="centerimg">
        &lt;a href="http://essentialscrap.com/relaymux/schematic.png">
            &lt;img src="http://essentialscrap.com/relaymux/schematic-medium.png" title="USB Relay mux schematics" />
        &lt;/a>
&lt;/div>
&lt;h2>PCB design&lt;/h2>
        &lt;a href="http://essentialscrap.com/relaymux/inside.jpg">
            &lt;img src="http://essentialscrap.com/relaymux/inside-thumb.jpg" class="marginimg" title="Inside the enclosure and view of the PCB" />
        &lt;/a>
        &lt;a href="http://essentialscrap.com/relaymux/connectors.jpg">
            &lt;img src="http://essentialscrap.com/relaymux/connectors-thumb.jpg" class="marginimg" title="Connector mounting" />
        &lt;/a>
&lt;p>I wanted an aluminum enclosure, both for nice looks and to shield against electrical noise. 
        &lt;a href="https://www.digikey.fi/en/products/detail/hammond-manufacturing/1550MBK/2211549">Hammond 1550MBK&lt;/a>
     was the cheapest suitably sized enclosure I found, and a black PCB could nicely fit in place of its top cover.&lt;/p>
&lt;p>For the PCB to work as the cover, all components have to be installed on the bottom side. The LEDs are reverse mount type, which shine through holes in the PCB. Rest of the parts are SMD, and with some careful routing I was able to avoid any traces on the top side.&lt;/p>
&lt;p>Binding posts were harder to choose. The ones on Digikey were rather expensive, at 2 EUR per each. I needed 20, so this would get expensive. I found some cheap ones (0.5 EUR each) on eBay, but ended up having to drill a wire hole on them myself. I guess you get what you pay for, but a binding post without a cross hole for a wire seems rather useless to me.&lt;/p>
&lt;p>I wasn't sure on the best way to mount binding posts to a PCB. Most binding posts are designed for panel mounting, and have an insulating sleeve around the screw. I could make a 6.5 mm hole on the PCB and then solder a separate wire from each post to a pad. But for easier assembly, I decided to remove the insulating sleeve and use direct metal connection between the binding post body and the PCB. This worked well enough, though I did have to add some solder to prevent the connectors from spinning in the hole. Because the screw thread does not go all the way to the bottom, I had to use the plastic washers to space out the nut so that it could be tightened.&lt;/p>
&lt;h2>Control protocol&lt;/h2>
&lt;p>Most of my other instruments use 
        &lt;a href="https://en.wikipedia.org/wiki/Standard_Commands_for_Programmable_Instruments">SCPI protocol&lt;/a>
     for control. There is a nice library 
        &lt;a href="https://github.com/j123b567/scpi-parser">scpi-parser&lt;/a>
     by Jan Breuer that made SCPI implementation easy.&lt;/p>
&lt;p>The SCPI standard specifies standard instrument classes, which include "Signal Switchers" category.
I implemented the standard command set, and added a few custom commands for convenience.&lt;/p>
&lt;p>For USB serial port emulation I used the STM32 Cube libraries, as they were easily available on PlatformIO.
Initially I had trouble getting STM32F042 USB working, until I found out that &lt;code>SYSCFG->CFGR1&lt;/code> has a bit &lt;code>PA11_PA12_RMP&lt;/code> that needs to be set to enable the USB pins on 28-pin packages.
After that writing the firmware was very straightforward.&lt;/p>
&lt;h2>Results&lt;/h2>
        &lt;a href="http://essentialscrap.com/relaymux/powered.jpg">
            &lt;img src="http://essentialscrap.com/relaymux/powered-thumb.jpg" class="marginimg" title="Relay mux powered up and one channel active" />
        &lt;/a>
&lt;p>All basic functionality works well. The assembled device has parasitic capacitance of 40 pF from each signal to GND, and 50 milliohm resistance when measured.&lt;/p>
&lt;p>I'm not perfectly satisfied with the binding posts, as the threads are a bit rough.
For the price they are a good deal.&lt;/p>
&lt;p>The USB descriptors used are a bit lazy, as the STM32 library claims the device as self powered.
This could be fixed in software, but it's not really important for me.&lt;/p>
&lt;p>Design files are 
        &lt;a href="https://github.com/PetteriAimonen/relaymux">available on GitHub&lt;/a>
    .&lt;/p>
&lt;/div>
    &lt;p class="signature">– Petteri Aimonen on 26.3.2024&lt;/p>
    &lt;p class="commentcount">
        &lt;a href="http://essentialscrap.com/comments/relaymux/">
        Comment on this page
        &lt;!--#config errmsg="" -->
        &lt;!--#include virtual="/comments/${DOCUMENT_URI}?cmd=count" -->
        &lt;/a>
    &lt;/p>&lt;/div></description>
    <pubDate>Tue, 26 Mar 2024 00:00:00 +0000</pubDate>
</item><item>
    <title>Improved frequency reference for ELV FC-500</title>
    <link>http://essentialscrap.com/fc500_freqref/index.html</link>
    <guid>http://essentialscrap.com/fc500_freqref/index.html</guid>
    <description>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;div id="content">
    &lt;h1 id="articletitle">Improved frequency reference for ELV FC-500&lt;/h1>
    &lt;div>
&lt;p>
As one of my first electronics projects, two decades ago I built a 
        &lt;a href="https://www.radiomuseum.org/r/elv_frequency_counter_fc_500.html">ELV FC-500&lt;/a>
     frequency counter out of a kit. It has worked great and found use in several projects where I have needed to check the accuracy of oscillators. I just wished for a bit more accuracy on the meter.
&lt;/p>
&lt;h2>Original design&lt;/h2>
&lt;p>The FC-500 is based on a 24-bit ripple carry counter implemented with 74HC393 chips.
A microcontroller controls clock gating and counter reset, and reads out the final count for display.
The display has 8 digit resolution, providing display resolution of 0.1 ppm.
This far surpasses my DS1054 oscilloscope, which only provides three digits in its frequency measurement.
&lt;/p>
&lt;p>Amazingly, the original schematics and build instructions are still available from ELV journal, split into 
        &lt;a href="https://de.elv.com/13-ghz-hand-held-frequenzzaehler-fc-500-teil-12-201884">part 1 (schematics)&lt;/a>
     and 
        &lt;a href="https://de.elv.com/13-ghz-hand-held-frequenzzaehler-fc-500-teil-22-201957">part 2 (build instructions)&lt;/a>
    . For the price of 1 EUR, I decided to buy both parts as PDF instead of trying to find the original magazines from my archives.&lt;/p>
&lt;p>What I really like about this device is that it correctly implements input-synchronous sampling of counter.
This means that it is able to display accurate frequency and period down to 0.01 Hz and possibly lower.
This was very handy for calibrating a clock that gave pulse once a minute.
&lt;/p>
&lt;h2>Improving the accuracy&lt;/h2>
&lt;p>The original design uses a basic 4.096 MHz clock crystal, combined with a trimmer capacitor.
The capacitor allows adjusting the meter using a known reference source.
However there is no temperature compensation for the crystal, which has about 0.2 ppm/°C slope.
My FC-500 had a few ppm of inaccuracy in room temperature before I started this project.
&lt;/p>
&lt;p>For highest frequency stability, common choises are ovenized crystal oscillators and rubidium references.
For a portable device like FC-500, these are too large, too power hungry and require continuous power.
&lt;/p>
&lt;p>Temperature compensated crystal oscillators are a reasonable alternative.
For a device like this, you want a VCTCXO: VC for voltage controlled, TC for temperature compensated, XO for crystal oscillator.
Voltage control allows adjusting the oscillator for initial calibration.
Temperature compensation should keep it accurate after that.
&lt;/p>
&lt;p>What remains is the aging of the crystal.
Typical VCTCXOs have ± 1 ppm per year aging specification.
There are MEMS based oscillators that are much more stable than this, but also more expensive.
&lt;/p>
&lt;p>A complication is that VCTCXOs with 4.096 MHz frequency are quite rare.
Fortunately 16.384 MHz is better available, and a divide-by-four circuit can be built with two flipflops.
As possible options, I identified the following parts:&lt;/p>
&lt;ul>
&lt;li>
        &lt;a href="https://www.digikey.fi/en/products/detail/iqd-frequency-products/LFTVXO009905BULK/8633504">LFTVXO009905BULK&lt;/a>
    : 14 EUR, crystal, ±0.9 ppm stability, ±1 ppm/year typical aging.&lt;/li>
&lt;li>
        &lt;a href="https://www.digikey.fi/en/products/detail/abracon-llc/AST3TQ-V-16-384MHZ-28/5017699">AST3TQ-V-16.384MHZ-28&lt;/a>
    : 18 EUR, crystal, ±0.3 ppm stability, ±1 ppm/year max aging.&lt;/li>
&lt;li>
        &lt;a href="https://www.digikey.fi/en/products/detail/sitime/SIT5356AI-FN-30VT-16-384000/12015442">SIT5356AI-FN-30VT-16.384000&lt;/a>
    : 73 EUR, MEMS, ±0.2 ppm stability, ±0.06 ppm/year typical aging.&lt;/li>
&lt;/ul>
&lt;p>
As tempting as the MEMS accuracy is, I decided to go with the cheapest one for now.
They are all pin compatible, so an upgrade is easy to do if I ever want to.
&lt;/p>
&lt;h2>Divider circuit&lt;/h2>
&lt;p>FC-500 operates with a 5 V logic supply, so I needed a voltage regulator to provide 3.3 V for the VCTCXO.
Other than that, there are the two flipflops for dividing the output frequency and a trimmer resistor for adjusting the control voltage.&lt;/p>
        &lt;a href="http://essentialscrap.com/fc500_freqref/schematic.png">
&lt;img src="http://essentialscrap.com/fc500_freqref/schematic.png" class="centerimg" title="FC-500 improved frequency reference schematics" />
&lt;/a>
&lt;p>The PCB is a 1-layer design, suitable for DIY manufacturing by etching or milling.&lt;/p>
        &lt;a href="http://essentialscrap.com/fc500_freqref/pcb_design.png">
&lt;img src="http://essentialscrap.com/fc500_freqref/pcb_design.png" class="centerimg" title="FC-500 improved frequency reference PCB design" />
&lt;/a>
&lt;h2>Installation&lt;/h2>
        &lt;a href="http://essentialscrap.com/fc500_freqref/mcu.jpg">
            &lt;img src="http://essentialscrap.com/fc500_freqref/mcu-thumb.jpg" class="marginimg" title="Wire to the Xin pin on the microcontroller" />
        &lt;/a>
        &lt;a href="http://essentialscrap.com/fc500_freqref/installed.jpg">
            &lt;img src="http://essentialscrap.com/fc500_freqref/installed-thumb.jpg" class="marginimg" title="Oscillator board installed" />
        &lt;/a>
&lt;p>Many microcontrollers have two pins that the crystal resonator connects between: Xin and Xout.
These are the signals of an internal inverter gate used for implementing a crystal oscillator.
&lt;/p>
&lt;p>When replacing a crystal resonator with an external crystal oscillator, the signal must be fed into Xin.
This is the pin with the variable trimmer capacitor, if the circuit has one.
You can also measure the amplitude with oscilloscope (with probe in 10x mode), where the Xout pin will show higher peak-to-peak voltage.
In this case I was able to check the pinout from the original schematic.
&lt;/p>
&lt;p>I glued my small auxiliary PCB near the battery compartment, and ran a wire to the microcontroller that is below the LCD display. The original crystal has to be desoldered, but initially I left the variable capacitor in place.&lt;/p>
&lt;p>This however caused a bit of a problem. The large capacitance at the end of a long wire, combined with high slew rate of 74LVC80 flipflops caused large spikes. Debugging this was complicated by the weird behavior of the MIC5504 regulator I originally had in the circuit. Apparently high frequency spikes can couple into its feedback circuit, causing output voltage to drop. They do mention in datasheet that &lt;em>"The MIC5501/2/3/4 is not suitable for RF transmitter systems."&lt;/em>.
&lt;/p>
&lt;p>Adding a 100 ohm series resistor on the output and cutting the trace that led to the trimmer capacitor made things a lot better.
I had already switched the regulator for XC6210, which proved stable even under the less than ideal conditions.
A final issue was that I had to cut a small groove in the LCD display holder to have space to pass the wire underneath.
&lt;/p>
&lt;h2>Calibration&lt;/h2>
        &lt;a href="http://essentialscrap.com/fc500_freqref/calibrated.jpg">
            &lt;img src="http://essentialscrap.com/fc500_freqref/calibrated-thumb.jpg" class="marginimg" title="After calibration" />
        &lt;/a>
&lt;p>I used a GPS module with pulse-per-second output as the calibration source.
Careful adjustment got me to the correct 1 Hz reading, but there seems to be a small disrepancy in the last digit between period and frequency measurement modes.
Probably this is a limitation of how accurately the firmware does mathematics.
I guess the high-accuracy MEMS oscillator would have been somewhat wasted in FC-500.
&lt;/p>
&lt;h2>Design files&lt;/h2>
&lt;p>The KiCad design files for the clock divider are available 
        &lt;a href="http://essentialscrap.com/fc500_freqref/elv_fc500_freqref.zip">here&lt;/a>
    .
&lt;/p>
&lt;/div>
    &lt;p class="signature">– Petteri Aimonen on 29.11.2023&lt;/p>
    &lt;p class="commentcount">
        &lt;a href="http://essentialscrap.com/comments/fc500_freqref/">
        Comment on this page
        &lt;!--#config errmsg="" -->
        &lt;!--#include virtual="/comments/${DOCUMENT_URI}?cmd=count" -->
        &lt;/a>
    &lt;/p>&lt;/div></description>
    <pubDate>Wed, 29 Nov 2023 00:00:00 +0000</pubDate>
</item>
</channel>
</rss>