Go Down

Topic: HELP: Use Arduino Due To Control Lock Circuit (Read 964 times) previous topic - next topic

Haaz123

Nov 27, 2015, 12:04 am Last Edit: Nov 27, 2015, 12:12 am by Haaz123
Hi i am Working on a project to control multiple door locks using arduino Due ... and i am stuck in between circuit ...  with the help of code i can control my LEDS ( one pin to ground other to digital output ) but when i use NPN transistor to control it i am not able to do it so. Following describe my connection....


12-16V , 2-2.5amp(its written 12v and 1 amp but Meter shows high value) DC Supply -------> + Of Lock.
TIP 122 Base -------> Pin 6 of arduino due (270 ohms Resistor and tried 10k,20k and without).
TIP 122 Collector ------> Lock - and to Arduino due ground.
TIP 122 Emiter ------> DC power source Ground.
 

Now When I connect All The Lock is locked, and i try to use Serial Monitor to get it disconnected, nothing happens, If i test it using my LED one to Arduino ground and other to pin 6 it turns off and on... but when i do it with above circuit it does not work.   if i disconnect base from arduino lock is unlocked, and even if i connect it to analog or even ground pin it get connected/locked. i checked using multimeter Arduino pin gives 0 amp output on LOW........


So what i am doing wrong ?
Please describe in detail i am not electronic student ..and its my first hardware project ever!



For Understanding my arduino Code:
Quote
char val;
char val2;
char val3;// variable to receive data from the serial port
int lock = 6; // LED connected to pin 2 (on-board LED)
int unlock = 7;
int lock2 = 8;
int unlock2 = 9;
int lock3 = 10;
int unlock3 = 11;

void setup()
{
pinMode(lock, OUTPUT); // pin 6 (on-board LED) as OUTPUT
pinMode(unlock, OUTPUT); // pin 7 (on-board LED) as OUTPUT
pinMode(lock2, OUTPUT); // pin 8 (on-board LED) as OUTPUT
pinMode(unlock2, OUTPUT); // pin 9 (on-board LED) as OUTPUT
pinMode(lock3, OUTPUT); // pin 10 (on-board LED) as OUTPUT
pinMode(unlock3, OUTPUT); // pin 11 (on-board LED) as OUTPUT



Serial.begin(9600); // start serial communication at 9600bps
Serial2.begin(9600);
Serial3.begin(9600);

digitalWrite(lock,HIGH);
digitalWrite(unlock,LOW);

digitalWrite(lock2,HIGH);
digitalWrite(unlock2,LOW);

digitalWrite(lock3,HIGH);
digitalWrite(unlock3,LOW);

}

void loop() {
if( Serial.available() ) // if data is available to read
{;}
if(Serial2.available())
{;}
if(Serial3.available())
{;}

val = Serial.read(); // read it and store it in 'val'
val2 = Serial2.read();
val3 = Serial3.read();

if(val == 'A' || val2 == 'A' || val3 =='A'){
  Serial.write("Door One Unlocked");
  digitalWrite(lock,LOW);
  digitalWrite(unlock,HIGH);
  delay(5000);
  Serial.write("Door One Locked");
  digitalWrite(lock,HIGH);
  digitalWrite(unlock,LOW);
}

if(val == 'B' || val2 == 'B' || val3 =='B'){
  Serial.write("Door Two Unlocked");
digitalWrite(lock2,LOW);
  digitalWrite(unlock2,HIGH);
  delay(5000);
  Serial.write("Door Two Locked");
  digitalWrite(lock2,HIGH);
  digitalWrite(unlock2,LOW);
 
}

if(val == 'C' || val2 == 'C' || val3 =='C'){
  Serial.write("Door Three Unlocked");

  digitalWrite(lock3,LOW);
  digitalWrite(unlock3,HIGH);
  delay(5000);
  Serial.write("Door Three Locked");
  digitalWrite(lock3,HIGH);
  digitalWrite(unlock3,LOW);
}





}
 

RayLivingston

So you have BOTH the collector and emitter of the TIP122 connected to ground?  How is that supposed to work?

Regards,
Ray L.

Haaz123

So you have BOTH the collector and emitter of the TIP122 connected to ground?  How is that supposed to work?

Regards,
Ray L.
I Followed A Tutorial !!! WWhat I am Supose to do??

RayLivingston

What tutorial?  Give a link.

A transistor with the collector and emitter connected together is not a transistor, it is a diode...

Regards,
Ray L.

Haaz123

What tutorial?  Give a link.

A transistor with the collector and emitter connected together is not a transistor, it is a diode...

Regards,
Ray L.
This One Here !!! please explan a Little i need to complete this project y tomorrow....

http://www.instructables.com/id/Easy-Bluetooth-Enabled-Door-Lock-With-Arduino-An/?ALLSTEPS

RayLivingston

Well, go read it again, because you do NOT have yours connected like the one in the tutorial.

Regards,
Ray L.

Haaz123

both are to ground!! little explanation please?

RayLivingston

Look carefullly.  The middle pin of the TIP is NOT connected to ground!

Regards,
Ray L.

Haaz123

Quote
As you can see, we have a diode pointed away from ground that is connected to the collector of the transistor as well as the ground of the lock itself.
This is what stated !!

Go Up