overengineering – Neil's Log Book https://nrqm.ca What could possibly go wrong? Thu, 15 Nov 2012 07:40:32 +0000 en-US hourly 1 https://wordpress.org/?v=5.4.1 Waterproofing 3D Prints (and also making them look super-cool) with Epoxy Clay https://nrqm.ca/2012/11/waterproofing-3d-prints-epoxy-cla/ Thu, 15 Nov 2012 07:29:51 +0000 https://nrqm.ca/?p=807 It’s pretty hard to get a watertight object out of our Makerbot Thing-O-Matic.  The walls of printed objects are pretty solid, but unexpectedly porous; even a thick block printed with 100% infill will allow water to penetrate it due to errors around the edges and imperfectly fused strands of plastic.  If you want to make a hollow object waterproof you’re going to have to do some post-processing.

It gets worse when the object is a curved surface, as is my AUV hull.  I’ve read that objects can be made watertight by adding outer shells.  That may be true for some objects, but on objects that curve along the z-axis the number of shells exposed to the surface grows as the tangent plane gets closer to parallel to the printer’s build platform—and big holes start to form.

My hull doesn’t actually have to be watertight, it’s a wet hull.  But it has to be airtight in order to hold the bubble of gas that controls the robot’s buoyancy.  Here’s what the airtight hull looks like:

Picture of Finished AUV Hull

Finished (‽) AUV Hull.

So that’s kind of neat.  I did the job using the following procedure:

  1. Clean the surface of each semidemihemisphere with isopropanol or something else that dries clear.
  2. Assemble each hemisphere with big wads of epoxy clay filling in the gaps between the four semidemihemispheres.  Then slather the assembled hemisphere in more epoxy clay so that it’s fully covered.  Then leave it until the clay cures.
  3. Sand down the epoxy clay until the plastic shows through (I used a 120-220-400-800 grit progression of sandpaper).
  4. Coat with lacquer to make it shiny.  I used shellac at first, then switched to polyurethane as it was easier to use (shellac has a very short work time and also discolours in water) and food-safety wasn’t a concern.

I actually did step 2 in reverse because I’m a terrible engineer and didn’t think to seal the gaps between the semidemihemispheres with clay until after I’d done the outer surfaces.

Epoxy clay turned out to be an effective material for smoothing and sealing 3D prints.  I bought 2 ounces of the reddish-brown (“flesh” coloured) stuff on eBay and later supplemented it with a 1 lb. white batch of the unsettlingly spelled Apoxie Sculpt from Sculpture Supply Canada (n.b. what I discovered regarding the difference between Apoxie Clay and Apoxie Sculpt).  The clay doesn’t adhere well to ABS as you’re applying it, I had to keep my fingers lubricated with water so that I could press the clay into the object’s filament ridges without the clay sticking to me.  (The water also made it easier to smooth the clay out so that I could squish it into a thin layer that was quick to sand down.)  Once the clay cures it’s really fricking hard to get it off of whatever it’s on, but it sands and drills cleanly.

The clay can also be used for filling holes and errant curves (e.g. due to the bottom of a print curling up as it cools) and for making good-looking, smooth, heat-resistant surfaces (I made a totally sweet coaster).  It also takes acrylic paint a little better than ABS plastic does, which isn’t saying much.

Another miraculous substance that I’ve discovered is Plumbing Goop.  It’s clear, creates a thin layer, is very easy to apply, and sticks really well to ABS.  It doesn’t peel off like silicone rubber.  It also provides a rubber-like grip, something that bare ABS is sorely lacking.  The downsides: because it’s applied in a thin, clear layer, it’s harder to get a thorough seal with Plumbing Goop than with epoxy clay; it doesn’t make spherical prints look like Jupiter; it doesn’t smooth out the filament ridges; and it’s flexible (comparable to silicone rubber), which might not actually be a downside depending on what you’re doing.

]]>
Un-improving range on the infrared channel https://nrqm.ca/2011/10/un-improving-range-on-the-infrared-channel/ Tue, 04 Oct 2011 03:51:46 +0000 https://nrqm.ca/?p=668 It turned out doing software UART was a terrible idea.  The processor is way too slow to support a reasonable baud rate.  I did figure out how to use a comparator though: the key phrase I was missing was “rail-to-rail.”  That means that inputs can be in the full voltage range from ground to Vcc.  Another handy phrase is “push-pull,” which means that the comparator can output 0 and 1; in contrast, an “open collector” comparator can only output 0, and needs an external resistor to pull the output to 1.

I bought a rail-to-rail push-pull comparator, the MCP6541, and tried it with the receiver circuit, and sure enough it increased the maximum range significantly.  Unfortunately it also increased the minimum range significantly.

Here’s the circuit diagram for the modified receiver circuit:

Infrared receiver with comparator for amplification.

Infrared receiver with comparator for amplification.

The 1 kΩ and 10 kΩ resistors are in a voltage divider configuration to generate a 3.0 V reference against which the input is compared.  If the input is higher than 3.0 V, the comparator outputs 3.3 V, and otherwise the comparator outputs 0 V.

I guess there are a bunch of transistors inside the comparator, and putting them in a chain with the pair of external transistors messes things up.  I don’t know why, but it might be a gain-bandwidth thing (too much gain, lowers the maximum frequency the circuit can operate at).  This is what the output looks like at about 6.5 cm:

'U' character sent over infrared with infrared amplifier.

'U' character sent at 19200 bps over infrared with comparator amplifier.

The jagged bits aren’t there without the comparator.  I used the U character to test because its binary pattern is 01010101.  As you can see, the pattern is there but it’s kind of messed up and it’s dangerously close to 3.0 V.  (Now that I look at this again I see maybe reducing the 3.0 V threshold would improve the minimum range.)

I figured I could put an OPA2134 op-amp voltage follower in between the external transistors and the comparator.  This would de-couple the two sets of transistors, so the weird transistor chaining effect would disappear.  This worked perfectly, once, for no apparent reason at all.  Eventually, after spending a day trying to reproduce my success, I read the op-amp’s datasheet more closely and discovered that it’s not rail-to-rail and should never have worked (it can’t output the full 3.3 V signal, so the comparator’s input was never reaching 3.0 V).

I switched to a JFET op-amp that had rail-to-rail output, and it was able to transmit the ‘U’ character at a good set of ranges, both small and large.  Unfortunately this is the signal it was outputting, at 7.5 cm and at 2 cm:

'U' sent at 19200 bps over infrared with JFET voltage follower at 7.5 cm.

'U' sent at 19200 bps over infrared with JFET voltage follower at 7.5 cm.

'U' sent over infraret with JFET voltage follower at 2 cm.

'U' sent at 19200 bps over infrared with JFET voltage follower at 2 cm.

The observant among you, my imaginary audience, will notice two strange things from this screenshot:

  1. The signal is peaking at almost 4 V.
  2. It’s sending 9 bits at 7.5 cm and 19 bits at 2 cm.

Hoo boy, it didn’t work at all, and it was pure luck that the ‘U’ transmitted correctly at short range (followed, presumably, by a framing error that my system silently ignored).  No other character worked.

I found out that you can use an op-amp as a comparator, so I tried that with my OPA2134:

'U' sent at 19200 bps over infrared with op-amp comparator.

'U' sent at 19200 bps over infrared with op-amp comparator.

Okay!  You can see what it means that the amplifier is not rail-to-rail, it’s only going up to 2.6 V (and that only briefly), but if I remember correctly it received.  Unfortunately the high bits got narrower for some reason as the range decreased, so it didn’t actually do anything to solve the range problem.

I tried using the JFET amp as a comparator, but it didn’t output anything at all so I gave up and ignored the project for a few weeks.  My current solution is to pretend there isn’t a problem, and if I run into the  minimum range issue then I can just bend the receiver askew so that the signal is damped enough to receive.  In the meantime, the transmitter now has a wider field of view, which ought to make it easier to place several receivers in range of the control unit.

]]>
Improving range on the infrared channel https://nrqm.ca/2011/09/improving-range-on-the-infrared-channel/ Sat, 03 Sep 2011 19:15:55 +0000 https://nrqm.ca/?p=663 The range on the infrared channel, which I discussed in the last entry, is probably enough; but I’d like to increase it a bit.  With more range I can space modules farther apart if needed, and hopefully be able to have a wider angle between the transmitter and receiver.

Fortunately the signal output by the Darlington transistor pair on the receiver is a pretty clean digital signal.  At full power it ranges from (a little above) 0 V to (a little below) 3.3 V.  As the transmitter gets farther away the digital signal remains but the low voltage increases beyond the UART receiver’s ability to read a 0.  For example, at a large distance the UART signal might range from 2.5 V (logical 0) to 3.3 V (logical 1).

There are several options I’ve considered:

The handy old Schmitt trigger is the most straightforward, but it’s touchy to design and it will add a bunch of parts (an op-amp and a bundle of resistors).  I tried using a comparator chip, which is like the Schmitt trigger but simpler, but I found that it had a big limitation.  It worked, but the inputs can’t exceed Vcc – 1.5 V (the “common mode input voltage range” on the datasheet).  It can’t read a digital signal ranging between 1.8 (or more) and 3.3 V, so it would provide some amplification but not a lot.  I’m targeting 90% of Vcc as my threshold, so it should read anything below 3.0 V as low.  I also considered using another PNP transistor to amplify the difference between Vcc and the input voltage, but: that much amplification is risky noisewise, an extra transistor reduces the bandwidth too much, and the PNP transistor will produce a logically inverted signal.

Another option is to amplify the signal using crazy op-amp magic, but aaaaaaah no.

So I tried thinking like I’m supposed to for once, and I’m going to try a software solution.  AVR processors include an analog comparator, which I can (hopefully) use to amplify the digital signal coming from the infrared optotransistor.  The downside to doing it this way is that it bypasses the UART module, which means that the application needs to receive data manually (I can still use UART to transmit the signal).  Receiving data will tie up the processor, but as long as there’s enough time to run the receiver code it should be okay, I don’t foresee much data traffic.  Here’s a potential flow chart for the receive procedure:

Software receiver flow chart.

Software receiver flow chart.

Some notes:

  • The wait process is a euphemism for “disable the timer, store the data, blah blah blah, then go back to the program until the next start bit.”  This process takes place during the stop bit, so if there’s another byte incoming then it should finish in time to receive the next start bit.
  • Kevin Rosenberg’s awesome tool AVRCalc calculates that the 8-bit timer running at 8 MHz can be used to generate a 57554 Hz interrupt rate using an OCR value of 0x8A.
  • I might need to mess around with the timing so that the AC reads the right bit, but probably not.  There should be plenty of interrupt overhead delay, and the sampling rate is a little slow and will drift toward the end of the bit.
  • I’m not sure how long the analog comparator takes to produce a result but I’m guessing it’s pretty fast because it doesn’t have to do much.  The AVR datasheet doesn’t have much information on it.  I also don’t know if the comparator has a large common mode input range.

Failing that, I can look for an external comparator with a large common mode input range, or just suck it up and use an op-amp.

]]>
How I’m powering my acoustic modem https://nrqm.ca/2010/11/how-im-powering-my-acoustic-modem/ Wed, 24 Nov 2010 05:41:36 +0000 https://blizzle.cybertavern.net/?p=271 Power supply

A ±10 V power supply

I’ve covered how not to power an acoustic modem, and how I’d like to power an acoustic modem, now it’s time to tell how I’m doing it right now.

To restate and clarify the problem: I want to use an acoustic transducer to transmit and receive data via pressure waves.  The transducer I have transmits a 40 kHz carrier wave, and can be driven by up to 20 V.  That means that when transmitting, the circuit must alternate a 20 V signal back and forth between the transducer’s two input pins, once every 25 microseconds.  Additionally when receiving, the transducer’s output signal needs to be amplified into a usable signal.

Indulgent aside: When I started doing electronics it took me a while to get an intuitive understanding of voltage.  Not so long ago it clicked that when you’ve got a voltage source, as long as you’re careful, you can look at it in whatever way is most convenient.  A 20 V power supply is also a ±10 V power supply if you call the voltage at the halfway point “0 V”.  This can be quite powerful, for example, if its easier to see one part of a circuit as ranging from -10 V to +10 V and another part of the circuit as ranging from 0 to 20 V.  Of course doing so adds a wrinkle to documentation and maintenance, but it can make life easier when you’re thinking about the circuit.  (When you’re dealing with power currents (measured in the milliamps rather than the micro- or nanoamps), you also have to consider where the current is flowing and whether or not it’s going to cause noise in the system or blow up your components.)

In the image to the left, I have the red and black wire coming in from a variable DC power supply.  I have it set to 23 V, which provides plenty of room to regulate to 20 V.  This is a drop-in replacement for a few 9 V batteries in series.  To reiterate: this is dumb, a better circuit would only need a 5 V power supply, but as an alright man once said, “The way it is is the way it is.  We gotta deal with what’s in front of us.”

The 10 V regulator only provides a reference.  No current flows from the 20 V rail to the 10 V rail, so the regulator won’t burn out.  A better solution would be to use some precisely matched resistors to divide the 20 V in half.  That would be a bad idea if the 10 V rail was providing power, because then the voltage drop across the resistors would vary with the current flowing through them.  But since it’s only a reference, that’s not a problem.  Resistors would be better because each regulator draws several milliamps of current, whereas large resistances would only draw microamps.  Alas, I haven’t got precisely matched resistors (see the end of the previous paragraph).

In summary: this approach provides a stable, fairly precise ±10 V power supply.  It is perfectly acceptable for now, but in the future it will need to be replaced with a more power-efficient design.  Hopefully the final circuit will only require a 5 V power supply, but in the meantime this solution gives me a lot of room for error and lets me move on to other parts of the project.

]]>
How not to power an acoustic modem https://nrqm.ca/2010/11/how-not-to-power-an-acoustic-modem/ Sat, 13 Nov 2010 06:42:48 +0000 https://blizzle.cybertavern.net/?p=230 crummy power supply

How not to generate a ±10 V power supply

I feel pretty dumb talking to nobody like this.  My domain name doesn’t even work yet, but I guess logging is what engineers do.  And I’m imaginative enough to see the utility of it: it’ll be nice down the line to have a log to review, writing stuff down helps flesh out ideas, and an open design process will make it a heck of a lot easier to produce open documentation.  It will be tough to expose all my bad decisions and half-baked ignorance (and mixed metaphors), but I can suck it up.

My first project is to build an acoustic modem.  This follows the principle of multiplying work: the modem doubles as my class project for ELEC 571: Underwater Acoustics.  We’ve been using the Devantech SRF04 ultrasonic ranger in the mechatronics lab, and it strongly informs my design.  The SRF04 actually uses an RS-232 chip to generate ±9 V levels, which actuate a piezoelectric transducer.  I took a couple of the transducers from a broken SRF04 to use for my project.

I tried using an RS-232 chip that we had lying around in the lab, but those things have draconian current limits.  There’s no way I can power a whole circuit off of one.  I’m probably going to try it again soon though.

My solution: a DC/DC converter (AP34063N8L) to step up a 7.4 V lithium polymer battery up to 20 V.  Taking half the output as the reference voltage will produce a ±10 V power supply.  With that I can power pretty much anything I want.

I built the circuit shown above based on the AP34063N8L datasheet to step the battery up to 23 V.  It then uses four 5 V regulators to generate 20 V, 15 V, 10 V, and 5 V rails, of which I take 10 V to be the reference.  You may recognize that this circuit is completely ridiculous.

  • Problem #1: the circuit, under no load, draws about 30 mA, or 0.25 W of power (loading it increases the power consumption as you’d expect)
  • Problem #2: the 5 V regulators keep dying.
  • Problem #3: I basically stuck capacitors and inductors anywhere that they wouldn’t cause problems.

Problem #1 is the major stumbling block.  I will probably end up just using a battery pack or a few 9 V batteries to provide the ± rails.  That’s way less cool than using a DC/DC converter (or even an RS-232 converter) but it’s looking like a pretty sweet idea right now.

Problem #2 is interesting.  I’m not sure why, but I blew three regulators in one day.  They weren’t generating detectable heat or anything.  The circuit has the regulators chained together, so for example the one that generates 5 V is referenced to the negative rail and is powered by the regulator that generates 10 V.  The 10 V rail is referenced to the 5 V regulator’s output, and is powered by the 15 V rail.  And so on.  I assume this is a horrible way to do it.  It’s quite conceivable that the output pin on one of the middle regulators can’t sink current from a higher regulator, or maybe there’s some noise getting caught in a feedback loop.  Anyway I bought some 10 V and 20 V regulators.  I want to regulate the 20 V line to get rid of the ginormous ripple voltage coming from the step-up converter.

Problem #3 is mostly due to laziness: “I don’t feel like cutting another jumper wire, I’ll just use an inductor instead.”  And more capacitors can’t hurt, right?  Well, they also don’t help that much.  I did buy some 15 mH inductors to try to filter the power supply a little better.  They will be useless once I give up on this power supply and switch to 9 V batteries, but owning inductors makes me feel cool so it’s okay.

At this juncture it’s worth noting that I’m pretty much broke, so sometimes I’ll do things like build a crummy power supply because it’s cheaper (and niftier) than buying a few 9 V batteries, even though it’s actually way more expensive because I buy spare parts.  This is not my most admirable quality, and hopefully keeping this public logbook will help me develop better habits through shame.  On the bright side, my collection of useful components is expanding.

]]>