I'm using BeagleBoard-xM McSPI to drive an MCP42050 digital potentiometer. Before using the SPI chip itself I'll try bitbanging through 3 GPIOs (but my question relates to both configurations).

BB outputs 1.8V for logic high (and, I think, 0V for low). But MCP42050 needs >3.5V for high (VDD = 5V, which is a must) and <1.5V for low.

What I need? A level shifter of course (3 actually, for each SPI signal). The problem is: I need to make one using only shelf components (common BJTs, resistors, FETs and so on).

I've seen this question and one of its answers almost resolved my issues.

Based on Glaser's solution (most voted), I've though myself to cascade two NPN BJTs sharing common emitter. Input signal connected to first BJT's base (limited by a R1 resistor). First BJT's collector connected to second BJT's base. And both collectors connected to 5V through two resistors (R2 and R3).

I could not find in MCP42050 datasheet how much current do I need to drive its input, so I suspect very little is needed. And that's why I've thought about a high value for all resistors, like 4k7 or 5k6.

Additional info: I think I don't need very high frequencies. The higher frequency involved is SCK signal, in bursts of 16 cycles, and BB-xM McSPI can work with frequencies as low as 4kHz (it froze when I tried 3kHz). The shift is unidirectional.

Here my questions:

  1. Will it work?
  2. How to compute R1, R2 and R3?
  3. It would be very nice to have both BJTs in a single component (Darlington pairs come to mind), but I don't know whether there is a shelf component for this. Do you know?
  4. I don't mind loosing some BJTs (to runaway breakdown, for example); but I do mind burning my BB-xM. How can I protect it against such accidents (specially when fiddling with resistors values)?
  5. Any other suggestion (instead of my cascading BJTs circuitry)?

Thanks. Sorry if they are newbie questions; they'll get harder as I improve my skills.


As noted by NickT there is a better circuit, using a single FET plus 1 resistor.

But now I stepped in another problem: I just found that BSN10A is not that common. Been to 6 local shops and no one have even heard of it. So now I'm looking for an equivalent component or circuitry.

Besides, the 4th question is still valid: how can I protect the Beagle?

  • \$\begingroup\$ The highest voted answer on your linked question isn't Glaser's, uses a FET and looks better than his (and yours). \$\endgroup\$ – Nick T Dec 16 '13 at 4:04
  • \$\begingroup\$ @NickT Thanks for noting it. I should have written "accepted" not "most voted". I'll take a closer look. \$\endgroup\$ – rslemos Dec 16 '13 at 9:47
  • \$\begingroup\$ Ask for an equivalent part at your local shops; all you need is a low Vgs(th) (<= 1.8 V) N-ch enh-mode MOSFET. Your local sources need to be wise enough to offer alternatives; nobody has everything. \$\endgroup\$ – Nick T Dec 16 '13 at 18:11

There is also a single-NPN possibility in that question that may work for your setup provided the output impedance of the 1.8V part is much smaller than the input impedance of the 5V part (this is certainly the case here). You'd have to adjust the resistor values.

Disclaimer : I'm the op of the linked question, but didn't use that setup extensively (I ultimately went for the 2-diode route).

  • \$\begingroup\$ Thanks for pointing that question; my search didn't found it. BJTs are a lot easier to find than FETs; I think they're also cheaper. I'll try it. \$\endgroup\$ – rslemos Dec 17 '13 at 18:35
  • \$\begingroup\$ I'm concerned about the part you say "this is certainly the case here". How do you know it? See, I'm trying to learn something here... did you look at MCP42xxx datasheet? In that case which parameter should I inspect (well, you can teach me even if you didn't look)? Or is just something like "from the top of may experience, usually ICs have a high input impedance". \$\endgroup\$ – rslemos Dec 18 '13 at 16:06
  • \$\begingroup\$ The previous comment also applies for the BeagleBoard GPIO output impedance. I mean, do you simply know (from your experience, or previous measurement) that they have indeed low impedance? Or this is (implicitly of explicitly) stated somewhere? \$\endgroup\$ – rslemos Dec 18 '13 at 16:10
  • \$\begingroup\$ It is usually the case for logic ic. But you are absolutely right, you should check the datasheets. They usually mention the maximum pin sink or source current instead of output impedance. \$\endgroup\$ – Nicolas D Dec 18 '13 at 18:18
  • \$\begingroup\$ I've did it with BC548B plus 3.3k and 10k resistors. Simulation in circuitlab (because I am pretty incompetent calculating currents involving semiconductors) went good (I mean: output voltage near 0~5V range and involved currents very low). I've assembled the circuit itself and measured everything and got values very close to the expected. Finally I've put the IC and... IT WORKED (right, you all knew it)! Well, I don't know yet how it will do under "load", because I can't turn the amplifier on this late. \$\endgroup\$ – rslemos Dec 19 '13 at 3:07

For just doing logic level conversion (not peripheral driving) I simply use 74-series buffers like the 74HC244-- It's sensitive enough for the ~2V and output at VCC(5V)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.