RX garbage from phototransistor+LM393+FT232RL - Page 1
Forum section: electronics / projects

author: okw
author_rank: Frequent Contributor
timestamp: March 27, 2024, 05:27:43 pm
content: Short story;DIY Fluke IR189USB clone (USB<->IR transceiver):-extremely sensitive to correct value of pull-up resistors on IR phototransistor and LM393 output.-low power on emitter IR LED.Long story;I've just finished to assemble a clone of the Fluke IR189USB (USB to IR module) based on an existing design (FT232RL and LM393). I built it for updating the firmware of my Fluke 289. It didn't work (updater couldn't establish link). I then tried to manually send commands (ID, RI, DS, etc) while I tweaked all resistors, and after a while my Fluke 289 responded correctly (factory resets the meter, default settings, etc). Except the received IR message was garbage. I narrowed it down to being very sensitive to pull-up resistor values of IR phototransistor (R6) and RX line (R3) between LM393 and FT232RL. In the DIY schematics, they use R6=1k (phototransistor) and R3=12k (LM393 and FT232RL) pull-ups, and many users have reported success out of the box. But with these values, I only receive garbage (K„ÔÛ˚nœ√Ûœ√˚Ô√√€Ôˇ). I connected two potentiometers and started to tweak them while constantly sending 'ID' until I received the readable response "FLUKE 289,V1.10,1069xxxx". I achieved this with R6=2.2k(ish) and R3=31.21k(ish) but it drifted off without even touching the potentiometer and I would receive something like "ê..LUKE 209,V1.1 (1 69 029". I should probably add a fixed resistor in series with a very small value potentiometer (or a multi-turn pot), to form a center around 2.2k and 31k, so I could properly fine-tune, but could this sensitivity be a symptom of something else? Junk LM393 (I only had 10 Aliexpress chips lying around, and none from reliable sources). Or could some filtering help?PCB is quite neatly routed, so I don't suspect this as a noise source.Also, how do I deal with the low LED output? If I set my power supply to 5V/20mA, the IR LED is quite bright in the webcam and draws 18mA@1.26V.In the current design the LM393 is only able to provide the LED 0.95V@0.2mA. While it actually works, I'd like to increase range... External transistor seems excessive as LM393 should be able to sink at least 4mA?I have no datasheet for the IR LED nor the IR phototransistor.

author: zilp
author_rank: Frequent Contributor
timestamp: March 27, 2024, 07:47:52 pm
content: You don't have an oscilloscope to look at the signals? That certainly would be helpful ...An LM393 certainly should be able to sink more than 0.2 mA at 4 V.As for that voltage divider: USB Vbus might just be too unreliable for this if you really need tight tolerances. But then, ideally, you'd adjust the pull-up/bias of the photo transistor such that you get significant voltage swing. If you can't look with an oscilloscope, the best idea I can think of would be to test this statically by pointing your own IR LED at the transistor that you try to trim to a similar brightness as your real source using your web cam, then you can just measure voltages with a multimeter.

author: moffy
author_rank: Super Contributor
timestamp: March 27, 2024, 08:49:04 pm
content: R3 needs to be a high value 31k and weak output on the Tx LM393, you have a common problem.1. Check the 0V supply pin and the positive supply to the LM3932. If OK change the chip from a reputable supplier.

author: Andreas
author_rank: Super Contributor
timestamp: March 27, 2024, 09:57:31 pm
content: Hello,the problem with a phototransistor and a fixed comparator level (2.5V) is that the range where it works is rather tight.Collector resistor too low -> level is not reached.Resistor too high -> Photo transistor goes into saturation and gets rather slow (suitable only for baud rates below 4800 Baud)In my AD587LW receiver I use a additional transistor to generate the TTL-Level and let the Photo transistor never saturate.Eventually you have to invert the RXD polarity see here:https://www.eevblog.com/forum/metrology/ad587lw-10v-precision-travel-standard/msg1988552/#msg1988552For sending I would connect the LED directly to the FT232RL (via a 1K resistor).with best regardsAndreas

author: okw
author_rank: Frequent Contributor
timestamp: March 29, 2024, 11:18:38 am
content: Attached is the waveforms when pots (R3 and R6) are set in a position so RX is most readable. Still many garbled characters, but the best I could do.CH1 is taken directly from phototransistor leg (going to LM393 non-inverting input) and CH2 from RXD line (LM393 output).Quite slow rise on LM393 output (CH2). Perhaps reduce R3 for faster pull?Could it also be that the phototransistor doesn't react fast enough? Maybe I need a more sensitive one?Update: I found a multi-turn 4.7k pot, so I managed to finely tune R6. Found messages to be quite consistent and readable between 1.478-1.556k. Anything outside that would mess up more and more characters the further off I went. But it wasn't completely consistent. Seemed the ack or termination character would print either on the end of the message or at the beginning of the next.So I replaced the pot with a 1.5k 1% resistor at R6. But that didn't help at all. Now it was completely garbled again. (Yes, I measured ~1.5k at the end of the potentiometer wires, to account for the wire etc. - what R6 pads actually sees). WhenI also tapped in to the Fluke 28x firmware update, and this is what the program sends (to try to initiate comms):0x10 0x02 0x03 0x10 0x03 0xA2 0x8E (plus carriage return i think: 0x0D 0x0A).And when I send this manually, I get this response:.....√Ì(so it must be a valid message I'm sending, since no other messages gives response (except the ones in the spec document)).Perhaps the updater switches to a lower, more safe/noise resistant baudrate(?).I tried the firmware update when I tuned R6 to nearly perfect (20-30 in a row) responses from command QDDA (dumps readings present in the meter LCD), with no luck.

author: zilp
author_rank: Frequent Contributor
timestamp: March 29, 2024, 12:40:54 pm
content: Quote from: okw on March 29, 2024, 11:18:38 amThat might also be a problem, but your primary problem for now is ...Quote from: okw on March 29, 2024, 11:18:38 am... this.At that baud rate, you need faster edges from the photo transistor. Does your PT have a base pin? If so, connecting that to the emitter through a resistor might speed things up a bit,maybethat would be enough. Otherwise, you need a faster transistor. Or you could try hooking it up to a transimpedance amplifier, I guess ... but my guess would be that using a faster transistor would be easier ;-)Of course, if you can reduce the baud rate, that can also solve the problem.

author: okw
author_rank: Frequent Contributor
timestamp: March 29, 2024, 01:43:26 pm
content: The phototransistor only has two legs (CE), no base.I'll look for a faster phototransistor. How do I determine the required rise and fall time for 115200 baud? The bit length at 115200 is 1/115200 = 8.68uS. Most uarts sample multiple times before trying to match the samples to interpret it into a bit. So how many samples does the FT232R sample for each bit (8.68uS), and how many of them does it require to match a bit?

author: zilp
author_rank: Frequent Contributor
timestamp: March 29, 2024, 02:17:44 pm
content: Quote from: okw on March 29, 2024, 01:43:26 pmWell, yeah, I didn't really pay attention to the time scale before ... that might just be too fast for phototransistors, at least in this simple configuration (i.e., without a transimpedance amplifier) and with that brightness of the source (you probably could speed up switch-off with a stronger pull-up, but then, switch-on would be slower and you'd need more light to speed that up, too ...).Quote from: okw on March 29, 2024, 01:43:26 pmI have no clue, but you certainly want to be way closer to the ideal wave form. Mind you that this isn't just about bits being the right length, it's also about knowing where bits start and end in the first place. The UART uses the first edge of the start bit to determine the position of the bits in the byte, and if you were receiving bytes back-to-back, chances are that that first edge doesn't even start at the same phototransistor voltage every time, thus jittering around when the UART is even sampling in the first place. Add to that the varying widths of bits, and the error in the sender's bit rate, and the error in the UART's sampling rate ... and you are pretty much guaranteed garbage ;-)You at the very least want the high and low levels be consistent between all bits, not a situation where some bits reach only 75% of the level of other bits.

author: okw
author_rank: Frequent Contributor
timestamp: April 07, 2024, 02:00:14 pm
content: I've looked through like 80 datasheets now, and they all mention exclusively 15uS as rise/fall time. But they differ in:Collector dark current (from 30 to 100nA max)Collector-Emitter Saturation Voltage (from 0.2 to 0.4V max)On State Collector Current (0.6-3.0mA typ)What spec could help the sensitivity and give faster response?The internal Fluke LED+phototransistor is fixed and can't be adjusted, so I have to tweak my USB-to-IR dongle.

author: janoc
author_rank: Super Contributor
timestamp: April 07, 2024, 02:06:29 pm
content: You probably need a photodiode and a transimpedance amplifier. Phototransistors are going to be too slow for this application.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 07, 2024, 04:35:58 pm
content: Yeah, plain phototransistor is N/A here. You could abuse a 4N35, with its base pin, to get higher bandwidth (B-E resistor, cascode, or build a transresistance amp around it), but this still doesn't go very far and you're pretty quickly needing a lot more circuitry to push bandwidth up. The next step up is a photodiode and amplifier type, like 6N136 or much more practically speaking SFH6345 (actually usable common mode isolation), or full logic isolators like 6N137, various HCPL-xxx, etc.Or non-opto entirely like ADUMxxx and etc. There are basically two families of these, I think: inductively coupled (AD's family), and capacitive (everyone else; TI and Silicon Labs (now Skyworks) are the most prominent). Either way, differential connection is used, with a modulation scheme, and monolithic features with excellent insulation (polyimide or SiO2). (Yes, monolithic transformers, they're using inductive coupling on mm-scale chips, pretty cool they pulled it off at all.) They're very easy to use and the simpler / lower bandwidth ones are often cheaper than optos.Tim

author: okw
author_rank: Frequent Contributor
timestamp: April 07, 2024, 05:34:10 pm
content: The original product (Fluke IR189USB) supposedly have a phototransistor and a LED. And a lot of DIYer's made the exact circuit with success.

author: BrianHG
author_rank: Super Contributor
timestamp: April 07, 2024, 06:03:17 pm
content: You should be using a photo-diode, not a photo-transistor. A slow photo-diode is in the 25ns response time while fast ones go below 2ns. Photo-transistors are just too slow and insensitive.There are also much better choices than the LM393, but for a serial port, you can use them.Just a single transistor amp, like a 2N3904, or better yet, I used to use MPSH10, or their smt equivalent & I could easily get 1 megabaud with clean square waves.

author: okw
author_rank: Frequent Contributor
timestamp: April 14, 2024, 12:46:22 pm
content: I've bought some photodiodes, waiting for them.I've also eliminated the comparator and replaced by transistors.Would this be a better approach?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 14, 2024, 08:02:13 pm
content: R8 needs to be a pull-down, not up; as shown, RXD is stuck high. A little pull-up voltage is still desirable (to get Q3 close to conduction, otherwise the photocurrent has to charge the base all the way up from GND before it starts turning on), but this may be sufficient for the application. Q3's own current draw also helps; probably the resistor will be quite large (100k?) and both base and resistor currents contribute.Tim

author: coromonadalix
author_rank: Super Contributor
timestamp: April 15, 2024, 10:50:26 am
content: have you seen this thread w a schematic ? could give you some tips ?i'm checking theses threads and this one, i want myself to build an gossen metrawatt infrared interface ....https://www.eevblog.com/forum/projects/ft232rl-based-ir-transmitterreceiver-disconnecting/orhttps://www.eevblog.com/forum/testgear/fluke-87iv-please-whisper-in-my-ir-p/https://www.vintage-radio.net/forum/showthread.php?t=146396

author: 2N3055
author_rank: Super Contributor
timestamp: April 15, 2024, 12:32:01 pm
content: How about just using something like OPTEK TECHNOLOGY OPL551 ?