power supply – Neil's Log Book https://nrqm.ca What could possibly go wrong? Sat, 08 Feb 2014 23:16:55 +0000 en-US hourly 1 https://wordpress.org/?v=5.4.1 Strobe Guitar Tuner r2 Design Changes https://nrqm.ca/2014/02/strobe-guitar-tuner-r2/ Wed, 05 Feb 2014 07:14:14 +0000 https://nrqm.ca/?p=991 Circuit board rendered by oshpark.com.

Circuit board rendered by OSH Park.

I’ve learned a bunch about making circuit boards at work recently, so I decided to re-do the ol’ strobe guitar tuner project from 3 or 4 years ago.  The original still works… sort of.  I have to power it from a 3x AA battery holder that’s clipped to the power terminals with alligator clips.  It doesn’t tune the low E string properly for some reason.  The input’s inflexible, and it’s hard to reprogram.

The hardware has been updated in the following ways:

  • I’ve learnt how to use KiCAD for circuit design.  It’s a lovely open source EDA tool that handles schematic design, layout, and automated trace routing.  ExpressPCB was okay for the original tuner, but this board is a bit more complicated, complicated enough that laying the circuit out manually would be difficult, tedious, and error prone.  Plus I need to output gerber files, because…
  • … I’m going to get the PCBs manufactured instead of etching them manually.  At work I needed 24 little boards manufactured for a project and went with OSH Park.  I was very happy with the outcome OSH Park is a great batch service, they can make two-layer boards with silkscreen and soldermask for a reasonable price in low volumes.  The main downside is their lead time is around a month.  I also considered circuits.io, which seems like a really cool idea, but their design tools seem rudimentary (or maybe I’m just not accustomed to them), they use OSH Park on the back end so they’re more expensive, and they don’t allow full control over the board’s source files (that is, you can’t download them in gerber format).
  • The battery supply has been changed from a coin cell to 2x AAA batteries.  The battery holder will mount on the back of the board.  I’m a little concerned that it won’t be as comfortable to hold as the old version, we’ll see.  Battery life is also suspect, I figure a pair of AAAs should last something over 10 hours.  Is that long enough?  Probably, right?  It’s only going to be on for a few minutes at a time and I can program in an automatic shut-down if it gets left on.
  • There’s a real power switch that will disconnect the battery instead of putting the MCU to sleep.
  • There’s a switching regulator now.  I added the regulator, configured to output around 2 V, so that all the LEDs are delivered a constant current over the lifetime of the batteries.  Without the regulator the LEDs get dimmer as the batteries drain.  I chose a switching regulator instead of a linear regulator mainly because it’s cool and I’ve never used a switching regulator before.  Also it has a very low dropout (about 0.05 V) and will be more efficient for most of the battery’s lifetime.  Fun fact: the first regulator I chose was the only cheap 2.0 V fixed-output switching regulator on Digikey, but I failed to notice at first that it’s 1.5 mm long and 1 mm wide.  It fits six surface mount pads in that area, and has no leads.  I’m not soldering that by hand, but I applaud its existence.  Well played, Texas Instruments.
  • There’s a 6-pin PDI port for programming the microcontroller in the circuit.  As you can see the MCU is a TQFP chip that’s soldered directly to the board, so a programming port is necessary.  It would be cool to get a USB-capable MCU so that tunings can be set from a host computer without reprogramming the board, but that’s a feature for the 2018 version.
  • I spent a long time trying to figure out the human-device interface.  My original tuner just had a 6-way switch to select one of the six notes in the standard guitar tuning.  I wanted the interface to be flexible enough to support multiple tunings–not that I’m a competent enough guitar player to need multiple tunings, but it seems like a good idea nonetheless.  I considered two rows of LEDS, one to indicate the current note and one to indicated the selected tuning.  I also considered a dual 7-segment LED display to display the selected note in scientific pitch notation (e.g. E2, A2, G3, D3, B3, E4).  Finally I settled on a single 7-segment display, which I thought was pretty clever until I went back and looked at the project my original tuner is based on and discovered that’s what they’d done in the first place.  The user controls the tuner with two buttons to navigate up and down, and one button to switch mode between tuning select and note select.  Again, how comfortable will be to operate the switches one-handed while holding the tuner without risking electrostatic discharge in the components next door is an open question.
  • The MCU is an ATxmega8E5.  I’m coming around to the xmega line, although it’s kind of caught in the middle between ARM and the old megas.  The xmega library is more sensible than the mega’s library, the xmega has more features, and it costs about the same as an equivalent mega.  Originally I intended to use an ATSAMD20E14A, one of Atmel’s newish ARM Cortex-M0+ chips.  They look like nice MCUs and cost about the same as an equivalent mega/xmega.  One of the reasons I started this project was to get some experience with ARM.  Unfortunately that chip (and other ARM chips I looked at) has a maximum current output of 3 mA on I/O pins when powered with 2 V, so it’s really not suitable for an application that boils down to turning a bunch of 10 to 20 mA LEDs on and off.  The xmegas allow 25 mA per pin.

Next step: reviewing and tweaking the PCB design and ordering a few boards.  They should be here in a month or so.

]]>
Poor man’s IrDA for intermodular communication https://nrqm.ca/2011/06/poor-mans-irda-for-intermodular-communication/ Fri, 24 Jun 2011 21:15:56 +0000 https://nrqm.ca/?p=614 If all goes extraordinarily well, the AUV will have the following modules sitting in the hull:

  • Acoustic modem
  • Motor control
  • Depth control (buoyancy control and pressure sensing)
  • Master controller

Rather than wiring everything together, I plan to give each module its own power supply and use an optical communication protocol to connect the modules to the master controller.  The inside of the hull will be cleaner and more solid than if everything was wired together, and waterproofing will be easier.  Here’s how it works:

I’m thinking about the depth controller at the moment, so take that as an example.  The master controller wants to send a depth set point to the depth controller.  In my current design, such as it is, the master controller sends a signal to a high-power infrared emitter via a transistor.  This could be e.g. a UART signal (inverted to be active high).  The infrared emitter lights up the inside of the hull with the signal sent by the master controller.  Everything receives this signal, so the frame will be addressed to the depth controller.  The infrared signal is transduced back to a TTL UART signal using an optical transistor and a pull-up resistor or filter, and the UART signal is fed to the depth controller’s UART receiver.  The depth controller transmits its detected depth back to the controller in a similar manner.  This is a very simple non-modulated (baseband) infrared communication protocol.

I can foresee several issues that demand exploration:

  • The emitter isn’t strong enough: I hope this won’t be an issue in a small, enclosed, dark sphere, but I might be able to arrange all the modules so that the IR components have line of sight.
  • Infrared absorption and reflection: the module casings will need to be transparent to infrared.  I currently plan to have most or all of the casings be made out of clear acrylic, and I will need to test the infrared transmission through air, acrylic and water.
  • Data rate: the two kinds of optotransistors I bought have rise/fall times of 10 and 15 microseconds, leading to a theoretical maximum throughput of 33 to 50 kbps.  I don’t need high-bandwidth communications though, so the data rate can be lowered easily to reduce interference.
  • Grim shadows: I am not designing the AUV to be sea-worthy, in part so I don’t have to deal with crud building up and blocking the optical signal.  The module casings should stay clean, and with only a couple wires inside the hull this is unlikely to be a problem.
  • Collisions: The master controller will initiate all communications, and all communications will be synchronous.  This is effectively a one-wire bus protocol, kind of like I2C with an asynchronous clock.
  • Other UART errors: Specifically framing errors.  Likely each module will have a crystal.  Even without a crystal, so few data will be transmitted at a time that framing errors should not be a problem, but I will probably keep a sanity check on the UART’s frame error detect bit just in case.

My original idea associated each module with a colour instead of an address, so a module would only receive data transmitted on the correct wavelength.  As a friend once said to me, “Rube Goldberg would be proud.”

]]>
Ruminations on guitar tuner mkII https://nrqm.ca/2010/12/ruminations-on-guitar-tuner-mkii/ Sat, 25 Dec 2010 08:45:21 +0000 https://nrqm.ca/?p=351 Moooooooo.

The old guitar tuner I made works fine, but I’m thinking of some improvements:

  • The first priority is to switch the power supply from a 16 mm coin cell to a 20 mm coin cell.  20 mm cells are way easier to find: the dollar store down the street carries 2032 cells (2032 means 20 mm diameter, 3.2 mm height), but 1632 cells are expensive and hard to find.  Right now I’m clamping a 3x AA battery holder to the tuner’s + and – power pins, which is not comfortable.
  • The rotary switch is too expensive.  A 0.1″ two-row header with a jumper to select the tuner’s frequency will be cheaper, and won’t be an ugly blue box.  This is still not as flexible as the 7-segment display the original project used.
  • I’d like to use a low profile DIP switch to turn the power on and off instead of (or in addition to) mucking around with sleep mode.
  • It would be cool to use a surface mount microcontroller and crystal.  Getting an STK 600 routing card for 14-pin SOIC AVR chips might be worth it if I find money somewhere.

I considered replacing the microcontroller with a 555 timer, but I don’t think the 555 timer will generate sufficiently precise frequencies because of the tolerances in the resistors and capacitors.

]]>
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 to power an acoustic modem https://nrqm.ca/2010/11/how-to-power-an-acoustic-modem/ Thu, 18 Nov 2010 22:21:10 +0000 https://blizzle.cybertavern.net/?p=261 I mentioned before that I’m basing my acoustic transducer off the Devantech SRF04 ultrasonic ranger.  I’m removing the piezoelectric transducers from a dead SRF04 unit and using them for my modem.  The transducers, which are the part that generate and receive the acoustic pressure wave that carries data, have a range of about 6 metres or so (one way), are driven with up to 20 V, and resonate at around 40 kHz.

The puzzle I’m working on right now is how best to actuate the transducer to generate a 40 kHz pulse.  The SRF04 does it using a chip that’s intended to convert 5 V logic signals into the ±12 V signals used for the RS-232 serial protocol.  Unfortunately most RS-232 converter chips aren’t made to power an acoustic transducer, and they aren’t able to provide enough current to generate a strong signal.

I bought a couple ADM208EANZ RS-232 converters, which seem like they should be able to provide up to 40 mA.  I didn’t read the datasheet carefully enough and failed to notice that it needs a bunch of 0.1 μF polarized (i.e. aluminum electrolytic) capacitors.  I have 0.1 μF ceramic caps, and I have various electrolytic caps, but I don’t have 0.1 μF electrolytic caps.  The chip will generate +9 V with a 10 μF cap, but it won’t generate the -9 V rail.  I have no idea why some circuits require capacitors with polarity, but if the diagram has a plus sign next to a capacitor you really need to pay attention.  Ceramic capacitors, which don’t have polarity, might not work.

(Most RS-232 converter chips generate ±9 V instead of ±12 V, presumably because ±9 V is easier.  The input is 5 V, then they put that through a voltage doubler to generate 10 V and put that through an inverter to generate -10 V.  Then I guess they put both through something that drops 1 V (a regulator or something to stabilize the output) and you end up with ±9 V.)

If the ADM208EANZ can power the transducer, I think it will be the best solution.  I see three downsides to using an RS-232 converter:

  1. You’re limited to an 18 V swing (or perhaps even less) instead of the full 20 V.  This isn’t a major problem because the transducer output is roughly a logarithmic function of the voltage input, so the output difference between 18 V and 20 V isn’t very high.  But if you want to upgrade your transducer to something like the Maxbotix MaxSonar-UT transducer, which takes up to 60 V, then you’re stuck at 20 V.
  2. The receiver’s amplifier is a little more complex because you have to operate it on a single rail (i.e. 0 V to 5 V instead of -10 V to +10 V).  This downside is overwhelmed by the upside of not having to generate a  ±10 V power supply.
  3. The SRF04 documentation notes that they had to turn the RS-232 chip off while receiving to reduce noise.  The noise is probably from the step-up converter and inverter that generate the positive and negative voltages.  This is pretty annoying, and now that I mention it I recall that the ADM208EANZ doesn’t have a disable feature.  I might be able to filter the noise.

The upside is that the RS-232 converter can be powered from the same 5V supply as the rest of the electronics.  It doesn’t need a complicated battery assembly or external step-up converter, or a bunch of regulators to generate reliable voltage rails.  It just needs a battery and one 5 V regulator, which is more power efficient and space efficient.

One final comment: ADM208EANZ looks like Adam 20 Beanz.

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

]]>