Page 1 of 1

Need help with an electronic circuit

Unread postPosted: Sun Feb 24, 2013 11:26 pm
Author: potatoflinger
Well, I am really new to making electronic stuff, and I am running into an issue with a project I am working on. The project is a chicken coop door that opens and closes automatically based on the amount of sunlight it receives. The door works by having an old drill wind up a rope to open and close the door. I programmed an ATtiny 85 to read the amount of light through a photocell, and then I wanted to use two relays to control the motor. (one for forwards, one for backwards)

The problem I am running into is that I know the ATtiny can't supply enough power to activate the relay, which requires 5vdc, but it needs more amperage than the ATtiny can supply. I know the best thing to use is probably a transistor of some sort, but I have no experience with them.

My question is: can anyone point me in the right direction for using a transistor to trigger the relay? I really just need to know what type of transistor to use and how I should connect it so that one of the digital outputs on the ATtiny will activate a relay.

Any help is very much appreciated.

Unread postPosted: Sun Feb 24, 2013 11:30 pm
Author: Zeus
You can use a reed relay, they take some 20-50mA, and can switch 1A. Or just a 2N2222 to switch it.

Unread postPosted: Mon Feb 25, 2013 1:36 am
Author: dewey-1
I will do a schematic for you tomorrow.

What is the voltage and current of the drill motor? What is the power source?
Hopefully it is a DC motor.

Use a ULN2803 (sink driver) or UDN2981 (source driver) IC with one relay SPST for power on/off and a DPDT relay for polarity reversal.

Unread postPosted: Mon Feb 25, 2013 3:37 am
Author: Technician1002
A robotics RC servo amp/motor speed control and do the job. Direction and speed is simply defined by pulse width sent to the speed control. A positon feedback pot on the door can make it a full servo, so the uController can simply send a desired positon pulse width, and the servo will simply tend itself to drive to the desired position.

Look up info on driving RC servos for further reading.

Unread postPosted: Mon Feb 25, 2013 6:02 am
Author: Zeus
Bear in mind though, servos aren't too cheap, and while I've used them, and love them, for this sort of application, they might not be worth the investment. Locally I'd pay $40-60 for a 5kg servo, which would be marginal for a coop door, whereas a windscreen wiper motor is about $5-15.

And personally, while micros are nifty, I'd just be inclined to make a simple light/dark sensor from $5 of parts, and not have to worry about voltage regulation and driving relays from different levels. The dependance on micros is getting concerning for the users of analogue circuitry, it's almost a dying art...

Unread postPosted: Mon Feb 25, 2013 10:14 am
Personally I'd use an H bridge - either as an IC or just build one out of transistors.

This part would make things a lot easier though I assume that the motor uses more than just 1 A ?

Does anyone know anything rated to more than 1A that has inbuilt diodes and is fairly inexpensive ?

Unread postPosted: Mon Feb 25, 2013 11:07 am
Author: Technician1002
I some full mechanical servos are expensive as they are engineered to not fail when pulling high g forces on that 1/4 scale jet.. you don't need that level or expense.

The robotics guys pick up motor speed controls that are just fine for driving higher voltage (not 5 volts) with the H bridge built in. Some have a place to add a feedback pot to make the door a servo. To control it, only a single uP pin is needed with pulse width modulation.

If you want to roll your own, adding an H bridge to a very cheap servo (sub $10) to the servo amp is relatively trivial. A crash tested servo that has a good amp, but broken case or gears is a good source of a servo amp. It can drive a power amplifier to drive a drill motor.
A commercial solution adds spike suppression, noise isolation, and even opto isoloation so brush noise doesn't swamp your logic and cause glitches or full failure. In that regard they are relatively cheap. ... &var=sbar#

Unread postPosted: Mon Feb 25, 2013 2:56 pm
Author: dewey-1
Here is a simple schematic for your reversing motor control.
Note that inductive loads have about a 30% of maximum resistive current in relay contact ratings.

Unread postPosted: Mon Feb 25, 2013 5:54 pm
Author: potatoflinger
Thanks for all the great info. That schematic seems like it should work well.

To answer a few questions, the power source is going to be a wheelchair battery, which is just a 12v deep cycle lead acid battery. The drill is a dc motor that runs at 9.6v. With no load on the motor, I measured a draw of between 3 and 4 amps, but under a load it would be higher.

There will be a set of normally closed sail switches (one at the upper limit of the door and one at the lower) that will cut the power to the relays that drive the motor when they are pressed, so that the door will stop in the right places.

I will post a video of it in action after I get it working. It will be at least a few days from now though, because I am going to be busy with other stuff for a little while.