Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 27, 2024, 10:34:56 10:34


Login with username, password and session length


Pages: [1]
Print
Author Topic: Problem in Simulating Matrix Keypad Using Opto-Couplers?  (Read 4803 times)
0 Members and 2 Guests are viewing this topic.
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« on: August 25, 2016, 03:45:54 15:45 »

Hello! Everyone.

I have one User Interface Board with me, which is connected to a Customized Membrane Keypad of size 8x8.
I want to replace this Matrix Membrane Keypad with PC, which will simulate the keypress, so for this i used optocoupler as they can provide isolation and can be used as switch.

So i arrange 64 Optocouplers in matrix form and drive their primary(Led) side using Arduino Due, which is connected to PC using USB (Virtual COM) Port, when command is received from PC, Arduino Due turns on a particular Optocoupler to simulate the keypress.

Block Diagram is as follow:


The problem is that, it works in proteus but not in real hardware.
I simulated this on proteus for just 4x4 Matrix Keypad and using Arduino Mega not Due( as proteus doesn't have this )

Here is the Schematic Diagram. I am also attaching my Proteus project.



Now coming to my problem.
The default voltage coming from User Interface Micro-controller is 4.6V, if membrane keypad and my setup is dis-connected.
If i started inserting cables for connecting my setup with user interface board, then the voltage at collector of the first opto starts decreasing and it reaches 4.2V.

Now when i turn on the opto, the voltage on collector and emitter goes down to 2.3V, and this is detected as logic low by user interface micro-controller and that's why keypress never detected for the user interface micro-controller.

Please suggest what can i do make this work.
Tomorrow i will replace Arduino Due with Arduino Mega to check whether something works or not.

« Last Edit: August 25, 2016, 03:49:35 15:49 by xpress_embedo » Logged
Gallymimu
Hero Member
*****
Offline Offline

Posts: 704

Thank You
-Given: 152
-Receive: 214


« Reply #1 on: August 25, 2016, 03:56:55 15:56 »

couple things could be wrong:

you don't have enough transconductance gain in your photocouplers.
you are driving too much current into the LEDs (for instance 10mA times 4 LEDs is probably pushing the limit of the arduino)
R15 might be sized wrong (hard to see a value on it).

normally a setup like this is done with common emitter config but that will mess your logic

also check collector emitter saturation voltage for optocouplers

make sure you share all the part numbers and values (they are too hard to read on schematic)
Logged
Checksum8
Active Member
***
Offline Offline

Posts: 132

Thank You
-Given: 124
-Receive: 102


« Reply #2 on: August 25, 2016, 04:09:40 16:09 »

Have you thought about using analog switches? Something like a CD4066 or CD4053 etc.
Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #3 on: August 25, 2016, 04:18:16 16:18 »

couple things could be wrong:

you don't have enough transconductance gain in your photocouplers.
you are driving too much current into the LEDs (for instance 10mA times 4 LEDs is probably pushing the limit of the arduino)
R15 might be sized wrong (hard to see a value on it).

normally a setup like this is done with common emitter config but that will mess your logic

also check collector emitter saturation voltage for optocouplers

make sure you share all the part numbers and values (they are too hard to read on schematic)

I will not turn on more than two optocouplers at a time, and most of the times only 1 opto will be on.
R15 value is 1k i can't change the value of this as these are present on user interface board pcb.
I will check rest of the things and update here.

I had attached the schematic as zip file, so if u have proteus you can check exact value i used.
Thanks for valuable comments.

Posted on: August 25, 2016, 05:16:14 17:16 - Automerged

Have you thought about using analog switches? Something like a CD4066 or CD4053 etc.

I thought of using Cd4066, if this doesn't work i will definitely go for analog switches.
Logged
Signal
Active Member
***
Offline Offline

Posts: 200

Thank You
-Given: 113
-Receive: 81



« Reply #4 on: August 25, 2016, 06:34:16 18:34 »

I think your prototype has a mistake or connection to "user interface" board is not correct or your assumption about inner circuits in "user interface" board is not right. Circuit should work just fine.

I assume that the load resistance is not much lower than pull-down 22k (in parallel with 10nF). And obviously the source impedance is low enough to drive that 22k through original buttons. I'd start from measuring by uA-meter the current of shorted button.

Parameters of PC817 that are important here are:
1. Collector Dark Current is from 1 to 100 nA @25-75 oC
    100nA*22kOhm = 2mV is fairly good as a low level voltage;
2. Current Transfer Ratio minimum is 50%
    so for Ic = 4.6V/22kOhm= 210 uA, the If = 1 mA is more than enough.
3. CE saturation voltage will be about 0.2V@If=2mA and about 0.3V@If=1mA @Ic=0.5mA (from figure 12 in datasheet)


Posted on: August 25, 2016, 08:21:04 20:21 - Automerged

I thought of using Cd4066, if this doesn't work i will definitely go for analog switches.
Using analog switches grounds of both devices must be connected and at least all analog inputs have to be protected by diodes or analog switch IC should be powered from "user interface" board. Perhaps a usage of optos is more bullet-proof.

Posted on: August 25, 2016, 08:29:05 20:29 - Automerged

Do you check voltages by voltmeter or oscilloscope?  Did you consider a scanning process made by "user interface" board upon matrix?

Posted on: August 25, 2016, 08:32:37 20:32 - Automerged

If there is a complex scanning algorithm then bidirectional switches (like CD4066) might be needed.
Logged

Give a right name to a right game and play it right
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #5 on: August 25, 2016, 06:49:54 18:49 »

Quote from: Signal

Do you check voltages by voltmeter or oscilloscope?  Did you consider a scanning process made by "user interface" board upon matrix?


I checked Opto Voltages using Multimeter, just checked the Opto's transistor Collector signal (Drive pin coming from micro-controller) and it is a pulse of 2 ms.
Drive Pin-1 has 2 ms pulse, and at this time all drive pins are zero.
Then Drive Pin-2 has 2 ms pulse, and at this time all drive pins are zero.
Then Drive Pin-3 has 2 ms pulse, and at this time all drive pins are zero.

and so on..

Scanning process is like, User Interface Board Micro-controller sends 2ms pulse on drive pins and read the pins, if 5V is received then key is pressed.


Posted on: August 25, 2016, 07:47:54 19:47 - Automerged

Quote

If there is a complex scanning algorithm then bidirectional switches (like CD4066) might be needed.


Already covered in previous post, Drive(Row) pin is set high and Columns are read, if high is received then key is pressed otherwise not, this scanning is done for all rows.
Logged
enzine
Junior Member
**
Offline Offline

Posts: 83

Thank You
-Given: 679
-Receive: 57



« Reply #6 on: August 25, 2016, 06:52:33 18:52 »

Have you have tried to use mechanical switches instead interface Arduino?
So you can manually check the correct functioning of all optocouplers and may discriminate whether the problem is interfacing or the opto.
Ciao
Enzo
Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #7 on: August 25, 2016, 06:57:22 18:57 »

Have you have tried to use mechanical switches instead interface Arduino?
So you can manually check the correct functioning of all optocouplers and may discriminate whether the problem is interfacing or the opto.
Ciao
Enzo

No i haven't done this.
Okay i will test this tomorrow.


One more thing i want to report. While simulating in proteus, if i turned on a opto, i get the voltage on cathode and anode pins shown below.



But on real Hardware, i get voltage more than 1.5V on cathode, i will confirm this by tomorrow.
Logged
Signal
Active Member
***
Offline Offline

Posts: 200

Thank You
-Given: 113
-Receive: 81



« Reply #8 on: August 25, 2016, 07:39:59 19:39 »

1. Check one crazy idea - mirror connection/insertion of optos. Not rotation but insertion from wrong side (incorrect traces routing for example). Then all buttons are like pressed through forward connection of LEDs and outputs of Arduino are loaded by semi-opened transistors.
2. I do not see information about current limiting resistors connected to ROW-1, ROW-2...  Sink capability of some pins (PA[1–6], PA8, PA[10–13], PA[16–17], PA[20–24], PB[4–7], PB9, PB[12–13], PB[15–21], PB[25–31], PE[10–14], PE16, PE22, PE24, PE26, PF[3–5]) could be only 6 mA (and source - 3 mA).
Logged

Give a right name to a right game and play it right
frnando
Newbie
*
Offline Offline

Posts: 24

Thank You
-Given: 10
-Receive: 4


« Reply #9 on: August 25, 2016, 07:55:57 19:55 »

One silly question: I see ROW/COLUMNS coming from arduino. You're not scanning them, are you?
I'm supposing that you turn on only 1 ROW (Level 1), and only 1 COL (Level = 0), and keep them on for a period of time (150/200mS?) for making sure the host detect the "key on" state...
Logged
enzine
Junior Member
**
Offline Offline

Posts: 83

Thank You
-Given: 679
-Receive: 57



« Reply #10 on: August 25, 2016, 08:10:06 20:10 »

 EmbarrassedForgive me for the question,
but HOW do you measure a 2ms signal with a multimeter?
Ciao
Enzo
Logged
CocaCola
Senior Member
****
Offline Offline

Posts: 482

Thank You
-Given: 169
-Receive: 232



« Reply #11 on: August 25, 2016, 09:46:49 21:46 »

EmbarrassedForgive me for the question,
but HOW do you measure a 2ms signal with a multimeter?
Ciao
Enzo

It all depends on what you are trying to measure, if you just want to make sure a pulse happened some higher end multi-meters have a min/max voltage 'hold' or min/max amperage 'hold' option, if you tie it appropriately to the signal line, it will display a peaked voltage/amperage indicating a pulse/bounce happened...  This of course is all dependent on the multi-meter and it being fast enough to detect the pulse you are trying to measure...  And of course this is a very crude way to measure, but is a bind it can work...  And some of the newer multi-meters have pwm and/or duty cycle measurements and such that could be hacked to work in some instances..
Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #12 on: August 26, 2016, 02:52:53 02:52 »

EmbarrassedForgive me for the question,
but HOW do you measure a 2ms signal with a multimeter?
Ciao
Enzo

Using Oscilloscope, i can't do that with multi meter :-P

Posted on: August 26, 2016, 03:45:20 03:45 - Automerged

One silly question: I see ROW/COLUMNS coming from arduino. You're not scanning them, are you?
I'm supposing that you turn on only 1 ROW (Level 1), and only 1 COL (Level = 0), and keep them on for a period of time (150/200mS?) for making sure the host detect the "key on" state...

The code attached here is not complete, it was written to test things by hard coding.

When ever i have to simualte a key press, i will send a command from pc and then arduino will decode that packet and decode which keys needs to be simulated, maximum two keys can be simulated, which means that only two opto coupler will remain on at max.
And after 100-150 msec these opto gets turned off.
Logged
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #13 on: August 26, 2016, 07:44:17 07:44 »

Hello Everyone.

I just removed my arduino board, now i just have opto-coupler board connected with user interface board.
To simulate the key press i manually shorted the collector and emitter pins of opto-coupler one by one, and they are accepted as valid key press by the user interface board. Which means the circuit is fine.

Now i connected Arduino Mega (replaced Arduino Due) with the opto-coupler board and turn on the first opto, nothing happens, the voltage on collector pin of the opto-coupler dropped of 2.3V and this is not accepted as logic high by the user interface board.
This is the problem i am facing, i am not getting why this happen.

Arduino Pin connected with 350ohm resistor and then to anode pin of opto, and cathode pin of opto is connected directly to arduino pin.

I checked the voltage with multi-meter on cathode and anode pin of opto-coupler which i turned on, and the voltage at Anode is 1.9V and at cathode it is 1.36V, and due to this the voltage at collector of opto reduced to 2.3V from 4.6V.
If i remove the cathode pin of opto-coupler, the voltage at collector goes back to 4.6V.
Logged
EDSONCT
Junior Member
**
Offline Offline

Posts: 36

Thank You
-Given: 72
-Receive: 5


WWW
« Reply #14 on: August 26, 2016, 12:14:04 12:14 »

I have the same problem some years ago.
I solved using ADUM da Analog Device instated opto.

http://www.analog.com/en/products/interface-isolation/isolation/standard-digital-isolators.html
Logged
Signal
Active Member
***
Offline Offline

Posts: 200

Thank You
-Given: 113
-Receive: 81



« Reply #15 on: August 26, 2016, 01:44:32 13:44 »

I have the same problem some years ago.
Maybe sharing specifics or your particular problem from past will help in this case too?

Quote
I solved using ADUM da Analog Device instated opto.
ADuM is not a switch nor opto Wink ... and costs 50-100 times more than cheap photocoupler.

 
Logged

Give a right name to a right game and play it right
xpress_embedo
Active Member
***
Offline Offline

Posts: 173

Thank You
-Given: 122
-Receive: 254


« Reply #16 on: August 26, 2016, 01:57:57 13:57 »

I am thankful to all of you. It was a very silly mistake done by the soldering guy and no one was able to find that.
Two opto-couplers pins 1st and 4th, i.e. Anode and Collectors were shorted, that's why all this happen.

Now the logic is working properly, few problem remains which is due to the connection issues, which i will resolve.

Thanks for your support guys.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC