Gas station without pumps

2019 January 8

One figure has been giving me grief for a long time

Filed under: Circuits course — gasstationwithoutpumps @ 09:22
Tags: , , ,

There is one figure in my book that has been giving me trouble for a long time:

A Moiré pattern figure for the sampling and aliasing chapter that was giving me trouble.

The figure itself is very simple, and it should have been no trouble at all. I created the figure in hand-written SVG, and all the SVG readers (Inkscape, Preview, and browsers) had no trouble rendering it on the screen. But when Inkscape converted it to PDF (using the Cairo library, I believe), it threw away the black bars in the background. When I asked Inkscape to print the image to PDF, it rotated the image.

For a while, I got away with rerotating the image in Preview and saving the result, but the file got damaged or deleted at some point, and redoing the rotation in Preview no longer worked—pdflatex seemed to have no idea that there was a rotation nor a bounding box any more.  (I think Preview changed when I upgraded the mac OS on my laptop.) This change happened between the 2018 Dec 15 and 2018 Dec 30 releases of the book, so the Dec 30 release had a messed-up figure without my realizing it.

Yesterday evening, I noticed the problem and set about trying to fix it.  Nothing I could do with Inkscape or Preview seemed to work—I either ended up with no black bars or with the image rotated and scaled wrong.  (Viewing the individual image with Preview sometimes worked—but the inclusion by pdflatex was failing in those cases.)

Finally, I decided that since Inkscape was incapable of rendering in PDF the pattern-fill I was using to create the bars, that I would give up on pattern fill to create them.  Instead I used a Python program to generate separate rectangles.  Inkscape had no trouble converting that longer but less sophisticated SVG program to PDF, and I was able to fix the figure.

Because this figure was messed up in the “final” release of 30 Dec 2018, I did a quick re-release last night, fixing this figure and a bunch of typos students had found.  Yesterday was the first day of class, and students have already reported 7 errors in the book (one reported after yesterday’s release, so it is still in the current version at LeanPub).

This year’s class seems to be very diligent, as all the students had the book downloaded by the first day of class, and some had started on the homework.

2018 October 28

Redrawing figure in SVG

Filed under: Circuits course — gasstationwithoutpumps @ 20:18
Tags: , , , , , ,

There is a figure in my book of the cross-section of a power nFET.  Originally, I used a figure from wikimedia:, but I wanted a color version, so I colorized it myself in Inkscape.  Unfortunately, the original SVG was poorly done—it looked like an inkscape conversion of a raster image to paths, which did not result in paths enclosing fillable areas with clean strokes around them, but separate paths filled with black for each stroke.  This made colorizing the image quite difficult.  I did (eventually) manage to make a colorized version, but I’ve never been happy with it.  The file is huge for an SVG file (over 81kB) and difficult to edit.  I’ve been wanting to do it right for some time, and I finally got around to it today.

What I did was to print out the version I’ve been using as a full-page image, then used a ruler to figure out how big each part was.  I then entered SVG code by hand to remake the image. I included comments to describe what each part did and used styles for the different materials, so editing is now easy.  I also made sure that the image is now symmetric and that all the rounded corners have smooth joins to the straight lines (the “q” command in the path “d” attribute makes that fairly easy. The new svg file is only 3425 bytes, even with the comments, and the pdf created from it is only 8kB, instead of 28kB.  Those size changes are not very important (the PDF for the book, after all, is now 25MB, up from 23.7MB last spring), but the image looks better now also. does not let me upload svg files, but you can see the PDF produced from it by inkscape at only lets me upload raster images for display, so I used inkscape to convert the hand-written SVG file to PNG just for this blog. The black line on the right edge seems to have been chopped off in the conversion, though the PDF conversion gets it right.

Here is the PNG generated by inkscape from the SVG file.

I tried uploading the SVG file to Wikimedia Commons, so it could be used on the Wikipedia Power MOSFET page, in place of the black-and-white image, but the uploaded file got rendered as a badly wrong black-and-white PNG file (with all colors converted to black), which is totally useless. I don’t have time to figure out how to tell it to do the conversion correctly, so I just asked them to delete the image again.

Correction 2018 Nov 21: I realized that the drawing from Wikipedia is missing something—the body should be lightly-doped P, with a P+ contact to the metal. The doping profile for the P layer also does not make physical sense here—how does it get shallower under the N+?  I have redrawn the figure for the book, but not corrected it here. I’ve removed the svg source from this post, because WordPress mangled it completely, despite the use of the “source” square-bracket tag. 


2016 May 20

2016 T-shirts ordered

Filed under: Circuits course — gasstationwithoutpumps @ 20:53
Tags: , , ,

I’ve just placed my T-shirt order from my Applied Electronics course:

    The 2016 shirt is an exclusive class-only shirt.The 2016 shirt is an exclusive class-only shirt.

The shirt this year has a couple of differences from previous years’ shirts:

  1. The slug now as a beard, at the request of the class.
  2. The shirt is exclusive to the class this year, with “I survived” added at the beginning of the text, again at the request of the class.  In previous years I was willing to let anyone buy a shirt, to lower the prices for the students in the class, by amortizing the setup fees.

I’m also dealing with a different T-shirt company this year, at the suggestion of one of the students.  I’m using BroPrints, a Santa Cruz company since 1994 (or 2000, depending on whether you count the start of the business or their opening a storefront). Their prices are considerably lower than The Print Gallery, who I used last year. I’m hoping the quality is good (the student who recommended them said that she had used them for several different orders and had good durability of the printing).  I stopped using Sports Design after two sets of shirts (one in 2011 and one in 2014) had bad cracking of the printing, and an order was miscounted in 2014.

Broprints has lower setup fees and lower per-shirt charges than the other companies I’ve dealt with, and the order is a little larger this year (35 shirts), so the per-shirt price should be the lowest yet (about $12 a shirt, and $15 for long sleeve).

I’ve now got the slug design as an SVG file as a master, but what I communicate to the printer is a layered Photoshop file (created with Photoshop Elements from an Inkscape png output), with each silk screen mask on a separate layer.  The SVG file is only 85,868 bytes, while the layered Photoshop file is 11,075,976 bytes.  Obviously the vector format of the SVG file is going to be smaller than a 600dpi raster image, but I’ve found that T-shirt companies can’t deal with Inkscape-created SVG files—especially not when I use non-standard fonts like Optima. The photoshop file is quite inefficiently stored even for a raster image, as a PNG file with essentially the same information (except for splitting the different colors into different layers) created by Photoshop Elements is only 201,677 bytes.

2012 November 20

Holder for Ag/AgCl electrodes

Filed under: Circuits course — gasstationwithoutpumps @ 16:41
Tags: , , , , , , ,

Holder for wires, to be laser cut from acrylic. The red lines are cut lines, the black ones are just engraved. The black lines are 1cm apart, and are intended for immersing the wires to a consistent depth.

Prototype holder laser cut from acrylic, with two loops of wire in the intended positions. (Note: this is 24-gauge brass wire, not sliver wire, as I’ve not yet had time to buy fine-silver wire.)

Over the weekend I designed a holder for silver wires for making and characterizing Ag/AgCl electrodes

Yesterday, I got a few minutes of assistance from a grad student from Gabriel Elkaim’s lab to cut the design out of a scrap of ¼” acrylic I had sitting around.

The picture to the left shows the new design, and the one to the right what the actual design looks like.  A silver wire is wound around one ear, through the “armpit”, and back up to the same ear, where it is wound again. Alligator clips can be clamped on the wires at the ears, to make the transition from silver to copper wires.

The left and right wires are parallel, about 2cm apart, and can be dipped to a depth of 1cm, 2cm, or 3cm (immersing 2cm, 4cm, or 6cm of wire on each side).  The feet and body are narrow enough to stand on the bottom of a standard 10 oz. clear plastic cup, and the alligator clips can be tilted to support the holder by resting against the top rim of the cup. We could probably even support the holder on the alligator clips, to adjust the depth.

I drew the design with Inkscape, but the laser cutter did not interpret the Inkscape SVG correctly, so I used the DXF output format from Inkscape to give to the laser cutter.
I’ll make a dozen of these for the lab, but for the final design I’ll make two modifications: I’ll engrave a face on holder (just for fun) and I’ll have the acrylic supported on blocks in the laser cutter, so that we don’t get the sloppy burn and melt marks on the back from the support grid.

2012 November 18

New holder design for Ag/AgCl electrodes

Filed under: Circuits course — gasstationwithoutpumps @ 19:52
Tags: , , , , , , ,

Holder for wires, to be laser cut from acrylic. The red lines are cut lines, the black ones are just etched. The black lines are 1cm apart, and are intended for immersing the wires to a consistent depth.

I mentioned in Making Ag/AgCl electrodes that I was not really happy with the holder I had made for 18-gauge silver wires for Ag/AgCl electrodes.  I spent some more time thinking about the problem and came up with a different design, using 24-gauge fine silver wires.

The picture to the right shows the new design.  A silver wire is wound around one ear, through the “armpit”, and back up to the same ear, where it is wound again. Alligator clips can be clamped on the wires at the ears, to make the transition from silver to copper wires. The left and right wires will be parallel, 2cm apart, and can be dipped to a depth of 1cm, 2cm, or 3cm (immersing 2cm, 4cm, or 6cm of wire on each side).  The feet and body are narrow enough to fit in a standard 10 oz. clear plastic cup.  I envision using the holder by winding the wire, resting the holder on the bottom of the cup, and carefully pouring in liquid to the desired fill level.

The picture is derived from the SVG file that I plan to send to the laser cutter to cut a holder out of acrylic ( doesn’t allow me to upload SVG files).  In the original SVG file, the thickness and color of the lines indicates which lines are to be used for cutting and which for etching—I had to fatten the lines a lot to make them visible in the PNG file, as “cutting” is signaled by red lines ≤0.001″ wide, which would be far less than a pixel in the PNG file.

I drew the outline with Inkscape, but the conversion to PNG was rather awkward as Inkscape’s conversion to PNG was awful for such thin lines.  I ended up putting out PDF from Inkscape, using Photoshop Elements to rasterize the PDF, then using blurring and level changing to get fat lines.

I’ve never used a laser cutter, so I’ve sent e-mail to the Mechatronics instructor whose classes use the laser cutter, in hopes that he can provide an undergrad to walk me through it the first time.  I also hope they have some scraps of acrylic that I can cut out one prototype from, to see if the notches work well enough.

Testing the prototype will probably be done with copper wire, since I don’t have 24-gauge silver wire, and it will take a while to get some.  If it works ok with copper wire, I’ll go ahead and order the silver wire, get some ¼” acrylic and cut out a dozen holders for the lab (plus a couple of spares in case someone breaks one).

%d bloggers like this: