Building a Circuit to Switch On/Off a 9V Motor

In summary, the conversation discusses the issue of building a circuit that switches on and off another device using an IR LED and a phototransistor. However, the circuit is not working as expected and there are suggestions for adding a latching relay to the circuit. The conversation also delves into the concept of modulating the IR LED for better range and the possibility of using a 38 kHz IR detector to operate a relay or switch. The conversation ends with the suggestion of using a 38 kHz IR receiver chip and a 10 turn pot for the 10K resistor for better control.
  • #1
jbord39
74
0
Hey. I am trying to build a circuit which would switch on/off another device. So far I have tried using an IR LED on the controller and with a phototransistor on the load device (which has it's own batteries), but I cannot figure out how to get it to work. I do not need complicated signals, just a simple on/off toggle to switch on a 9V motor in series with a 9V battery (like a regular manual switch).

Does anyone have any suggestions?

Thanks.
 
Engineering news on Phys.org
  • #2
There are a couple reasons why this circuit may not be working, but here's a guess at a solution.

Assuming the IR LED and the phototransistor are working (basically that the LED is turning the transistor 'on' when lit and 'off' when not lit), the circuit you described is basically a push button instead of a switch. When you flash the LED, the transistor will be 'on' until the LED goes out. What you need to add to the circuit is a latch of some kind.

A latching relay would probably do what you need. Connect the emitter of the transistor to 9v, and connect the collector to the input of a latching relay. When the transistor switches 'on', this will latch the relay closed. Connect one side of the relay contact also to 9v, and connect the other end of the coil to your motor (or whatever you want.) Pulsing the IR LED will latch the relay open or closed, and will connect/disconnect power to your load.

Hope this helps.
 
  • #3
Can you describe how your circuit is not working? Is it failing to turn on even at close range? Perhaps you could post your schematic.

Usually in these applications the IR is modulated to distinguish it from ambient light. The frequency you use can be almost anything except the power line frequency, its second harmonic and that used by CF bulbs which I believe is about 40 kHz. The receiver needs to filter out everything except your modulation frequency.
 
  • #4
Thanks for the quick replies. The circuit is basically supposed to allow a remote to shine an infrared light to turn on or off a motor. The circuit I'm using right now (which isn't working) is:

toydiagram1.png


While using in the above diagram, the voltage across the motor only rises to maybe .5V maximum; however if I use a single resistor as the load the voltage will almost completely transfer. I think this may have to do with the maximum current output of the photo transistor but how could I remedy this?

This problem is compounded by the fact that the phototransistor only seems to work from very close range, making the device impractical (what's the point of a switch if you have to touch it anyway...).

Does anyone have any idea for how to use either a IR phototransistor/IR photodiode/ or 38 kHz IR detector to operate a relay or switch? Also, could I modulate the IR LED so that it's ranged could be increased and picked up by the 38kHz IR detector? (I don't honestly even know what modulate means).

Thanks for the help,

John
 
  • #5
Modulate just means to change something, usually to add extra information to it.

This is a typical 38 KHz transmit / receiver setup.


http://dl.dropbox.com/u/4222062/38%20KHz%20oscillator-receiver.PNG

The infra red LED is switched on and off at a 38 KHz rate.
In normal use as a remote control, this 38 KHz switching is sent in bursts to send data to a TV, say, to change channels etc.

The wire going off to the right of the receiver is an output which would go to a circuit like this:
http://dl.dropbox.com/u/4222062/NPN%20%20driver.JPG

This can control enough current to drive a small relay which would switch a motor. There might be enough current to run a very small motor.

The transistor shown at right might be used to drive a relay like this:
http://dl.dropbox.com/u/4222062/relay%20driver.JPG

Your motor would be switched by the contacts at the top of the relay.
 
Last edited by a moderator:
  • #6
Thanks. Do you think there is any simpler way to create a RC off/off switch? I am not limiting my project to using IR receivers either.

The final project is just a toy for a year old nephew; so it doesn't have to really do anything particular.

Would it be possible to have the motor drive variably just as the IR LED was shone near it?

Thanks for the help again,

John
 
  • #7
Look at it from the receiver's point of view.

If it is seeing 1 square meter, that is 1000000 sq millimeters.
The area of a 3 mm LED is about 7 sq mm.

So, the brightness of the LED doesn't make much difference to the light picked up in a normal room.

Just using a photodiode as a receiver and switching a LED is never going to be much good.

That is why you need to use pulsed light.

If you accept that, you could try the following circuit:

http://dl.dropbox.com/u/4222062/photosensor%20MOTOR%20CONTROL.JPG


A toy really has to do more than turn on and off, so you could have a play with this for your own benefit. You could get your nephew a toy from China while you learn ablout remote control.
A better approach is probably radio control, but that is a new can of worms.
 
Last edited by a moderator:
  • #8
Thanks for the reply.

I am trying the pulsed IR now (it doesn't seem too hard). Would it be possible to use the phototransistor to switch on a relay controlling a 9V motor hooked up to a 9 V battery? Or would the signal first have to be amplified by transistors before it could operate the relay?

Thanks,

John
 
  • #9
The current needed by most relays would be too great for a phototransistor to supply, I think.
You would have to check the data sheets.
But it is easy to do it with transistors.

You would need to find a 38 KHz IR receiver chip. These cost about $3 but they are worth it.

If you do go with the 38 KHz transmitter, look for a 10 turn pot for the 10 K resistor. This will be easier to adjust than a normal pot.

The remote from your TV or VCR would probably work as a signal source instead of the transmitter if you just wanted to test the receiver.
 
  • #10
I have the IR receiver (and managed to get 38 kHz output from the IR as well) but am unsure how to amplify the signal with a transistor. Thanks again for any help.
 
  • #11
The output of an IR receiver is either 5 volts or zero volts. You would use the last diagram in post no 5 above. That is the one with the relay.

The transistor should be a small power transistor. R should be something like 10000 ohms, but this may need adjusting.

Use a low coil-current relay.
 
  • #12
Hm.. the IR transmitter is capped (on the lower end) at about 78 kHz and on the high end about 400 kHz (based on the 10kohm potentiometer). What component would I need to change? I think it pulses based on the discharging of the capacitor, so would a lower value capacitor potentially give me a lower mean range?

Thanks,

John
 
  • #13
A larger capacitor or larger resistors would lower the frequency.

A calculator I have seems to say the frequency should be too low if anything. How are you measuring the frequency?
The 100 nF capacitor could be marked 0.1 uF or just 104. It should not be marked 100 pF.


Anyway, maybe you could try this one:

http://dl.dropbox.com/u/4222062/38%20KHz.JPG

It should give 38 KHz when the 10 K pot is at about 4K and it should give about 16 KHz at the 10 K setting on the pot.

You would need to get a 0.0047 uF capacitor. Any type except ceramic would be OK.
 
Last edited by a moderator:
  • #14
Thanks. I am measuring the frequency with a Radioshack 46 range digital multimeter, with the black probe on the high input voltage and the red probe on the resistor/diode junction. However, I did substitute a 1 nF capacitor instead of the 1.5 nF capacitor you put in the schematic just because of availability. (the .1uF is still .1uF though).

Even adding another 1.5kohm resistor in series b/w input and terminal 7 only lowers the minimum frequency a little bit.

edit: I am also using the TL555 ultra-low power timer instead of the 7555... could this make a difference?
 
  • #15
The TL555 should be OK, although it seems you have to fiddle with the values.

The 1.5 nF capacitor is the one controlling frequency. You would make it bigger to lower the frequency.

That circuit was stolen from a magazine which is normally reliable. (!)

The following site is a calculator for astable 555 oscillators, although it is for the standard 555 not a CMOS one.
http://freespace.virgin.net/matt.waite/resource/handy/pinouts/555/index.htm
 
Last edited by a moderator:
  • #16
I think you guys are making this circuit unnecessarily complicated. Modulating an IR diode is most useful for a) multiple controller functions via enumerated pulses, or b) to distinguish one IR signal from another concurrent one by varying frequency. In this case, it's silly to add all this functionality if you are only going to use this as an on/off switch.

IR diodes are inherently short-ranged, and the problem you are having with sourcing enough current to your motor is probably more from the fact that you are trying to operate your diode at too long of a range. Also, the previous poster was correct in noting that a phototransistor may not be able to source enough current to supply a motor. However, if you can successfully switch the transistor on or off using an IR diode (which you say you can using a resistor as a load,) then you can certainly open and close a relay.

A latching relay needs VERY LITTLE current to turn on. A brief search returns: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=PB963-ND
which is a bistable (latching) relay that can be easily driven by a 9v battery.

You can improve also this easy circuit by adding another IR diode in parallel with your current one (reducing the need for a current limiting resistor and improving the distance you can operate at) or by putting an IR selective light filter in front of your phototransistor.

Adding the LM555 timer etc makes this an interesting project, but if you're already having trouble with a simpler circuit, and if the goal is to build a present for your nephew, I suggest you keep it as simple as possible.
 
  • #17
That relay needs 50 mA coil current. How would you get that much current through a phototransistor lit by an infra red diode held at any reasonable distance away?

Infra red receiver chips have a very nice tuned amplifier built in and these would extend the range of the system by a factor of 10.

They are cheap. They don't need tuning and can be used to tune the transmitter. So, why not use them?

All this was explained to the poster and he wants to get good coverage by using a more complex circuit. He made the right decision, especially as he wants to learn these techniques.

Even the 38 KHz system would not be able to supply enough current to drive a relay directly, so an extra amplifier is still required.
The current needed to switch on a transistor is a LOT less than the current needed to drive the relay directly.

IR diodes are inherently short-ranged, and the problem you are having with sourcing enough current to your motor is probably more from the fact that you are trying to operate your diode at too long of a range.

TV remote controls usually use infra red diodes. These typically have a range of 20 ft or so. I'm sure this poster would be happy to get 20 ft range. There is no reason why this would not happen.
 
  • #18
vk6kro said:
That relay needs 50 mA coil current. How would you get that much current through a phototransistor lit by an infra red diode held at any reasonable distance away?

Indeed. 50mA is definitely not unobtainable, but if that is still an issue, here is a relay that operates at 11mA:

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=255-1899-ND

This is only after a very brief search, and I'm certain you could find one with even lower current requirements (or you could use another BJT as a current amplifier...)

vk6kro said:
Infra red receiver chips have a very nice tuned amplifier built in and these would extend the range of the system by a factor of 10.

Yes, I agree, but they also increase the complexity/cost of the circuit by an order of magnitude by introducing an lm555 etc, and considering other factors such as debugging time, experience, etc, it is probably most wise to use an equally functional but much simpler solution that provides on/off functionality.

vk6kro said:
All this was explained to the poster and he wants to get good coverage by using a more complex circuit. He made the right decision, especially as he wants to learn these techniques.

I was certainly not insulting your suggestion. In fact, I think it would work quite well, and I definitely recommend the OP build a circuit like this if he is interested. I was only suggesting that all things considered, it might be easiest to build a more simple circuit for his nephew and fool around with more complicated things on his own.

vk6kro said:
Even the 38 KHz system would not be able to supply enough current to drive a relay directly, so an extra amplifier is still required.
The current needed to switch on a transistor is a LOT less than the current needed to drive the relay directly.

I disagree with this. Even considering a relay that requires 200mA (or some much larger current,) it would still be easier to use a darlington pair (or another basic amplifier configuration) than several IC's. Regardless, it is quite easy to find latching relays with tiny coil current requirements that would eliminate a lot of complexity from this project.

Though range is undoubtedly an issue, it could easily be improved by using a couple (very affordable) diodes in parallel/series, or by using a single high power diode, without increasing the circuit complexity at all (or really reducing the battery life, since the remote is just used briefly).
 
  • #19
Even 11 mA would not be available from a simple phototransistor arrangement. Currents of 50 uA might be possible but not if other light was present. There is plenty of infra red light in a room lit by an incandescent lamp, so just an IR filter won't help much.

they also increase the complexity/cost of the circuit by an order of magnitude by introducing an lm555 etc, and considering other factors such as debugging time, experience, etc, it is probably most wise to use an equally functional but much simpler solution that provides on/off functionality.

You consider a 555 and a few components as expensive and complicated?

If you can see any simple way to do this that has a chance of actually working, draw up a circuit of it with real components and attach it to a posting. Let us see what you have in mind.

IR remote control is moderately difficult to do and you have to take it seriously to get even reasonable results.
 
  • #20
Before I post I just wanted to say that you guys rock. I've never gotten this much help from a forum before.

I got the 38 kHz receiver working on the breadboard and am about to solder it now. The relay I bought is a 5V SPDT micromini with a nominal coil current of 90 mA. I have not learned about transistors yet, but if I were to send the small current created by the receiver into the collector of an NPN transistor with 5V across it's base, wouldn't that amplify the current by 50 (assuming that is the Hfe)?

Thanks again for all the help,

John
 
  • #21
Unfortunately I also had to use a ceramic capacitor temporarily for the 4.7 nF. It seems like the frequency varying a lot (from like 32 kHz to 40 kHz) just randomly from time to time (although the frequency is pretty stable at short times). Would a different capacitor perhaps help keep the frequency more constant at 38 kHz? And if so what sort of capacitor should I use?

Thanks again.
 
  • #22
jbord39 said:
Before I post I just wanted to say that you guys rock. I've never gotten this much help from a forum before.

I got the 38 kHz receiver working on the breadboard and am about to solder it now. The relay I bought is a 5V SPDT micromini with a nominal coil current of 90 mA. I have not learned about transistors yet, but if I were to send the small current created by the receiver into the collector of an NPN transistor with 5V across it's base, wouldn't that amplify the current by 50 (assuming that is the Hfe)?

Thanks again for all the help,

John

Almost right. You got the base and collector reversed. The gain of transistors is not constant and depends on collector voltage and current among other things, but you would normally get some gain.

You would use the circuit shown with a relay above.

Capacitors. Anything apart from ceramic or electrolytic would be OK and I don't think they make electrolytic 4700 pFs.
This is from Wikipedia:
# Polycarbonate: good for filters, low temperature coefficient, good aging, expensive.
# Polyester, (PET film): (from about 1 nF to 10 μF) signal capacitors, integrators.
# Polystyrene: (usually in the picofarad range) stable signal capacitors.
# Polypropylene: low-loss, high voltage, resistant to breakdown, signal capacitors.
# PTFE or Teflon: higher performing and more expensive than other plastic dielectrics.
# Silver mica: These are fast and stable for HF and low VHF RF circuits, but expensive.

I just wanted to say that you guys rock
I'd have to agree with that. :)
 
  • #23
I am using a 5V regulator to power the transmitter from a 9V battery. The problem is that the IR diode I am using has a Vf of 1.2V and ideal current of about 80 mA. The voltage across my diode + current limiting resistor is now 1.4V (as opposed to ideally about 5V). So even though the frequency is consistently measured at 38kHz I can get no response from the IR reciever. Would there be some way for me to remedy this?

Thanks.
 
  • #24
If you are measuring the output of the 555 with a multimeter on "volts", then it will tell you lies.

It will read the average voltage, but the output is pulses, so it will average the pulses to give a steady reading. This will be lower than the peak voltage of the square wave output.



Try bringing a TV remote control near the receiver. If it is working OK, it should react to that.

Be sure your receiver chip is wired up according it its data sheet. These connections may vary.

One good trick is to look at the transmit diode with the viewer of a digital camera or camcorder. These can detect the infra red light and give you a clue about whether the LED is working or not.
 
  • #25
Man. I am using the DMM to test the current output of the IR reciever. I can't seem to see ANY change from shining 38 kHz of IR at it, which the DMM tells me has a DC voltage of .9V (so 1.8-ish volts).

Do you know how precise most IR receivers are? It says filters out most things outside of the 38 kHz range, so would 37 or 39 kHz not be recognized at all, or just less?

Thanks.
 
  • #26
I think 38 KHz receivers have to have a resistive load on them. Does yours have a resistor going from the output to the 5 Volt + power source?

I have seen the sensitivity curve of these receivers and it is usually bell-shaped with quite a broad peak in the centre. So, it would probably work between 37 KHz and 40 KHz and be less sensitive if you moved outside those frequencies.

Have you got a data sheet for your receiver? You can find them on Google.

They are amazingly sensitive. I used one and it would even detect signals reflected off the walls.
 
  • #27
Hm. I don't think the diode is getting the required voltage to turn on. I can't see anything on my digital camera (unless you need a special setting?). Before I unsolder the 5V regulator to apply a higher voltage, I was wondering if that would work. The IR diode has a forward voltage of 1.28 with 100 mA.

Thanks,

John
 
  • #28
I can see the IR transmitter with my digital camera, I just had to put it on night mode.

It's strange, but I can't seem to get ANY change in signal out of my 38kHz IR receiver; even using the exact circuit you drew (with my transmitter and with a remote).

I also don't really understand why the resistor is connected between the input and output (wouldn't that cause current to flow even with the IR receiver is not receiving?).

Thanks again,

John
 
  • #29
Do you have a data sheet for your IR receiver chip?

The connections may be different to the one I showed.

The output can be an open collector. This means the transistor at the output of the chip can be switching, but it needs a load resistor to work. It would only carry current if the transistor was turned on.

Some TVs have a light that comes on when you use the remote control. This could be used to get your transmitter on frequency.
One problem with using a multimeter to measure frequency is that they have long unshielded wire leads that can pick up all sorts of interference. This is why you are getting the random readings you mentioned earlier.
 
  • #30
Is there any way to increase the voltage of the output pulses? Compared with another remote side by side it is only about half as bright (using digital camera).

I managed to use the remote to light an LED using this circuit:

[PLAIN]http://www.reconnsworld.com/ir_ultrasonic/40khzirtest.gif[\IMG][/URL]

I tried connecting the base of an NPN transistor where the LED is, with the emitter where the LED connects to the IR receiver. I then connected a motor with the top connected to a 9V battery to the collector of the NPN. My hope was that a small current into the base would allow current to flow through the motor.

Any help is appreciated.

Thanks.
 
Last edited by a moderator:
  • #31
You can increase the LED current by increasing the voltage on the TLC555 or by reducing the size of the resistor in series with the LED.
The voltage can be up to 15 volts but the output current should not be more than 10 mA, according to the data sheet.

So, you would need to use a transistor to drive the transmit LED, like this:
http://dl.dropbox.com/u/4222062/LED%20driver%202.jpg
That 20 K resistor can be made lower if you want more LED current.

I modified your diagram to give a couple of drive circuits for your 38 KHz receiver.
Glad you got that working.
Both circuits turn on the relay when a signal is received.

Depending on your motor and what types of relay you can get, the first circuit may be adequate or you may need to use the second circuit.

I favour using a relay to drive the motor. Motors can draw a lot of current if they stall and this might damage the drive transistor.

http://dl.dropbox.com/u/4222062/38%20KHz%20receive.PNG
 
Last edited by a moderator:
  • #32
Thanks for the help. I'll build and test the circuits out over the weekend and hopefully have this finished within the week :)

edit: So many PNP transistors. Why are they better to use than NPN?
 
Last edited:
  • #33
Would this design work to increase the output from an LED? The one above doesn't seem to amplify it to it's maximum light output (as compared side by side to the same diode with 60 mA of current through it).

Do you think this would amplify the current up to high brightness?
Feeding the output pulse into the body of an NPN transistor, with the collector connected to +5V, with the emitter connected to the body of another NPN transistor (with it's collector connected to +5V) with it's emitter connected to the IR diode then connected to ground.

edit (Possibly the transistor I am using could be wrong? Switching NPN transistors, bought in bulk from radioshack).
 
  • #34
The first circuit (with the PNP transistor) doesn't make sense to me. The base is connected to the output of the 38 kHz receiver. This output (when it receives 38 kHz IR light) is 0 V. This would case the base and the emitter to be effectively grounded, and the transistor could not send any current (the pn junction would be at 0V -> no current flow).

Am I thinking of this wrong?

Thanks again,

John
 
  • #35
jbord39 said:
The first circuit (with the PNP transistor) doesn't make sense to me. The base is connected to the output of the 38 kHz receiver. This output (when it receives 38 kHz IR light) is 0 V. This would case the base and the emitter to be effectively grounded, and the transistor could not send any current (the pn junction would be at 0V -> no current flow).

Am I thinking of this wrong?

Yes.

The emitter of the PNP transistor is at +6 volts. For the PNP transistor to turn on, it has to have less than + 5.4 volts on the base.
This happens when the output of the receive chip goes to zero volts.This circuit works better for the transmitter:
http://dl.dropbox.com/u/4222062/Darlington%20LED%20driver.PNG

If your 80 mA is correct and it is average current, this circuit should be OK.
The calculated current here is about 85 mA, but the LED is not lit all the time.
So you could try this, keeping a watch on it with your digital camera.
This is really pushing the LED. Never push a normal LED like this.

You could possibly start the LED series resistor as 100 ohms and drop it in steps to 82, 68, 56 ohms etc.
If you compare it with your TV remote, you might be close.

Be careful. LEDs fail if you put too much current through them. The actual current will depend on the supply voltage, too, so if you have more than 6 volts the series resistor will have to be larger.
 
Last edited by a moderator:
Back
Top