CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

4n35 optoisolator for DC voltage measuring

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
iman_zahari



Joined: 20 Jul 2010
Posts: 15

View user's profile Send private message Yahoo Messenger

4n35 optoisolator for DC voltage measuring
PostPosted: Mon Sep 27, 2010 1:33 pm     Reply with quote

Hi all,

I've encountered a problem. I've tried to set the input current to the opto by using 5V and 600 ohm resistor, resulting less than 10mA input current. On the output side, I have put the voltage to 5V and resistor as 1k. It outputs fine, however, when I decrease the input voltage the output voltage increases. Is the opto reverse biased? Thanks all.


Last edited by iman_zahari on Mon Sep 27, 2010 1:57 pm; edited 1 time in total
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Mon Sep 27, 2010 1:48 pm     Reply with quote

your question has nothing to do with programing or CCS.

but your issue is fairly simple..so
regarding your question:

if you decrease the input voltage, the LED inside the optocoupler will vary its intensity (until voltage drops below the forward bias voltage)... the photo transistor on the output side will consequently vary its output voltage proportionaly.

much like varying the voltage on a regular transistor input.

it also depends on where you opto is in regards to the resistor / load...
highside, lowside...etc


gabriel-
_________________
CCS PCM 5.078 & CCS PCH 5.093
iman_zahari



Joined: 20 Jul 2010
Posts: 15

View user's profile Send private message Yahoo Messenger

PostPosted: Mon Sep 27, 2010 1:56 pm     Reply with quote

I think I've mistakenly put the question there. When I increase the input voltage, the output voltage decreases. Is anything wrong my setting? It should be forward biased and proportional.

Regarding CCS, I'm using this for ADC input for my PIC which programmer is CCS :P. I'm sure details here will be useful for anyone to isolate their ADC in the future.
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Mon Sep 27, 2010 2:53 pm     Reply with quote

Gabriel has already described the main problem. It won't be proportional, because the LED has a forward voltage drop. Before anything happens. You need something over a couple of volts across the LED. Then, it is output _current_ that varies (not voltage), though a resistor allows this to then be converted to a voltage. Unfortunately, the current transfer ratio of the opto, varies massively between examples, so you won't get a reliable proportional output. Most simple opto's are also not very linear in the photo-transistor itself, and the gain also varies with temperature...
Now, there are solutions to this. The biggest variable, is the LED output, followed by the gain of the photo-transistor. Now these vary batch by batch, but two photo-transistors made on the same die, have very close gains. So opto's like the IL300, have two photo-transistors, one on each side of the opto, and built for good repeatability. You then adjust the current on the incoming LED, to give the required current on the transistor on this side of the opto, and duplicate the drive circuitry on the other side of the chip, so that you get a matching current there.
This involves having an op-amp to adjust the current through the LED with voltage, till the right current is flowing in the input side photo-transistor.
This is commonly used to opto-isolate voltage connections. Simpler, but more expensive, several companies make hybrid modules with all the required circuitry included.

With the opto you have, you have 'no hope'. Your circuit is reversed on the output, as voltage increases on the input, current here increases, making more current flow in the output transistor, and pulling the output down. Hence the reversal, which is easy to fix, but 'proportional', not without a _lot_ more work....

Best Wishes
iman_zahari



Joined: 20 Jul 2010
Posts: 15

View user's profile Send private message Yahoo Messenger

PostPosted: Mon Sep 27, 2010 3:03 pm     Reply with quote

Ttelmah, is there any good suggestion to isolate my input voltage? What is the norm in isolating the input voltage for ADC to the PIC?
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Mon Sep 27, 2010 5:40 pm     Reply with quote

Isolating analog voltages is hard and expensive. You can use an "isolation amplifier" such as the Avago Tech HCPL-7520-000E or Analog Devices AD202.

A cheaper method is to put he A/D on the isloated side and use digital isolation between the A/D and the uC.

Another method is not to truly isolate, but use an instrumentation amplifier with good CMRR (common mode rejection ratio) instead.
_________________
The search for better is endless. Instead simply find very good and get the job done.
iman_zahari



Joined: 20 Jul 2010
Posts: 15

View user's profile Send private message Yahoo Messenger

PostPosted: Mon Sep 27, 2010 5:59 pm     Reply with quote

Sherpa, I've been there! LOL. My last project involves using HCPL-7520, but in my place it is quite expensive at 11usd per piece. I need to use 8! Thought the 4n35 can replace the 7520.

Btw, what do u mean by digital isolation?
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Mon Sep 27, 2010 8:40 pm     Reply with quote

The problem with the 4N35 is that it is meant to isolate digital signals. But if you put an A/D chip on the analog signal with no isolation, then you can use something like the 4N35 to isolate between the A/D and the uC. If it is an SPI type A/D you may only need 2 channels of isolation, clock & data.

Of course you will need isolated DC power for the A/D. If you don't need true galvanic isolation the instrumentation amp method may eliminate the isolated DC supply.
_________________
The search for better is endless. Instead simply find very good and get the job done.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon Sep 27, 2010 11:14 pm     Reply with quote

In a short, the said HCPL-7520 implements an amplifier and ADC on the primary side, a digital optocoupler and a DAC on the secondary, providing a considerably higher performance than analog solutions like Vishay IL300 or Avagotech HCNR200 - and a lower overall part count.

Most aspects have been already discussed, perhaps expect this one: To decide about the suitability of a solution, you should know about the requirements in term of resolution, accuracy and long term stability.

Furthermore, if you intend to design an analog isolation circuit yourself, start to study existing solutions, e.g. IL300 application circuits, and properties of optocoupler devices from the datasheets. Your previous contributions suggest however, that your not actually familiar with analog circuit design. So I fear, it's not a promising option for your present project.
languer



Joined: 09 Jan 2004
Posts: 144
Location: USA

View user's profile Send private message

PostPosted: Tue Sep 28, 2010 1:15 am     Reply with quote

As SherpaDoug and FVM have mentioned, it all depends on your application. I would look at ADI and TI for reference designs as they're very well versed companies in analog design. However, in keeping with the MCP family, take a look at App Note 990 (Analog Sensors Conditioning Circuits) and the Analog and Interface Guide.
iman_zahari



Joined: 20 Jul 2010
Posts: 15

View user's profile Send private message Yahoo Messenger

PostPosted: Tue Sep 28, 2010 4:25 am     Reply with quote

languer wrote:
As SherpaDoug and FVM have mentioned, it all depends on your application. I would look at ADI and TI for reference designs as they're very well versed companies in analog design. However, in keeping with the MCP family, take a look at App Note 990 (Analog Sensors Conditioning Circuits) and the Analog and Interface Guide.


I see.. Will take a look at it. Thanks languer
iman_zahari



Joined: 20 Jul 2010
Posts: 15

View user's profile Send private message Yahoo Messenger

PostPosted: Tue Sep 28, 2010 4:28 am     Reply with quote

FvM wrote:
In a short, the said HCPL-7520 implements an amplifier and ADC on the primary side, a digital optocoupler and a DAC on the secondary, providing a considerably higher performance than analog solutions like Vishay IL300 or Avagotech HCNR200 - and a lower overall part count.

Most aspects have been already discussed, perhaps expect this one: To decide about the suitability of a solution, you should know about the requirements in term of resolution, accuracy and long term stability.

Furthermore, if you intend to design an analog isolation circuit yourself, start to study existing solutions, e.g. IL300 application circuits, and properties of optocoupler devices from the datasheets. Your previous contributions suggest however, that your not actually familiar with analog circuit design. So I fear, it's not a promising option for your present project.


LOL, I guess I will just put the ADC inputs directly to the micrcontroller. The dateline is near, I need to put it on a PCB. Nevertheless, it is just a prototype. Maybe, for V2.0 I will put the opto. Hehe
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Tue Sep 28, 2010 4:44 am     Reply with quote

A lot of factors come into 'what is best'.
If (a common situation), you are dealing with 4-20mA in, then the IL300 'solution', can be very cheap, since you can power the input side op-amp, from the 4-20ma loop. Also, at very small cost change, you can use the TIL300, which offers improved performance over the standard IL300 part.

If dealing with pure 'volt to volt' situations, then the hybrids are probably the best, and give low part counts, but at a very significant cost.

The PIC itself, can be a very cheap solution. Use isolated power, to run a PIC, then send the data across the isolation barrier as digital data (I2C, async serial etc..). Something like a 12F675, plus a cheap opto, powered by a simple capacitive coupled charge pump, is probably about the cheapest solution in existence.

So the questions are whether power is available on both sides of the isolation barrier, what accuracies are needed, etc. etc.?.

Without power available, and if multiple inputs are needed, the hybrids often win, despite their high price, because the cost of providing power on the incoming side of the barrier, is usually nearly as much as these units...

Completely 'unpowered' solutions, to give anything approaching linearity, basically don't exist.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group