Byzantine circuits – Neil's Log Book https://nrqm.ca What could possibly go wrong? Tue, 04 Oct 2011 03:58:04 +0000 en-US hourly 1 https://wordpress.org/?v=5.4.1 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.

]]>
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.

]]>