Discussion in 'Electronic Basics' started by Robert Monsen, Nov 10, 2003.

1. ### Robert MonsenGuest

I am helping with a project which requires remote sensors, in the form of
photodiodes. These photodiodes will be activated by a shadow passing over a
hole. The shadow will be there for less than 60ms. This will be required to
generate a logic high pulse of at least a couple of ms at the input of a
PIC. The goals are that it be reliable, cheap, and durable. The environment
is very noisy electrically, since there will be lots of little electric
motors running in the area, within inches of the sensor circuit.

The sensors will be a maximum of 164' from the PIC. The hope is to use cat5
cable, simply because its available.

I would like to power the sensors remotely through the cable.

My initial idea is to simply put power and ground on three of the twisted
pairs to power a driver circuit, which would consist of a transistor circuit
as follows:

Please view with a fixed font like courier...

VCC
+---------+-----------
| | |
| .-. .-.
| | | | |
| | | 1k | | 4k7
photodiode - '-' '-'
^ | | A
| +----+--------------
| | | |
| |/ | |
+-------| .-. | B
| |> | | +--------
| | | |10k |
| | '-' |
.-. | | |/
| | | +---|
10k | | | |>
'-' | |
| | |
| | |
+---------+-----------
GND
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

The transistors would be junkbox NPNs like 2N2222A or 2N4401s.

At the PIC, the output would be determined by measuring the difference
between A and B. A < B would mean 0, and A > B would mean 1.

I'd use a little differential amp to determine the result, which would be
fed into the PIC.

VCC
|
+-------+
| .-.
| | |100k
| | |
| '-'
| | To PIC
| +------------
| |
___ |/ \| ___
A-|___|--| |--|___|-B
1k |< >| 1k
| |
+---|---+
|
|
.-.
| |
| |1k
'-'
|
GND
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

Again, the transistors are junkbox NPNs. A and B would be connected to A and
B in the transmitter via one of the twisted pairs in the cat5 cable.

Does this seem like a good approach? Do you think it be fast enough to get
good logic transitions? Also, I want to avoid spurious activations due to
noise.

Thanks,
Bob Monsen

2. ### Dimitrij KlingbeilGuest

<snip>

If you really need speed (micsoseconds and below), the transistors must be
HF (at least some common RF amp transistors) and a quick-acting photodiode
would also be needed, but since 60ms is quite a big chunk of time, any
transistor and any photodiode (maybe even photoresistor) will do. 60ms is
not really a speed concern, just don't place big caps where they do not
belong. A small cap between points A and B in your schematic might even help
to get rid of RF static, spikes from relays switching motors on and off and
this like. Since your environment is very noisy (a 220V motor switching off
at an inappropriate phase angle can easily put out several kV spikes over a
several MHz spectrum depending on the motor power), I think that a 100k
resistor in a diff amp is way too high. Unless there is a small cap across
it, it will pick up all RF static there is and the device will trigger on
every relay click if not well shielded. (Maybe this was a little
exaggerated, but since I've seen what a noisy environment 380-to-6000 volt
5kW transformers create especially when switched off and how 'reliably'
nearby electronic appliances perform, I can only recommend you to care as
should be OK, but please try not to use high resistances near motors or
transformers whenever you can. Also please note that RF-shunting the
photodiode and maybe also the PIC-input with small caps (will require some
testing) to clear everything above some 10kHz could help make the device a
little more reliable in respect to a noisy environment.

Note: If there are only small low-voltage low-power motors, the warnings
above may (and will likely) not apply.

Dimitrij

3. ### Luhan MonatGuest

Put a PIC12F675 (8-pins with 10 bit a/d), mount it right at the
photodiode to and read the analog voltage (you need one pull-up resitor).

Feed 5 volts (the pic will run on less) down a 3-wire cable
(power,ground,data), and look for whatever type of signal you care to
send back (level, or serial data).

This pic costs about \$2 in single quantities. The wire will probably
cost you more.

4. ### Robert MonsenGuest

Thanks, Luhan. I'll look into that. There are 16 sensors spread over a
fairly big area, so I'm looking for a cheap, reliable solution, like a
discrete transistor or two.

I'm really just looking for a trigger pulse from the remote sensor.

Regards,
Bob Monsen

5. ### Luhan MonatGuest

Hi,

Given this additional information, I would recommend a three-wire
connection to each sensor (+5, ground, signal). To improve immunity to
noise over the distance, here are some suggestions.

1) Use dual conductor shielded cable from the pic to the sensors.

2) Put something like a 2n2222 (npn) transistor connected as a 'voltage
follower' at each sensor to boost the current.

3) Use an r/c filter to radically filter each line comming into the pic.

Given that you have 16 signals, the pic16f870 may be suitable. Use a
pair of CD4051 (analog gates) to feed 2 of the a/d inputs. Use the same
3 lines from the pic to addess both cd4051's at the same time.

You may also be successful in just using 2 wires to each sensor, putting
one load resistor at the common lead from each 4051, and filtering the
heck out of the signal between the 4051 and the a/d inputs. This
assumes that you do not need rapid readings. Use the time to allow