Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more. Accepting essential orders - here's how.
0

How to get 0V to 3.3V from -12V to 12V square wave
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: How to get 0V to 3.3V from -12V to 12V square wave

by stinkbutt on Wed Nov 24, 2010 12:52 pm

I dunno, I disagree Possum.

oPossum wrote:Consider the cost of a Zener.


3.0V Zener Diode from mouser: $0.03. $0.016 in bulk.
3.3 Zener Diode from Mouser: $0.03. $0.016 in bulk.

oPossum wrote:Consider the availability of a Zener.


Currently mouser stocks 29,500 of the 3.0's, 19,850 of the 3.3's.

oPossum wrote:Consider the specs of the micro. It is quite common for 3.3V part the require inputs to be +/- 300mV from supply, not +/- 700 like 5V parts.


Those are 2% tolerance parts. That's +/- 33mV.

oPossum wrote:Consider the speed of the circuit. A Zener has significant capacitance. This combined with a resistor will case slow edges.


Unless it's a signal on the order of 10 MHz, 30 pF of capacitance isn't going to do anything. The inverse of the RC time constant, using the 4.7K resistor adafruit suggested, is 7 MHz. That more than doubles the best possible response time of the LM339 which is 3 MHz.

Plus, the 4.7K resistor is a very conservative number, limiting the current to what, 2 mA? You could get away with a 1/2 W resistor much smaller at 330 ohms and still not exceed the power dissipation (also 1/2 W) of the diode.

oPossum wrote:Consider the power off, power up, power down and brownout characteristics. A Zener will not clamp to the rails.


As it's not a voltage regulator, but a signal clipping circuit, we don't really care about those characteristics. Most of these complaints are perfectly valid shortcomings of a Zener Diode voltage regulator.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: How to get 0V to 3.3V from -12V to 12V square wave

by oPossum on Wed Nov 24, 2010 1:25 pm

Cost: Cost is not price! Larger BOM = higher cost for example.
Availability: Do you have one on hand? Is it a stock component at the PCB assembler?
Voltage: Show me a Zener with Vf less than 600 mV.
Speed: You have made assumptions about Zener characteristics and performance needs.
Rail clamping: It matters if the micro locks up.
Last edited by oPossum on Wed Nov 24, 2010 1:27 pm, edited 1 time in total.
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
oPossum
 
Posts: 636
Joined: Fri Oct 26, 2007 12:42 am
Location: Michigan, USA

Re: How to get 0V to 3.3V from -12V to 12V square wave

by stinkbutt on Wed Nov 24, 2010 1:26 pm

Correction. The parasitic capacitance of the diode I just mentioned is 450 pF. That yields an inverse time constant of 500 KHz.

This is faster than the maximum response time of the LM339. However, dropping the resistance still fixes that, pulling you back up to ~7 MHz. And I seriously doubt he's operating on the order of MHz anyway, if he's using an LM339.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: How to get 0V to 3.3V from -12V to 12V square wave

by oPossum on Wed Nov 24, 2010 1:29 pm

stinkbutt wrote:This is faster than the maximum response time of the LM339. However, dropping the resistance still fixes that, pulling you back up to ~7 MHz. And I seriously doubt he's operating on the order of MHz anyway, if he's using an LM339.


LM339 is open collector. Pull up resistor will be in series.

Lowering the resistance injects spikes into the power supply.
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
oPossum
 
Posts: 636
Joined: Fri Oct 26, 2007 12:42 am
Location: Michigan, USA

Re: How to get 0V to 3.3V from -12V to 12V square wave

by stinkbutt on Wed Nov 24, 2010 1:33 pm

oPossum wrote:Cost: Cost is not price! Larger BOM = higher cost for example.
Availability: Do you have one on hand? Is it a stock component at the PCB assembler?
Voltage: Show me a Zener with Vf less than 600 mV.
Speed: You have made assumptions about Zener characteristics and performance needs.
Rail clamping: It matters if the micro locks up.


Seriously, read the original post. This is a senior project. A one-off.

We don't care about BOM's or PCB assemblers. And since he needs to clamp to 3.3V, not 600mV, I don't see the relevance. The forward voltage drop hardly matters when the output voltage is -12V, it's still going to register low, but you can always clamp that as well with a small drop Shottky if you really want to.

And the characteristics and performance needs are not assumptions, they're coming from the datasheets.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: How to get 0V to 3.3V from -12V to 12V square wave

by oPossum on Wed Nov 24, 2010 2:11 pm

I read this in the first post:

I also have to worry about timing so using an op amp without feedback isn't going to work either.


Based on that statement I assumed fast response may be important for this specific application. I chose rather low resistor values in the circuit I posted to maximize speed at the expense of power consumption. Much higher value resistors could be used in many applications.

I made an effort to understand the needs and provide a practical and functional solution that could be built with very common parts.

The Vf limits the negative excursion (voltage below ground). That may be important for 3.3V logic.

You gave an example of one specific Zener, they are not all the same. Don't assume they are.

If someone does not have a specific part, they have to get it. That costs time and money. Time and money are important to students.

Education is preparation for work. Why not learn? Why not be aware?

There are often may solutions to a problem. Take some time to consider the pros and cons of each and make an informed choice.
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
oPossum
 
Posts: 636
Joined: Fri Oct 26, 2007 12:42 am
Location: Michigan, USA

Re: How to get 0V to 3.3V from -12V to 12V square wave

by stinkbutt on Wed Nov 24, 2010 2:37 pm

I don't want to argue about this any longer. The thread's getting intolerably too argumentative. I think a Zener diode voltage clamp works out to an excellent solution to this problem. HOWEVER, despite that:

You are right and I am wrong; you are smart and I am dumb; you are handsome and I am unattractive; you are pleasant and I have a - strange... odor.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Please be positive and constructive with your questions and comments.