Go Down

Topic: Making an USB-TTL using opto-coupler (Read 10750 times) previous topic - next topic



Yep... I agree with you. The optocoupler I have is slow. I am trying to "push it" to make it work. I have to admited, the 2N3904 is an excellent transistor - for amplification, up to 300 MHz, 35 nS <-- rise & fall - switching -time. excellent cheap transistor...   I will have to buy the 6N135 for this particalar project application. And I prefer DC couple, if it work - practicaly.   Thank for the tips.

Updated :

I did the loop-test.  My setup is : USB - mini adapter - ( come last Friday from http://www.hvwtech.com , a bit expensive - 23.05 ca -  it is a excellent USB adapter ) , connect the 3 channel using my circuit... power up, USB connected and a 4.5 V connect... use the serial monitor, select 300 and type : test and I got : @$%&  <--- BS data !  re-tested at 115200, same output : &%@& <-- BS output... Humm...  :smiley-roll:

Ok, time to re-design and re-test a new circuit. This time, instead using a frequency generator, I will be using the USB adapter as a square wave generator and do a small Processing program to send a : 0101010101  <-- this patern. I will use my scope to see the waveform, and design from there. Heh... it's "breadboarding" time  ;) 

Let see ... Start bit, 8 data bits, Stop bit , no parity.   It is this ? --- > Start -> 0 - LSB -> 1 - 0 - 1 - 0 - 1 - 0 - 1 - 0 <-- MSB - 1 <-- Stop bit.  Hex = 0x55  = Letter "U" ASCII  .... I am right ?  Anyone correct me here.

If am still having a hard time, I will buy the 6N135.   



Updated :

I re-tested and re-build the circuit. I use the USB-mini to test the signal output with the help of my scope. I test at low baud rate : 300 baud to 115200 baud. I did visit this site : http://saturn.uni-mb.si/~bojan/pdf/app45.pdf  It show design formulas to use a opto-coupler. Very informative.

In my new circuit, I still use a inverter buffer for input signal and output signal. I use a simple switching transistor circuit to drive the opto-coupler LED and keep the If lower than 10 mA.  At the output of the opto-coupler, Rc is a bit higher, 220 instead of 150, I did use 10 K first, but the output signal at collector was bad at high baud rate. So I lower until I have a proper output signal. The signal was ridding above 2 V ( 2 V to 5 V switching ), and I was thinking...hum... a comparator will clean that signal, and I did place a comparator - LM339, set the Vref about 3 V, and I got a NICE output signal ...  :D   Now, I am in the game... and place the signal to an inverter buffer, so it is 1 in , 1 out, 0 in , 0 out.

Here the Processing code I use to display a "square wave".  I use the character 85.

Code: [Select]

import processing.serial.*;

Serial myport;

int portindex=5;
int myspeed=115200;

void setup()
   println("Connecting to "+Serial.list()[portindex]);
   myport = new Serial(this,Serial.list()[portindex],myspeed,'N',8,1);

void draw ()


Here the schematic of the com link channel.



Here the pictures of the output signal at collector - opto-coupler pin 5.

Top picture : At 300 baud

Bottom picture : At 115200 baud

Next step : Wire up the others 2 channel link and do a Loop-Test. If work, upload a sketch into an Arduino chip.


Updated :

Success... :D

I did the "Loop Test" using the IDE serial monitor. I enter : "this is a test" and it echo. I test every baud rate, from 300 baud to 115200 baud. It echo exactly I type on all baud rates. So the final schematic work.

Next step : upload a sketch. I did that and worked just fine. I was using the USB mini, so I select the board : Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328, so the baud rate it was uploading is : 57600 baud., but I try UNO, but it failed to upload, which make sense because it is not a UNO board being program.

Here the board section of the file : boards.txt

Code: [Select]

pro5v328.name=Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328




Here a picture of my breadboard circuit setup.

I will post the final complete schematic later.

Now, I am ready for the PCB version.


Feb 24, 2012, 11:36 pm Last Edit: Feb 24, 2012, 11:44 pm by Techone Reason: 1

First... Thank for the link and the tips.

Digital Isolators are a more modern alternative to optocouplers, offering improved performance with lower power dissipation. They're also much easier to implement in a design since the inputs and outputs use standard digital logic.

I do agree with you... if I was planning for mass production of the linker. Or I order a PCB and plce the SMT chip in it. Yes in that case.  

The ADuM3160 and ADuM4160 provide 2.5kVrms and 5.0kVrms isolation, respectively, for USB2.0 applications.

Those chips are usefull if I was going to made a USB - "union" . The computer side and the device side power each side. Than those chips will work.

My project do not use the full USB. It use a FDTI, take the signal from it, and send toward an Ardiuno for : Programing transfer or data transfer. So those chips ADuM3160 and ADuM4160 will not be usefull in that application.  But this part at that link :
A dual-channel ( "East bound" / "West bound" ) - 2 way traffic. will work. I will need 2 of them if I was going to make / order a PCB accepting SMT part, and mass produce it... yes it will work. Before that, I need to order a sample and experiment with it to test the noew hardware version using those parts.

For now, my circuit design work and I will buy this week-end at Actice Component for a 6N135 and re-do the circuit using those parts to test at high speed.

Thank for the link and info.

Edit :

I found the right part for my project..if I smt's the project... 3 way com-link, 2 -East bound and 1 West-bound. I will need to test a new circuit with the use of the new chip.




I re-do the circuit using the 6N135. It pass the loop-test , even 115200 baud,but not the programing test <-- can only program once.

So I decide to keep the 4N35 design for a program linker. The new version with 6N135 will be keep as a comunication linker.

Here the schematic and my setup.


Updated :

I did a test to check data out and data in. In this tread, http://arduino.cc/forum/index.php/topic,94382.0.html, I did a Arduino code to send an ADC value to the PC using Processing, and the Processing code received the value and convert into a voltage and send the voltage value to the Ardiuno to be display on a LCD.

My opto-coupler work great, beside a few bugs <--- voltage a bit off and the display do : 2.345 <-- normal and also .345 <-- not normal.  To me, it pass the final breadboard test.

Now, I am in the stage to build the circuit.

Here a picture.


Apr 16, 2013, 11:08 am Last Edit: Apr 16, 2013, 11:11 am by card5 Reason: 1
Hi Techone

I re-do the circuit using the 6N135. It pass the loop-test , even 115200 baud,but not the programing test <-- can only program once.

So I decide to keep the 4N35 design for a program linker.

Didn't you try to see why the 6N135 isn't completely working right?
Maybe a slight change will solve the problem you mention, and then it'll be working perfectly..

If Data is passing well even at 115200,
but programming is not working,
maybe the problem is in the length of the DTR signal sent..

Maybe the chip makes the signal abit shorter, which can be fixed by making it abit longer for example..
It seems like the problem is in the Reset..

Did you try to see if you manually reset the board (before, after, or both) the upload, then the upload completes well?

Go Up