I am building a humane rodent trap, and require assistance. The trap works using an LED (not shown) and LDR (photoresistor). When the rodent walks over the LED, The LDR increases in resistance and more current flows into the transistor. Then a buzzer, An LED and two motors turn on to alert the consumer. The motor cuts off entries and exits for the rodents. They stop spinning when the door activates a microswitch. The voltage out of the transistor is 3.6V

Light Dependent Circuit

However, I do not how I would wire it up. I know how to use a DPDT to reverse a motor, but I just made a mess when I tried.


I need the motors to go in reverse using the 4.5V wire when the circuit receives an input.

Switch off: Motors forward If dark using 3.6V supply
Switch on: Motors backwards regardless of light using 4.5V

Motor Circuit:


  • \$\begingroup\$ How quickly do the motors close the trap doors? Since the sensor system is very "analog-y", it would seem that as the rodent gets close to the LDR and casts a partial shadow on it, the motors will start to twitch on and off which will probably just scare the animal off. Are you interested in suggestions for some redesign of your circuit? \$\endgroup\$ – Dan Laks Aug 26 '14 at 17:31
  • \$\begingroup\$ I'd add that if the uswitch cant be rewired working it out will be quite difficult \$\endgroup\$ – Vladimir Cravero Aug 26 '14 at 17:38
  • \$\begingroup\$ I would happily accept improvements, However the method of detection has to be a non-contact form, such as an IR beam or, as above, LED and LDR \$\endgroup\$ – Deep Aug 26 '14 at 18:45

To be able to drive a motor both ways from a single supply, use something called a "H bridge". The motor is put between two drivers that each can either output high or low. Set them to high-low to run the motor one way, and low-high to run it the other way.

Since your motors can apparently run from only 3.6 V, here is a really simple H bridge that can be safely driven from two 5 V logic outputs:

This is a pretty idiot-proof H bridge that will drive the motor with about 3.6 V given the 5 V supply as shown, up to a few 100 mA. A and B are 5 V logical level inputs. The motor is off when both are the same. It is driven one way when A is high and B is low, and the other way when B is high and A is low.

I would use a small microcontroller running from 5 V to drive these lines. The micro would be monitoring the light sense line thru a A/D input, and the rest is logic in firmware. If you want to sound a alarm and light a light, these can be driven by additional outputs from the micro. The signal from the limit switches would also be inputs to the micro, which it uses to know when to stop driving the motor.

Using a micro significantly simplifies the electronics, and puts the logic in firmware where it is easier to tweak and change as you decide you want something different after getting some experience with the device.

  • 1
    \$\begingroup\$ Adding a microcontroller is simpler for an inexperienced electronics hobbyist than using the existing single transistor in a circuit that could be "breadboarded" on a popsicle stick with hot glue? \$\endgroup\$ – TDHofstetter Aug 26 '14 at 19:21
  • 1
    \$\begingroup\$ @TDH: We don't know what level the OP is at, and it's doing a lot more than what a single transistor would. In any case, someone trying to build electronic devices needs to be familiar with microcontrollers. If he isn't now, then this is a good time to learn. If he keeps putting it off, he'll be forever stuck trying to cobble together primitive logic with transistors on a popsicle stick. \$\endgroup\$ – Olin Lathrop Aug 26 '14 at 20:10
  • \$\begingroup\$ Well the OP wants to be able to move the motor in both directions. With a microcontroller, that's 2 outputs for the motors, 1 output for the LED/buzzer, and as many different inputs as he would like to make a nice clean design that can be easily changed later on or added to. Simply using basic components can easily overcomplicate things depending on how many extra inputs he wants, what each input should do, etc... \$\endgroup\$ – Thebluefish Aug 26 '14 at 22:17
  • \$\begingroup\$ I've used a microcontroller before \$\endgroup\$ – Deep Aug 26 '14 at 22:19
  • \$\begingroup\$ Like the Picaxe 14M2 \$\endgroup\$ – Deep Aug 26 '14 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.