NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » Control electronic door opener

February 15, 2013
by lnino
lnino's Avatar

Hey guys,

i am trying to control an electronic door opener with my nerdkit.

I tried to use a transistor in combination like I found in a thread in the web.

The code let the led light for 3 seconds and turn it off after that.

When I put the door opener after the 7805 (5V) is clicks and the opener opens.

Also on 9V it works - the openers opens.

Only direct on the ATmega168 PIN it won't work. (Maybe too low Current) And also after the transistor it won't work.

Any ideas how to get it working?

CODE:

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
   // Initial I/O
   DDRB |= (1<<PB3);       // Set PB3 as Output, Others as Input
   PORTB &= ~(1<<PB3);     // Reset the PB3

   for(;;) {               // Loop Forever
     PORTB |= (1<<PB3);    // Port PB3 High
     _delay_ms(3000);      // Delay 3 Second
     PORTB &= ~(1<<PB3);   // Port PB3 Low
     _delay_ms(1000);      // Delay 1 Second
   }
   return 0;               // Standard Return Code

PICTURES:

alt image text alt image text

February 15, 2013
by mongo
mongo's Avatar

A couple of things might be it.

I assume the door latch is a solenoid. If it has a clamping diode across it, make sure it's the right direction, (reverse bias).

It can also cause an inductive spike that can scramble the controller. If no clamping diode, you might want to install one.

It can also be the current draw, sapping the power and resetting the controller.

February 20, 2013
by lnino
lnino's Avatar

I have seen in a thread on this forum, that a MAX662 has been used to scale voltage from 5V to 12V.

Can I use this in combination with the ATmega168 to control the electric door opener?

February 20, 2013
by Noter
Noter's Avatar

No, the MAX662 gives barely enough power to program flash on a chip. It wouldn't be able to provide the current to work a relay.

February 20, 2013
by lnino
lnino's Avatar

Thanks for the reply Noter.

I have another idea to realise my Project.

If you want to get an led lighting by button press i put the Anode to a Pin of the mcu and the Kathode to gnd. When i Push the Button the Pin gives current to the Anode and the led Lights.

Now the Question: Can i do it the other Way round? I want to wire the positiv port of the Electric door Opener direct to the 9v Battery and the negative port to a Pin of the mcu. When i Push a Button i want that the mcu Pin gives gnd to the negative Port of the Electric door Opener.

Is this working?

February 20, 2013
by Noter
Noter's Avatar

No, that will put 9v on the mcu pin and that will fry things. Use one of the mosfets that came with your nerdkit to switch 9v on and off. That will keep the higher voltage off your mcu pins which is necessary.

February 20, 2013
by lnino
lnino's Avatar

Thanks for your reply.

How do I have to wire the things together?

I found the MOSFET which came with my nerdkit. I put Gate on PC3, Source on GND and now I want to have 9V on DRAIN.

Or do I have to put the electric door opener between DRAIN and 9V?

Thanks for the help.

February 20, 2013
by Noter
Noter's Avatar

You need to have something between 9v and the DRAIN else too much current will flow and cook your mosfet. If you normally work your opener with 9v and GND then yes you can switch it with the mosfet. This will explain more about it - MOSFET as a Switch.

February 21, 2013
by lnino
lnino's Avatar

Thanks for the Link.

Because I am actually far away from my evaluation board I tried to draw the circuit in eagle. I used a Tiny13V for tis example because there is less wiring and more space. :-)

Did I get that right? Will this work? Or is this concept wrong?

Thanks for your help.

image

February 21, 2013
by Noter
Noter's Avatar

Yep, that looks good.

February 21, 2013
by lnino
lnino's Avatar

Hi Noter,

now I am back at my evaluation board and wired everything up.

All I have to say is: IT WORKS!!! Thanks a lot for your help. Now I can set a Pin ofthe Microcontroller to High and the Door Opener opens. :-)

I noticed that the MOSFET is getting a little hot. Not like burning my fingers, but between warm and hot. And I guess the MOSFET is a little bid smelly.

Is the wiring wrong? Do I burn something? Or is this just normal?

As Freewheel Diode I used a simple Yellow LED, which should do the same, because the LED is also a diode.

Maybe you have a suggestion.

Thanks for the help.

image

February 21, 2013
by Noter
Noter's Avatar

Not good that the mosfet is getting hot and you can smell it - that's the slow burn. How much current does your door opener require? I think that mosfet is good for about 200ma max. You might need a current limiting resistor in series with the door opener or a bigger mosfet.

February 22, 2013
by lnino
lnino's Avatar

I bought this door opener from amazon. The weren't too many details. I have only found 6-12 V AC/DC.

Can I use my voltmeter to get some values?

Type: 20171 2110 33

February 22, 2013
by Noter
Noter's Avatar

Use the mosfet to find the lowest current that will operate the opener. Put your multi-meter in series with the opener and set to measure current on the 1 or 10 amp scale. Put a 1k ohm from the mosfet gate to GND and then a variable resistor (1 - 10k) from the gate to 5v. Increase/decrease the variable resistance to find the minimum current that works the opener. Then you could calculate a series resistor value or just go with the voltage divider you already have on the gate side by switching from a constant 5v to the output pin on your mcu.

February 24, 2013
by lnino
lnino's Avatar

Hi Noter,

I had now the Time to make the tests. In Series the door Opener had 450mA. Now its clear why the mosfet was getting hot. I tried to find the lowest current with a Variable Resistor. But no Chance, the Minimum current to Switch the door Opener was about 380mA. So I ordered some Bigger Mosfets and Real diodes to protect the mosfet. Everything Works Great now. Thanks for the help.

Post a Reply

Please log in to post a reply.

Did you know that binary numbers use base 2 to represent numbers, and these are important for understanding microcontroller registers? Learn more...