zassx
Posts: 20
Joined: Mon Jan 15, 2018 4:37 pm

Phototransistors in parallel not working

Fri Mar 23, 2018 12:02 pm

Some time ago I created lightgate project with single IR LED and phototransistor (with the same scheme like below, only there were single elements) and it was working alright. Now I decided to add another set of elements in parallel since I need to detect additional beam break.

https://www.dropbox.com/s/pwzjxvpr2th21 ... 9.png?dl=0

EDIT: The GPIO resistors in this circuit are not connected to the photostransistor, please ignore that. On the actual circuit there is connection.
This is the circuit I created but it looks like my code doesn't detect any beam interruptions. Let me repeat that if I take one of each element out of parallel it works like it should.

Code is running in nodejs:

Code: Select all

var rpio = require('rpio');
const path = require('path');

rpio.open(13, rpio.INPUT);
rpio.open(11, rpio.INPUT);


function pollcb(pin) {
  var value = rpio.read(pin);
  console.log("PIN 13 value: " + value);
}

function pollcba(pin) {
  var value = rpio.read(pin);
  console.log("PIN 11 value: " + value);
}

rpio.poll(13, pollcb, rpio.POLL_BOTH);
rpio.poll(11, pollcba, rpio.POLL_BOTH);
Is there any mistake inside my circuit or any other particular reason on why the sensors do not show data when in parallel?
Thank you very much for your help.
Last edited by zassx on Fri Mar 23, 2018 1:53 pm, edited 4 times in total.

User avatar
Mortimer
Posts: 924
Joined: Sun Jun 10, 2012 3:57 pm

Re: Phototransistors in parallel not working

Fri Mar 23, 2018 12:18 pm

Can't see your diagram.
Is the link broken?
--------------
The purpose of a little toe is to ensure you keep your furniture in the right place.

zassx
Posts: 20
Joined: Mon Jan 15, 2018 4:37 pm

Re: Phototransistors in parallel not working

Fri Mar 23, 2018 12:36 pm

Mortimer wrote:
Fri Mar 23, 2018 12:18 pm
Can't see your diagram.
Is the link broken?
Sorry I was having issues with image, updated its link so it should be working now.

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Phototransistors in parallel not working

Fri Mar 23, 2018 1:45 pm

-a1- if you question your code you could use:
from terminal:
gpio readall
and see status ( and possible change )

-a2- check with your code

-a3- connect the R1k for test to
+3v3
or
GND
and check with -a1- AND -a2-

-b- your circuit could never work as the R1k from GPIO
is not connected anywhere

zassx
Posts: 20
Joined: Mon Jan 15, 2018 4:37 pm

Re: Phototransistors in parallel not working

Fri Mar 23, 2018 1:52 pm

KLL wrote:
Fri Mar 23, 2018 1:45 pm
-a1- if you question your code you could use:
from terminal:
gpio readall
and see status ( and possible change )

-a2- check with your code

-a3- connect the R1k for test to
+3v3
or
GND
and check with -a1- AND -a2-

-b- your circuit could never work as the R1k from GPIO
is not connected anywhere
The resistors are actually connected to the phototransision on the real circuit, but in this scheme I totally forgot to connect them. Thanks for the heads up, I have put a notice inside my question for others to see. :)
Thanks for suggestions, will try it out later.

Idahowalker
Posts: 445
Joined: Wed Jan 03, 2018 5:43 pm

Re: Phototransistors in parallel not working

Fri Mar 23, 2018 2:21 pm

Have you ran the thing so that the additional components work by them selves? To prove that each individual circuit and associated code works.

If, when the circuit is wired with dual circuits does the circuit run, if both beams are broken at the same time?

If the circuits both work as individuals but do not work when wired with two circuits, and the circuit works when both are activated at the same time then this may be a case of one emitter is able to interfere with the other receiver.
Without knowing why you are deleting my postings, I will not know how...

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Phototransistors in parallel not working

Fri Mar 23, 2018 2:39 pm

by the way, if you use code from some external source you should link it in your post:
https://www.npmjs.com/package/rpio
and you document ALL what is needed to follow your example / to test your code ...

Return to “Beginners”