Comparator rise time issue - Page 1
Forum section: electronics / beginners

author: int2str
author_rank: Regular Contributor
timestamp: April 06, 2015, 11:58:33 pm
content: 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!

author: Whales
author_rank: Super Contributor
timestamp: April 07, 2015, 12:27:13 am
content: 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.

author: JoeN
author_rank: Frequent Contributor
timestamp: April 07, 2015, 12:27:19 am
content: 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.

author: int2str
author_rank: Regular Contributor
timestamp: April 07, 2015, 12:52:25 am
content: Quote from: Whales on April 07, 2015, 12:27:13 amYes, I'll try to capture an image.

author: int2str
author_rank: Regular Contributor
timestamp: April 07, 2015, 04:12:27 am
content: 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.

author: int2str
author_rank: Regular Contributor
timestamp: April 07, 2015, 04:50:57 am
content: 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).

author: Rick Law
author_rank: Super Contributor
timestamp: April 07, 2015, 03:46:15 pm
content: Quote from: int2str on April 06, 2015, 11:58:33 pmWhat kind of MCU are you using?The rise time or the messy square on my bluetooth doesn't bother my MCU (AtMega328 Arduinos).

author: int2str
author_rank: Regular Contributor
timestamp: April 07, 2015, 04:28:24 pm
content: Quote from: Rick Law on April 07, 2015, 03:46:15 pmThe 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.

author: int2str
author_rank: Regular Contributor
timestamp: April 08, 2015, 02:35:18 am
content: Here's what the signal looks like from the actual BT module "before" (yellow) and "after" (blue).

author: Rick Law
author_rank: Super Contributor
timestamp: April 08, 2015, 03:44:38 am
content: 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 apull-downon the Arduino's TX to get the bluetooth's LOW to be able to pull the Arduino TX down to LOW.