Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help: Simple Circuit

Status
Not open for further replies.

krich

New Member
I am just starting out in electronics, so forgive my questions about relatively basic things.

I am trying to electrically control a "contact closure" sensor. Currently the sensor is set up with a reed switch and magnet. I'd like to remove the reed switch and magnet and replace that with a visible laser/photocell switch.

I was able to design a circuit that works...well, most of the time. It works on the breadboard, but it seems to have problems in the long term when I built a PCB and I can't figure out why this is. One of my challenges is that the voltage is very low between the contact closure pads. Just 0.45V.

So, my plan is the following:

1) Build a typical voltage divider circuit off a 3VDC source with a 10K resistor and a CdS photocell with a range of Rdark=2,000,000ohms, Rlaser=100ohms, Rambient=9000ohms. I've done the math and that's where I came up with the 10K resistor (probably should be more like 20K, but it's what I've got). The photocell is on the ground side of the voltage divider, so that Vout is ~2.9V when dark.

2) Use the Vout of the voltage divider circuit to drive a NPN 2n3904 transistor which will switch on/off the contact closure pads.

It works, then it doesn't work, then it works, then it doesn't work. I can't tell if the circuit is incorrectly designed, or the transistor I have is flaky. I do know that the sensor module works if I put the reed sensor back in.

I should mention that I have the photocell very well protected from stray ambient light. Also, the capacitor in the schematic is optional and helps me control how quickly the sensor module detects a break in the laser. I've been experimenting with different values there.

I'll see if I can't attach a schematic...

Any comments welcome.

sensor-schematic.jpg
 
Last edited:
Well, I worked on this over the weekend and still can't seem to get it working reliably. I may just hook the laser sensor up to an AVR and write a bit of code to trip the sensor module. I'm better at that anyway.
 
Roff said:
How much current does SIG require when the transistor is on?

Thanks, Ron, for the response. Over the weekend I wondered the same thing. I was concerned that I needed to put a resistor between SIG and GND to limit the current. I hooked up my ammeter between the sensor pads and read a very small current between SIG and GND. Less than a mA, if I remember correctly. Must already have a resistor. Makes sense since it originally had a reed switch between SIG and GND.

So, low voltage (<0.85V) and low current (<1mA). Would these values be too small to saturate collector to emitter (is that how you say it)? I've seen something like that in the 2n3904 datasheet. I'll go take a look.

Ken.
 
Can you more completely state the characteristics of the flaky operation?

Have you monitered the voltage on the collector to see what it's doing?
 
Good point. Flaky doesn't really give anyone much to go on. The symptoms are that it'll work on the breadboard, and it will work with the PCB I etched. But then, just an hour later, it'll not work at all. Just as I've decided to throw the whole project into the wood chipper, it works again. :eek: Its driving me nuts. I'll try to gather some quantifiable symptoms and measurements that describe "flaky" later this evening and then post back.

One concern I have is whether or not I'm dealing with voltages and currents that are too low for the 2n3904 I have in the circuit. Should I be using a mosfet or solid state relay instead? I just picked the 2n3904 because that's what I first pulled out of my box.

Also, if I use 0V to 5V on the base of the 2n3904, does any of that voltage bleed into the emitter? I'm a complete transistor newbie.

Thanks for taking the time to help me with my project.

Ken.
 
The 2n3904 transistor would seem okay for what you're doing. It's a general purpose amplifer/switch.

Some General Transistor Info:

Bipolar transistors, such as this, are current operated devices. The gain (beta) of the transistor is the ratio of collector current to the required base current. For use as a switch, a beta of 10 is often used to insure good turn-on of the transistor, thus 1mA of collector current would require 0.1mA of base current.

The base-emitter junction looks like a foward biased diode thus the typical base-emitter voltage when the transistor is on is about 0.65V (for silicon). Since it's like a diode, you always need a resistance in the base to control the base current. Applying a voltage to the base above about 0.6V can fry the device if there's no resistance to limit the current.

-----------------------------------------------------------------

The flakyness could be a cold solder joint. Recommend you touch up all the joints with a hot iron and make sure the solder wets both the wire and the bond pad. Sometimes a joint may appear good but it will be intermittent.
 
I've done a little googling on "contact closure sensor", and now I'm curious to know how you are supposed to "trip" a contact closure sensor. Is it current activated or voltage activated? One datasheet I ran across cautions that the inputs are designed for contact closure only, and that no power should be connected to the contacts.

Or, are you trying to replace the contact closure sensor itself?
 
pc88 said:
I've done a little googling on "contact closure sensor", and now I'm curious to know how you are supposed to "trip" a contact closure sensor. Is it current activated or voltage activated? One datasheet I ran across cautions that the inputs are designed for contact closure only, and that no power should be connected to the contacts.

Or, are you trying to replace the contact closure sensor itself?

The target of my project is a sensor module for an alarm system. The sensor I am working with is one that is placed above a door with a magnet stuck to the door. When the door is closed, the magnet is close enough that it makes a contact closure via a reed switch. When the door is open, the magnet is too far away and the circuit is open. This is my starting point.

What I am trying to do is come up with a method of changing the sensing method of that sensor module by removing the reed switch and putting my own creation in it's place. I have many, many more of these than I do doors, so I think it would be fun to use the sensors for other things.

My problem is that I know what I need to do, but I guess I don't yet have the skills to pull it off "correctly". This is the part where I get to bug you guys about my project, try not to tick anyone off for being too far in over my head, and hopefully learn a whole bunch in the process. :)


Roff said:
Darlington ain't gonna work if he's only got 0.45V to work with, unless he includes the relay. I think that's what he's trying to avoid.
That's pretty close to what I'm looking for, but Mr. Roff is correct, I don't have a relay to work with. However, if that's what I need to get this done, then so be it. I was just messing around using what parts I have in my tackle box. I do follow the schematic in the previous link. It's very similar to all the other schematics I've run across for this very thing.
 
Last edited:
Mechanical and reed switches are used because they are simple, reliable and cheap. What would be the purpose of a more complex device that does the same thing?
Radio Shack sells relays, any car repair shop too.

PS alarm system sensors are not just a simple wire, they often have a 5K resistor on the sensors and a window comparator on the alarm. Else a wire jumper could bypass most systems.

I put together a zoned system based on 1-wire DS2401 devices and reed switches, works great and did not add much to the cost of the sensors, more secure too.
**broken link removed****broken link removed**
Only two pins are used on the DS2401
 
Last edited:
blueroom: a DS2401 is a "silicon serial number" device. Did you mean another part no.?
(Edit: maybe I understand how you used them now, but feel free to elaborate.)

After thinking about it I understand now why a Darlington probably wouldn't work - it has a much higher Vce(SAT) than a single transistor. The 2N3904 has a Vce(SAT) of around 0.2V which may not be small enough to reliably trigger the sensor if voltage between the contacts is only 0.45V. Then again, it would be helpful to know how (electrically speaking) the sensor is triggered.

Another option would be to try a MOSFET. A 2n7000 is a common, general purpose N-FET. Solid state relays are essentially just MOSFETs.

Finally, might be valuable to know what resistance is required to trip the contact closure sensor.
 
Last edited:
Thanks to everyone that has weighed in on my project. From what I've heard from the kind folks here is that there's nothing "obviously" wrong with the circuit I've proposed, just that I, quite possibly, lack the experience to pull it off.

So, I've tried to take a second crack at the circuit based on the circuit posted a few posts above this one, using an already proven (and well explained) circuit at the risk of complicating the circuit and overloading my already feeble mind.

Digging through my tackle box, I was able to find a 3V relay amidst what I thought were all 12V relays (bonus!). Its like it was sitting there just waiting for me to find it for this project.

I have yet to build the circuit, but I do have some confidence that it will work properly. The only drawback is that I'm not sure it will fit into the battery compartment of the sensor module I am modifying, so it'll probably take a bit more planning on the mechanical side of things.

I've attached the circuit drawing. I removed the DPDT switch because I won't be needing to switch between activate on dark and activate on light. I'm now trying to understand Darlington Pairs and what that's all about, but I think I understand the basic premise...at least somewhat. Using a smaller voltage/current to switch on a transistor that can use a larger voltage/current to switch on a relay. Allows a much higher gain than with a single transistor. Not sure why its necessary in this circuit, but I'll keep pondering that question. Any light the folks can shed on this would help.

laser sensor.jpg

I'll be leaving the country in a couple days, so I don't think I'll have time to build it and test it before I leave. I may not have a good way to respond back to comments until I get back, so thanks in advance to the community for your interest and comments.

EDIT: I've written an instructable, more so that I can remember how I did it and keep track of my progress. I like how you can add comments to pictures and stuff. Anyway, the instructable goes through in detail what I didn't really want to clog up these forums with, so check it out if you are interested. I didn't want to publish it until I got things working flawlessly, but I think it would help those who are trying to help me to understand what I'm doing. I'd prefer to keep the comments in this thread on topic, which is specifically the sensor circuit, but I can start a new thread on the overall project if there is interest. PM me if this is the case. And yes, I've quite literally got a box-load of these cameras and sensors in the garage, much to my wife's chagrin. :D

Xanboo/Homesite Laser Break Beam Sensor


Regards,

Ken.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top