Pages: 1 [2]   Go Down
Author Topic: Making an USB-TTL using opto-coupler  (Read 5051 times)
0 Members and 1 Guest are viewing this topic.
Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@dc42

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  smiley-wink 

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.   

 
Logged

Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ...  smiley-grin   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:

import processing.serial.*;

Serial myport;

int portindex=5;
int myspeed=115200;

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

void draw ()
{
    myport.write(85);

 

Here the schematic of the com link channel.

 


* opto-coupler_link_V3.jpg (29.19 KB, 1024x478 - viewed 102 times.)
Logged

Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* opto-coupler_at_300.jpg (83.82 KB, 1024x768 - viewed 28 times.)

* opto-coupler_at_115200.jpg (82.43 KB, 1024x768 - viewed 30 times.)
Logged

Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Updated :

Success... smiley-grin

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:

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

pro5v328.upload.protocol=stk500
pro5v328.upload.maximum_size=30720
pro5v328.upload.speed=57600

pro5v328.bootloader.low_fuses=0xFF
pro5v328.bootloader.high_fuses=0xDA
pro5v328.bootloader.extended_fuses=0x05
pro5v328.bootloader.path=atmega
pro5v328.bootloader.file=ATmegaBOOT_168_atmega328.hex
pro5v328.bootloader.unlock_bits=0x3F
pro5v328.bootloader.lock_bits=0x0F

pro5v328.build.mcu=atmega328p
pro5v328.build.f_cpu=16000000L
pro5v328.build.core=arduino


Here a picture of my breadboard circuit setup.

I will post the final complete schematic later.

Now, I am ready for the PCB version.



* opto-coupler_prototype_linker.jpg (181.24 KB, 1024x768 - viewed 59 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

An alternate approach to the optocouplers in this design would be a digital isolator. 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. Standard digital isolators have different numbers of input and output channel combinations and can operate up to 150Mbps. Specialized products also exist for specific serial interfaces, such as USB and I2C. The ADuM3160 and ADuM4160 provide 2.5kVrms and 5.0kVrms isolation, respectively, for USB2.0 applications.

You can see the entire digital isolator product line available from Analog Devices at our web site: http://www.analog.com/en/interface/digital-isolators/products/index.html
Logged

Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@ADI_iCoupler

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

Quote
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.  

Quote
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 :
 http://www.analog.com/en/interface/digital-isolators/adum1201/products/product.html
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.

http://www.analog.com/en/interface/digital-isolators/adum1311/products/product.html
« Last Edit: February 24, 2012, 05:44:59 pm by Techone » Logged

Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Updated...

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.


* opto-coupler_with6N135_updated.jpg (47.26 KB, 1024x663 - viewed 84 times.)

* opto_coupler_setup_with6N135_updated.jpg (180.75 KB, 1024x768 - viewed 54 times.)
Logged

Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
   


* opto-coupler_link_final_test.jpg (185.01 KB, 1024x768 - viewed 39 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: April 16, 2013, 04:11:09 am by card5 » Logged

Pages: 1 [2]   Go Up
Jump to: