Author Topic: Comparator rise time issue  (Read 4440 times)

0 Members and 1 Guest are viewing this topic.

Offline int2strTopic starter

  • Regular Contributor
  • *
  • Posts: 96
Comparator rise time issue
« on: April 06, 2015, 11:58:33 pm »
I made a simple circuit to turn a really messy 3.3V signal (far from square) I'm getting from a Bluetooth module into a nice clean & square 5V signal to be used by a micro controller.

I don't have the schematic handy, but you can see the detail from this board image:


The NTE922W is a comparator equivalent to the LM311.
The switching time in the datasheet is listed at 200ns typical.

This circuit works great at 9600baud however, at higher frequencies, the rise time on the comparator output becomes very rounded off and even at 57600 it never reaches a "flat" 5V.

Is there something I'm missing about the rise / turn-on delay of these comparators?

Thanks!

 |O
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 1899
  • Country: au
    • Halestrom
Re: Comparator rise time issue
« Reply #1 on: April 07, 2015, 12:27:13 am »
Can you observe what happens on a scope?

I've found that whilst some datasheets specify a rise time in just ns, others specify it in ns per V.  Additionally this is specced when driving a certain impedence.

Offline JoeN

  • Frequent Contributor
  • **
  • Posts: 991
  • Country: us
  • We Buy Trannies By The Truckload
Re: Comparator rise time issue
« Reply #2 on: April 07, 2015, 12:27:19 am »
What module is this?  There are some modules that are open collector on TX with a weak pullup and that could account for bad rise times.  You would pull it up to the voltage you want (5V), not necessarily use a comparator in that situation.
Have You Been Triggered Today?
 

Offline int2strTopic starter

  • Regular Contributor
  • *
  • Posts: 96
Re: Comparator rise time issue
« Reply #3 on: April 07, 2015, 12:52:25 am »
Can you observe what happens on a scope?

Yes, I'll try to capture an image.
 

Offline int2strTopic starter

  • Regular Contributor
  • *
  • Posts: 96
Re: Comparator rise time issue
« Reply #4 on: April 07, 2015, 04:12:27 am »
Here are 3 captures of the problem.
The baudrates pictured are 9600, 57600 and 115200.

The yellow wave (CH1) is the non-inverting input of the comparator, which is directly hooked up to the 5V TX pin of an Arduino. The blue wave (CH2) is the output of the comparator (held high using a 100k resistor). The purple wave (CH3) is the comparator voltage on the inverting input of the comparator.

 |O
 

Offline int2strTopic starter

  • Regular Contributor
  • *
  • Posts: 96
Re: Comparator rise time issue
« Reply #5 on: April 07, 2015, 04:50:57 am »
 :palm:

Was able to solve the problem:
The 100k resistor was too much.
Changed it to 1k and voila... 120ns rise time.

Also, measured the switching delay (attached).
It's around 250ns, which is more than the 200ns in the datasheet, but I don't care. Won't affect RS232 even at 115200 (or more).

 :-+
 

Offline Rick Law

  • Super Contributor
  • ***
  • Posts: 3441
  • Country: us
Re: Comparator rise time issue
« Reply #6 on: April 07, 2015, 03:46:15 pm »
I made a simple circuit to turn a really messy 3.3V signal (far from square) I'm getting from a Bluetooth module into a nice clean & square 5V signal to be used by a micro controller.
...

What kind of MCU are you using?

The rise time or the messy square on my bluetooth doesn't bother my MCU (AtMega328 Arduinos).
 

Offline int2strTopic starter

  • Regular Contributor
  • *
  • Posts: 96
Re: Comparator rise time issue
« Reply #7 on: April 07, 2015, 04:28:24 pm »
The rise time or the messy square on my bluetooth doesn't bother my MCU (AtMega328 Arduinos).

The target is an ATMega328p.
It's inside an electric vehicle charging station.

Weird part is that the module works well on an Arduino UNO board, but doesn't work well on the charging station. So far my testing of the charging station is on the bench only, no AC current yet. So once the unit is up and running, I have no hope at all that the Bluetooth module without any help will work reliably.

With the new resistor the circuit is working great. Will post another follow up screen capture with the module in place to show the actual signal from the Bluetooth module and the resulting output form the posted circuit.
 

Offline int2strTopic starter

  • Regular Contributor
  • *
  • Posts: 96
Re: Comparator rise time issue
« Reply #8 on: April 08, 2015, 02:35:18 am »
Here's what the signal looks like from the actual BT module "before" (yellow) and "after" (blue).
 

Offline Rick Law

  • Super Contributor
  • ***
  • Posts: 3441
  • Country: us
Re: Comparator rise time issue
« Reply #9 on: April 08, 2015, 03:44:38 am »
It is a slow but steady rise.  Interesting that it is causing you problem.  I would expect that as long as it is not oscillating (just-above/just-below the threshold), it should be fine.  I would expect once it reach 2.X volt, it would read HIGH and that's that, so a steady rise should be fine.

I just recently connected an Arduino's Tx/Rx shared with a bluetooth for both a personal project and a planned gift.  Since Arduino is at 5V and the bluetooth is at 3.3V, I had more problem with signal at LOW than at HIGH.  I needed to add a pull-down on the Arduino's TX to get the bluetooth's LOW to be able to pull the Arduino TX down to LOW.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf