Category Archives: Electronics

Jaunty fresh install notes

Similar to the Intrepid fresh install notes, I kept notes while installing Jaunty from the CD on my Dell Inspiron 8600, trying to see it the way a complete newcomer would.

  • Again, the language selection screen is ugly.
    • language-selection
  • Again, you have to reboot after checking the CD for errors.
  • Currently it says “Press F4 to select alternative start-up and installation modes“, but it should explicitly say “Press F1 for help.”, first, for ultimate newcomers.
    • press-f4
  • After pressing F1, Help page should describe basics at top, for ultimate newcomers.  “Use arrow keys to move, press Enter to select etc”. Right now it just looks like this:
    •  HELP INDEX 
      
       KEY    TOPIC 
      
      <F1>   This page, the help index.
      <F2>   Prerequisites for running Ubuntu.
      <F3>   Boot methods for special ways of using this CD-ROM.
      <F4>   Additional boot methods; rescuing a broken system.
      <F5>   Special boot parameters, overview.
      <F6>   Special boot parameters for special machines.
      <F7>   Special boot parameters for selected disk controllers.
      <F8>   Special boot parameters for the bootstrap system.
      <F9>   How to get help.
      <F10>  Copyrights and warranties.
    • help-screen
  • Release note complaints still apply.
    • It should show a rich text box with scroll bars that contains the most recent release notes, and offer to download the rest if you have a connection. If there is a connection, download the latest rich text release notes and display them automatically.  If not, display the ones packaged with the CD, and a note saying they are out of date.
    • “If you have Internet access, read the release notes for information on problems that may affect you.”    (Bug 254639)
    • release-notes
    • Why in the world does it open up Firefox when it could just display the release notes in a rich text box in the installer itself?  There’s plenty of room.
    • release-notes-error
    • Should be able to prompt for a wireless key
  • It says “Select your time zone from the map”, but you’re really selecting location, not just time zone.  Does this affect language, keyboard layout, weather, units, or other local properties?  If not, it probably should.  (Bug 380171)
    • select-time-zone
  • Partitioner is the worst part:
    • “Install them side by side” needs wording improvement.  What is “them”?
    • It’s good that it warns “This will delete x and install y
    • Don’t show a drop-down box for disk selection if there is only one disk  (Bug 380175)
      • Use a list (with dynamic scrollbar if needed) instead so they can see and understand instantly that they have multiple choices; plenty of screen real estate for this
    • If you have multiple disks, it only shows a color bar for one disk at a time.  This drop-down selector is for that, too?  If so, shouldn’t it be at the top, instead of inside an option so that it looks like it only applies to that option?
    • If there is a big empty space on a drive, default to that. If the disk is full of partitions, but one is Linux format and completely empty, default to that.
      • This isn’t just a matter of what option comes up as default, it’s also a matter of the slider not stopping at partition boundaries.
      • So if you try to use an empty space, you’ll end up resizing an existing partition because the graphical slider mechanism only gives you so much accuracy.
      • It should just default to the boundaries of the empty space if possible, and the slider should stop at partition boundaries.
      • “Use the largest continuous free space” doesn’t even work.
    • If there are human-readable descriptions of disks and partitions, show those first.  Showing /dev/whatever should be parenthetical.
    • Why does it show a brown bar if I select manual install?  What is brown supposed to signify?
    • Slider behaves super oddly, moving all above partitions at once as I slide it.
    • This partitioner scares me, so i canceled it and modified the partitions in GParted first, then went back into the installer and used manual mode to mount the partition I wanted as root.
      • I’d like to see Canonical take a survey about the partitioner.  Does anyone actually use it?  Do most just use manual mode?  Does it really only work on drives that have Windows and nothing else on them?
    • Ask if I want to shrink another partition?
    • Partitions are not obvious.  Brown and a different shade of brown right next to each other.
    • Should show used and free space for each partition.  This helps in identifying them, helps in seeing how much space there is to work with when resizing them.
    • Should have same functions as GParted, basically (Idea 19218)
  • “What is the name of this computer?” prompt:  Are there any recommendations on what this should be?  Should it be all lowercase or less than a certain length for compatibility?  If so, it should say so.
  • In step 6, it says “Migrate documents and settings”, which presumably copies settings from existing partitions?  It didn’t recognize my Windows partition or my Ubuntu partition for migration.  It should do both.
  • It should show the password strength meter when entering the main user’s password for the first time. (Bug 155308)  Apparently it does show a “weak password” dialog if you type less than 8 characters, though.
  • The boot noise infuriates me.  I’ve heard it so many times now, and there’s no way to shut it off.  If you boot to the LiveCD, there’s going to be an extremely loud drum sound on startup, and you can’t do anything about it.  The volume buttons don’t kick in until after the sound has played.  I tried to leave the room whenever I knew it was going to happen, or cover the laptop with pillows.  (Bug 114160)
  • After finishing the installation, my computer would no longer boot.  Bad Ubuntu.  It should warn the user before installing in a location that’s not accessible by the BIOS.  I had to create a separate boot partition to get it to work.  (Bug 379348)

BitScope

Note: “BitScope DSO” is the software interface for the BitScope USB oscilloscope.  This is totally different from the “Bitscope” package used to monitor digital audio in JACK Audio Connection Kit.

I have an old 2-channel analog oscilloscope, but it’s not very convenient and doesn’t have any storage capabilities, making it really difficult to measure transients or things that happen long after the trigger.

LIZEN LAS-5020 20 MHz 2-channel analog oscilloscope

I looked around at different options and decided a USB scope would be nice to have.  Since I’ve started using predominantly Ubuntu Linux at home, but Windows XP at work, I wanted something that would work in both operating systems.  The BitScope seemed to be what I wanted, but is quite expensive, with even the cheapest pocket analyzer at $475. (My old analog scope was less than $50 on eBay.)  With the help of a saved eBay search for “bitscope”, though, I eventually ended up finding one for 1/3 the normal price.

Photograph of BitScope BS50U Pocket Analyzer

As is often the case with deals like this, the unit didn’t work when I got it.

Repair

The seller said it worked fine for him, so I poked around some more.  I tried it in Windows and it didn’t work there, either.  I went to Gnome System Log (/var/log/messages), and saw this among the messages it displays when I plug it in:

Jun  1 23:18:24 Inspiron kernel: [53398.974351] hub 1-0:1.0: over-current change on port 1

Aha.  It’s drawing too much current from the USB bus and getting shut down.  This is the sort of thing I develop at work, so I should (theoretically) know how to fix this.  I found a compatible DC power supply (12 VDC, 800 mA, 2.5 mm center positive) and tried it with that, and it worked!  It also worked when I first plugged it into the external supply, then plugged in the USB cable, and then disconnected the external supply.  So it seemed like an inrush current problem rather than a short circuit/bus power problem.

(According to the USB spec, devices cannot draw more than 100 mA in an unconfigured state, except for a brief inrush current spike, but the amount of excess charge during that spike is limited to 50 µC.  In other words, you aren’t allowed to put more than 10 µF across the VBUS line to ground.  A lot of USB device manufacturers ignore these requirements, and most computers don’t care, but my Dell Inspiron 8600 seems to be especially picky.)

The BitScope website emphasizes the fact that it’s “open design hardware”, but there were no schematics for this unit on their web site, and the eBay purchase didn’t include a manual.  So I wrote to the company and asked for help.  They were very helpful, going so far as to scan in a manual and convert it to PDF for me:

The company told me there’s a “slow-start” circuit, but it’s more of a “delayed start”.  While plugging in USB, the PWREN pin on the USB FIFO (FT245BM) is brought high immediately.  This keeps the PMOS switch IRF7314Q open, so no current can flow from VBUS into the rest of the circuit.  After initialization, the PWREN pin snaps low, opening the PMOS switch and connecting 47 µF directly across VBUS to ground.  My computer doesn’t like this much current, and presumably shuts down the FIFO, evidenced by the PWREN pin going high again about 8 ms later.  (Remember that I am just eyeing this up on an analog scope with no storage ability.  Thankfully, Linux was kind enough to continually re-initialize the USB port, trying to connect and failing over and over again, so I didn’t have to keep plugging and unplugging the USB cable manually while holding the probes against the relevant pins.)

After realizing this, I decided I should try to make the FET open up a little more slowly so the current into the cap is not so high.  So I connected a 1 µF cap (time constant of 10 ms) from the gate of the FET to ground.  It worked!  But when I looked at the system log, it was still showing the over-current error.  In fact, it looked like it got the over-current error, shut down, re-initialized, and then started correctly, probably because the cap was still charged from the previous attempt.  Then I realized what I had done.  By putting the cap to ground, the FET was held closed during startup, so there was still an inrush spike while plugging in, instead of after initialization. So I connected the cap between the gate and VBUS instead:

A 1 uF capacitor is connected between VBUS and the gate of the FET

Photo of a 1 uF capacitor soldered between VBUS and the gate of the FET

Now the gate is pulled up instantly along with VBUS at plug-in, but when PWREN goes low, the FET gate voltage is slowly dropped down, so it doesn’t open fully until after ~10 ms.  Now it works on bus power with the laptop, and doesn’t complain about over-current at all.

Software

After getting the electronics working, I started up the DSO software.

You have to download and install kylixlibs3-borqt along with the BitScope DSO software or it won’t work.  I used the BitScope-maintained kylixlibs3-borqt_3.0.2bs-1_i386.deb package from the download page.  Other .deb files are available from the kylixlibs SourceForge site, but I don’t know if they work for this.

So then it continually popped up the .csv import screen, indicating that it can’t connect to the hardware.  Eventually I figured out that I had the wrong thing entered in the configuration dialog.  Press the SETUP button and put /dev/ttyUSB0 in the IP Address or Port box under the Setup tab.

Screenshot showing \

I had tried just ttyUSB0 alone and it wasn’t working.

Launcher

After getting it working, I made a Launcher for the main panel.  Right-click Applications, click Edit Menus, go to the Other menu, press New Item.

I got the real icon out of the Windows version, which you can download directly here:

Icon file for BitScope DSO

There’s also a scope icon on Rachel’s pages.

It works!

My body has a built-in signal generator:

Electric violin

I made an electric violin. Here are some details for people who might want to build their own.

Construction

Photograph of a homemade electric violin

The body was mostly made by my father as a high school graduation present. It is made of one piece of black walnut up the middle, with separate pieces of walnut glued on for the “wings”. The lighter wood on the top and bottom is bird’s eye maple, in five slats per side, also glued. The only finish on it is Tung oil.

Pickups

Photograph of pickups made from piezo elements and washers

The pickups and electronics are my half of the project. The pickups are industrial pressure-sensitive piezo washers. They’re meant to be mounted under machinery to measure pressure and vibration, probably with a bolt through the middle. Instead, I have them mounted under the bridge to measure vibration.

As these were given to me third- or fourth-hand, I don’t know where to get them.  Google search for “piezoelectric ring sensor” or “piezo ring transducer” should find something.  Here is a company that sells small quantities.  I haven’t tried them or anything, but people keep asking where to get them.  If you try them and they work for you, leave a comment.  You can also check eBay for odd parts like this.

I wouldn’t recommend the popular piezo buzzer type elements often used as “contact microphones”, since those are thin and designed to produce sound by bending.  They aren’t designed to have things crushing them, and can be easily cracked.

To mount the pickups, two holes were drilled in the top of the violin, the same diameter as the piezos but about 3 times as deep. (Very professionally drawn MS Paint diagram.) A metal disc and a metal washer were made to the same dimensions as the pickup. The metal washer goes in first, with a wire soldered to it. The piezo sits on top of this, and then the metal disc sits on top of that, with the other contact wire traveling up through the middle of the washer and piezo and soldered to the middle of the disc. (Here is another quality diagram of the assembly.) This way a good, flush, mechanical connection is maintained to the top of the pickups, reliable electrical contact is made to both sides of the piezo, and the only thing visible from the outside is a nice sandblasted metal disc. (Here is a high-res closeup of the assembled bridge and pickups.) I was worried that the metal disc might not be the best transmitter of sound, but it has worked pretty well. Originally I was using tiny wires or metal film wedged under the bridge, but it was very prone to falling apart. Before that, I used a flex-sensitive piezo just jammed under the bridge, like the kind found in buzzers. It worked ok. Before that, I tried bolting the washers to the side of the bridge, sticking pieces of pressure-sensitive piezo in the “kidney” of the bridge, taping flex-sensitive to the side of the bridge, etc. This method seems to have worked the best. The best professional piezo pickups are actually several separate pickups mounted inside of the bridge itself, two or more for each string. I couldn’t afford to buy one, and didn’t know how to make one, but this works pretty well. [Years later: I can afford one now; maybe I’ll buy one someday and compare.]

In building it, I learned that the predominant motion of the bridge is actually a side-to-side rocking. Theoretically, the bass bar (a piece of wood that runs lengthwise on the inside of the top of an acoustic violin) sits directly under the right foot of the bridge and the sounding post sits under the left foot. The bass bar keeps one foot rigid while the bridge rocks back and forth, transmitting vibrations through the sounding post to the back of the violin. I’m sure it’s not really that simple, but the rocking back and forth is pretty accurate. When I first hooked up the piezos I was surprised to see that the waveform coming out of one was upside down from the other. As the pressure increases on one pickup, it is decreasing on the other. Since this would sound weird in headphones, and I wanted to be able to sum the signals, I just flipped one of the piezos over during construction, so that the polarity would be the same for both. Summing them while inverted would cancel out all of the signal except for the tiny bit that is different between channels.

The low frequencies are almost exactly the same from left to right, although the left pickup is louder for low strings and the right is louder for the high strings. The overtones, however, have some phase shift, which gives it a little stereo image. This can be seen on an oscilloscope with an X-Y trace mode. Playing a single clear note results in a mostly diagonal line, with little difference between the two channels. Little loops are visible because of the difference between the overtones. Playing a “harmonic” or plucking the string usually gives more interesting plots.

The waves have a definite polarity to them. When you up-bow there is a positive peak in the waveform, and vice versa.  Absolute polarity of sound isn’t audible by itself, but it becomes audible after passing through any kind of asymmetrical distortion.

For testing the pickups, I made a little assembly with a block of wood to sit on top of the body, under the bridge. This way I didn’t drill big holes and then regret it. Your fingers start hurting pretty bad with all the tension from the very high bridge. The edge of the test base cracked when I was drilling it, so I made the actual holes a little closer to the center. The bridge feet don’t sit right in the center of them this way, but it still works fine.

Preamp circuit

The preamp circuit is an op-amp configuration called a charge amplifier. Piezo sensors can be modeled as a voltage source in series with a capacitor (as shown in the schematic), and charge amplifiers are the perfect complement for a capacitive source. (Similar circuits: 1, 2, 3) The other alternative for piezos is a very high input impedance resistive amplifier. The high resistances create a lot of thermal noise, though, making the charge amp superior. [Edit: Where did I get that idea?  Any thermal noise should be shunted by the capacitance of the pickup.]

J. Donald Tillman points out that an FET preamp’s non-linear response is actually better than an ultra-linear op-amp’s, since an op-amp will clip hard (important as the battery dies). An FET will distort sooner, but not as harshly, which is probably better for an audio preamp. Might be something for others to consider. I haven’t had any noticeable problems with clipping, and gave it significant headroom, but, then again, I play pretty distorted most of the time, anyway…

I measured the voltage output of the piezo by plugging it directly into an oscilloscope and playing hard. It was hard to read an absolute value, since it tends to make very large short duration spikes, but I measured about 10 V peak-to-peak at max. A typical signal was only about 4 VPP though. I decided to cut the voltage in half because a non-clipping signal is more important to me than a high signal-to-noise ratio, and it would probably be plenty acceptable anyway.

The gain for this charge amplifier is

G = Cinput / Cfeedback

Notice that the terms are reversed compared to the typical resistive inverter equation. I measured the capacitance of the piezo with an LCR meter and got approximately 680 pF. So I am roughly halving the voltage (680 pF / 1500 pF = 0.453) to get the peaks well within the ~8 VPP rails of the op-amp (0.453 × 10 V = 4.5 VPP).

The feedback resistor determines the lower cutoff frequency, or the speed at which a DC voltage on the piezo would discharge back to 0 V, depending on your perspective. When I built the first preamp circuit (and there were several failed versions), a “constant” DC voltage would appear all the time, sliding the signal up past the power rails and clipping it off. Because the piezo is under the bridge, any change in the tension of the strings (fingering) or the pressure from the bow translates into a huge pressure difference for the piezo, which would then output a DC voltage. Since there is some inherent resistance in the piezo element itself, this charge slowly dissipates, but it can be very slow. In resistive amplifier designs, a large resistor needs to be connected across the leads of the piezo to dissipate this charge, but it has to be a large value so as not to dissipate the signal, too. In the charge amplifier, the feedback resistor performs the same function. The lower −3 dB point is

fc = 1 / (2 π Rf Cf)

So mine has a low cutoff frequency of about 100 Hz. The lowest note on a typical violin is G3 (depending on your numbering system) = 196 Hz. So I have almost an entire octave below the lowest note I would typically play left over for down-tuning and flat frequency response. One problem with this is that the piezos pickup a lot of low-frequency handling noise from the body of the instrument, but it’s not that bad.  Higher-order filters could be helpful to keep frequency response flat for frequencies of interest while cutting out handling noise.

The non-polar electrolytic capacitor is for blocking any DC that might be present, even though there shouldn’t be any, since the output is referenced to the bias point. It isn’t hurting anything, though. Regular electrolytics are not ideal, since there is no constant voltage to keep them polarized.

I have the two pickups output separately, in a “stereo” approach. Since my amp and effects pedal (and most everything with an instrument input) uses mono, I needed a way to mix the two together easily. Originally I had an elaborate circuit planned to output stereo to a TRS plug and automatically convert the stereo output to mono when a TS plug was inserted, with only one op-amp. It used capacitive summing amplifiers and involved summing the left channel and two copies of the right channel, one of which was the inverted R channel output. L + R − R = L. Then, when a TS plug was inserted, it would ground the inverted R, leaving L + R at the tip (+6 dB). So it would output L + R in mono mode and −L, −R in stereo mode. However, I then realized that I couldn’t use that circuit and also have a gain or volume control (though this may be useful to someone else). Eventually I decided to just use a “backwards Y” connection to mix the inputs.

Connecting two outputs together is almost always a very bad thing, but you can actually do it in certain situations (as I learned). The problem with connecting two outputs together is that they tend to have very low source impedances. When one output is tied to another, it ends up putting a lot of power into that low impedance, which tends to burn them both up. The 5 kΩ resistors on the outputs of the amp prevent the two op-amps from “seeing” each other; instead they see a large load impedance in parallel with a 5 kΩ resistor to ground. So now I have two cables; one is a normal TRS cable for stereo output, and the other is a homemade TRS to TS cable which connects the tip and sleeve together for mono output.

The capacitors from the power supply to ground prevent it from clipping early and doing other weird things. From what I understand, the changing impedance of the output stage of the op-amp causes signal frequency changes in the supply voltage, which is smoothed out by these caps before they can have a feedback effect on the inputs. Before I had them, it was clipping strangely at about half the voltage it should clip at, depending on the signal.

To do

Both the chin rest and shoulder rest are standard models meant for a regular violin, which has a “lip” on the edges for them to grab onto. Mine just has 90° angles, so both tend to slip off. I might try to attach something permanently. I also might try to make a shoulder rest that extends farther down the chest, to give some leverage to counteract the violin’s weight.

It’s very hard to hear yourself while playing with noisy guitars, drums, and the like. It turns out that hearing yourself is much more important for the violin than a fretted guitar, though, as that’s how we stay in tune. We get as close as possible to the right note with muscle memory and then shift into tune with the ear as the note forms. When I can’t hear myself, I’m very out of tune. So I am probably going to build some type of belt-pack in-ear monitor. Another option might be a little speaker on the violin itself, near the left ear. That would use up a lot more power than the preamp alone, though.

Regrets

If I made another one, there are a few things I would change.

  1. Weight: It is way too heavy. I would not have made it as thick or put the “wings” on it if I realized how much it would weigh. It’s not heavy for a piece of wood, but it is heavy compared to a mostly hollow acoustic violin. I can hold it up with my chin fine, but it gets tiring, and then I tend to use my arm to hold it up, too. It’s not really something I can fix, though the expanded shoulder rest idea might remove some of the torque.
  2. Tuners: Machine heads are far superior to pegs. Especially pegs in homemade holes, which do not turn smoothly and either end up too loose or too tight in different positions. If I could go back in time, I would have done it like most modern electric violins do, with the strings fixed to the end of the violin, and machine heads at the base for tuning; no separate fine tuners, no scroll, and less weight at the end, where it matters.
    • Update: I bought a set of Knilling “perfection” planetary gear pegs. They’re expensive (especially compared to the guitar machine heads I wish I had used), but seem to work, and I have removed the fine tuners from the tailpiece. An alternative is Pegheds, which are even more expensive. I haven’t used them for very long, so they may have wear issues that I don’t know about. They don’t feel as impeccably manufactured as they are priced; the resistance to turning changes slightly as you turn the peg in a full rotation, which wouldn’t happen if all the parts were perfectly symmetrical. There’s also an obvious manufacturing seam, which I sanded off.
  3. Strings: I would have given it 5 or 6 strings. Sometimes I think I should have taken up cello or viola instead; I always want to play lower notes than it is capable of. Sometimes I play with the strings tuned down a step or two, but you can only take that so far. Octave effects work, and can sound really nice, but only for some applications. I have read about specially made “baritone” violin strings, which are very thick and sound an octave lower than normal…
  4. Power: The battery lasts a long time, especially with a jack switch to disconnect it when not plugged in, but phantom power might be a better idea. The in-ear monitor and phantom could be in the same box.