2
\$\begingroup\$

I have a problem in the design or my circuit. I need send data at a maxixum bitrate of 12000 bits /second. The high value should be +12v and the low value should be -12v providing at least 35mA of current. I initialy thought that I could easily get thoses values with the max232 chip. But when I did some tests, I could only get -7.25v, far from the -12v I need. The rest of the time, no data should be sent through the wire, so the current should be stopped logically. I made a diagram of the concept of my circuit so it's easier to understand : enter image description here I will use a 12v battery if need be, but I'd rather find a way to use a 9v battery. I would use a 5v regulator to get the 5v required for my microcontroller and then with my microcontroller I would send data. That data would then be converted to (+12/-12v high/low). The S6 Switch is used to stop the current when I do not wish to transmit data.

I've thought of a way of accomplishing all of that, but I have technical difficulties to achieve a logical spdt switch and on the whole I wonder wether it would work and if there wouldn't be a better design that mine. Here's a diagram of my first draft : enter image description here So I use an inverter schema with the IC MC34063 that will provide me with a -12v with 100mA. Then for the +12v I directly use the power source. I'm sure it's a good idea. Then I would use an electronic equivalent of a spdt switch (S1) connected to both the +12v and -12v driven by one or two pins of the microcontroller (preferably one). That should give me nice squared -12/-12v signals (not sure about that too) and then I would have electronic switch (S2) to open or stop the signal whenever needed.

So to sum up, my questions are :

1) Will my design work, what would be problematic ?

2) Is there a better design, maybe more efficient and with less components that mine.

3) How do I achieve the electronic equivalent of the spdt switch (S1) ? I've already opened a thread for S2 that was solved (see Electronic switch with negative and positive voltage)

4) With my design, will I get a nice squared -12v/+12v usable signal that will supply me with the 35mA I need ?

5) Can I work with a 9v battery instead of 12v battery ?

6) Can I use less microcontroller pins ? Ideally 1, but 2 would be okay as well.

Thank you for your help and inputs.

\$\endgroup\$
12
  • 1
    \$\begingroup\$ RS232 drivers already do exactly this job for you with charge pumps \$\endgroup\$ Jun 17, 2016 at 17:53
  • \$\begingroup\$ that's what I thought too, but which chip? because if you take a look at the max232 datasheet, it actually gives out -8,5v and +8,5v with four 0,1uf capacitors. \$\endgroup\$
    – smitchel
    Jun 17, 2016 at 18:21
  • 1
    \$\begingroup\$ Nobody says that you have to get the +/- 12V, those devices have been used in probably tens of millions of applications. With 3.3V voltage on Vcc they output something close to +/- 5V and still work faithfully. The standard if I remember well talks about minimum voltage levels of +/- 2.5V \$\endgroup\$ Jun 17, 2016 at 18:58
  • \$\begingroup\$ okay, I understand, be that as it may, it's not good for my circuit, I'm not looking for a solid -12v/+12v and unfortunately the max 232 does't seem to be a good fit. \$\endgroup\$
    – smitchel
    Jun 17, 2016 at 19:06
  • \$\begingroup\$ Just to understand, what is this receiver that draws so many current? And why does it need solid +/-12V? That is way beyond the RS232 specs. RS232 specifies receiver should have 3k impedance minimum, and should accept +/-3V. \$\endgroup\$
    – dim
    Jun 17, 2016 at 20:07

2 Answers 2

3
\$\begingroup\$

The other solution is very nice, but, as you mentioned you could actually put your transmitter device in a H-bridge configuration, we can make all this a lot simpler. First, no need to have a -12V supply, then. Second, there are ICs we can use. Yes sir. And I claim I have the solution with one single chip.

The trick is to use a simple MOSFET driver to directly drive the transmitter device. We need to drive it at both ends, so current can eventually flow both ways. So we need a dual MOSFET driver. We'll be using one that has an interesting configuration for what we need: the MCP14E8. It is interesting because it has an output non-inverted and another inverted, and it has enable pins. That's all we need:

enter image description here

Oh my god, it's beautiful.

This chip accepts 3.3/5V logic levels even when supplied with 12V. It can provide as much current as you may need (specified for 2A peak - continuous is not specified, however, because it is not really the purpose of these chips, but it certainly is more than what you require).

Other possibility, with FAN3223

enter image description here

For the supply part, if you use a 12V battery, there is nothing more to do. If you want to use a 9V battery, the charge pump trick with a spare MCU pin can be applied. Here is a charge pump that outputs 12V from 9V, and that can deliver 1W power at about 85% efficiency:

enter image description here

Circuit pastebin: http://pastebin.com/a3Mr7bq6 (note: blue text labels on input/outputs are wrong, should be "9V input" and "12V output")

The is exactly the same principle as in the other answer, except I chose to use mosfets here (this gives higher transient currents when state changes, but overall, the consumption is lower), and the charge pump outputs 3/2*VBAT instead of -VBAT. The trick here is to charge two capacitors in series through 9V, then we "split them" to get two times 4.5V, that we put in parallel and add to the battery voltage. Overall, we get about 12V (due to the diode drops).

This whole charge pump thing may seem a strange solution compared to using a cheap boost converter. But actually, if you use a small P-channel/N-channel pair in a single package (like DMG6602) and triple schottky diodes in single packages (like BAT54TW), it makes a compact solution with 3 tiny chips, 4 caps and 4 resistors only. And super cheap in volumes.

\$\endgroup\$
4
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$
    – Dave Tweed
    Jun 21, 2016 at 15:14
  • \$\begingroup\$ Okay, so I understand how it works and why you put the OUTA to INB so we use only one pin on the microctroller. I just have a last question, are you sure that I will get the -12v/12v needed? I mean, I don't understand something, when I put 1 on INA, I get NOT 1 on OUTA, which is 0? and then 0 is applied on INB that gives NOT 0 so 12v? Then when I put 0 on INA, I get NOT 0, so 12V ont OUTA and so 0V on OUTB. So it's always +12v, but I never have the -12v ? \$\endgroup\$
    – smitchel
    Jun 21, 2016 at 20:33
  • \$\begingroup\$ You got it. So we have +12V in both cases, but in one case, it is applied in a way and the other case, it is applied the other way. So if you consider only the TX component and the voltage across it, you get +12V or -12V of potential difference (12V-0V or 0V-12V), which is what counts. \$\endgroup\$
    – dim
    Jun 22, 2016 at 5:23
  • \$\begingroup\$ Okay, I understand now, thank you so much for all your help. \$\endgroup\$
    – smitchel
    Jun 22, 2016 at 7:35
3
\$\begingroup\$

This answer tries to solve the problem as originally stated. Which I understood as, basically, a level shifter that takes 0/5V as input and +12/-12V as output, with an enable/disable option that would put the output in high-impedance state. When enabled, this shifter must be able to source/sink at least 35mA. The timings, however, are not that critical (max switching speed about 10kHz).

Output driver

Here is the circuit I ended with. It is using only discretes (good ol' BJTs), but not many of them. It take +12V and -12V as supplies, and the ENABLE and DATA signals as 5V digital logic. Signal is delayed by a few µS (there is a small difference between delay on low-to high and delay on high-to-low transitions). To simplify the circuit, when ENABLE is inactive, the DATA input must be at low level. Otherwise, output will still be driven. The last important fact is that input and output have opposite polarity (as all RS-232 drivers, as I remember).

enter image description here

LTSpice asc file: http://pastebin.com/6hESR81u

There are a few tricks in this circuit:

  • The way the first stage of transistors is wired: instead of applying the signal to the base, we apply it to the emitters. But the result is actually simple: when the signal is low (and ENABLE high), Q1 is on and Q2 is off, and when the signal is high, Q2 is on and Q1 is off. Then, if Q1 is on, Q4 is on, providing +12V. If Q2 is on, Q3 is on, providing -12V. As simple as that.
  • The C1 capacitor: this tricks eliminates the shoot-through on transitions. When the signal changes, there is a short time (due to the inaccuracies, delays involved, ...) during which both Q4 and Q3 conduct. This creates a short from +12V to -12V, and a rather high current can be wasted. C1 forces Q4 and Q3 to change state at the same time, reducing this effect to a minimum.
  • It is the ENABLE signal which is used as the voltage source to feed Q1 base. If both DATA and ENABLE are low, no transistor is turned on at all.

Note that this circuit must be properly decoupled. Put a 1µ ceramic cap close to Q3 and Q4 supplies.

This circuit can provide at least 50mA of current, given the min Hfe of the transistors suggested. The base of Q3/Q4 are biased with about 1mA. You could go above that by diminishing R2-R9-R8-R4, but the circuit would consume more and the current sourced/sinked from the DATA input would be greater (currently about +/-2mA).

You can make it much faster by putting small caps (in the 100pF range) across the base resistors. But this is not necessary here given the timings required.

Supply

Now, this was just the output signal driving circuit. How about the supplies ? Well, using the MC34063 is a good idea. I have another one, but it is worth it only if you have a spare pin on the microcontroller on which you can output a PWM with 50% duty cycle at about 100kHz (does not need to be accurate). If it is the case, there is a smaller circuit, cheaper, easier to tune, that you can use to generate the -12V from the 12V of the battery. It is a simple inverter charge pump (actually what is done inside the MAX232).

Let's have fun with BJTs again:

enter image description here

LTSpice asc file: http://pastebin.com/QrumUYN3

The part between the input and C3 is yet another level shifting circuit: it takes 0-5V and just outputs 12-0V (inverting the polarity). But this one is made with fewer transistors, because... Well, because. Then, C3, D2, D3, and C4 actually makes the voltage inverting.

Don't forget the decoupling here also (at least 1µ at the 12V input).

This circuit easily provides 70/80mA of current. Note however that there is only one transistor stage, so the input requires about 5/10mA (sink/source) of current.

Now, if you really want to get +12V and -12V from 9V, this becomes impractical. Use both a boost and an inverter switching regulator.

\$\endgroup\$
1
  • \$\begingroup\$ Actually, I finally did a charge pump that converts 9V to +12V and -12V: pastebin.com/1y4qKwjU. It seems to have more than 90% efficiency. Oh my god, I love charge pumps. \$\endgroup\$
    – dim
    Jun 20, 2016 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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