PDA

View Full Version : Relay



menta
- 6th July 2008, 23:36
What is the best way to push a 5v or 12v relay (Output 220V/10A)

BobK
- 7th July 2008, 03:36
Hi Menta,

If your question is how to trigger a relay (5 or 12 volt) then I would use a transistor such as a 2n2222A. A 1K resistor from the PIC pin to the base of the transistor is needed. Don't forget to put a diode across the relay coil to protect the transistor.

HTH,

BobK

menta
- 7th July 2008, 07:53
can someone maybe post a circuit for such setup ?

skimask
- 7th July 2008, 08:02
can someone maybe post a circuit for such setup ?
PIC pin thru 1K resistor to the base, collector to power, emitter to the relay coil, other side relay coil grounded, diode across relay coil pins 'backwards'.
Basic connection for an NPN transistor that's set up to apply power to something.
Get a copy of 'The Art of Electronics' and read it. Great book. Loads of info...

menta
- 7th July 2008, 11:42
If I need 16 relay outputs that alot of transistos and resistors.
Why not using 2 relay drivers to control the massive relays ?
http://www.datasheetcatalog.org/datasheet/motorola/ULN2068B.pdf

Gurkan-demirbas
- 7th July 2008, 15:28
If I need 16 relay outputs that alot of transistos and resistors.
Why not using 2 relay drivers to control the massive relays ?

http://www.sample.co.kr/ladder/index.html

menta
- 7th July 2008, 19:32
I think this one is perfect:
http://www.velleman.be/downloads/0/illustrated/illustrated_assembly_manual_k6714-16.pdf

Archangel
- 7th July 2008, 21:55
What is the best way to push<font color=red> a </font color>5v or 12v relay (Output 220V/10A)
Perhaps because in English " a " means one ! You did not ask how to "push" 16 relays!

menta
- 7th July 2008, 22:19
Thanks....

Kalind
- 1st October 2008, 15:15
ok i get how to connect it to the pic but what i need to know is how to write code for the operation of the relay. I want to switch the relay on when it reaches a setpoint value of 30 degrees. How would i do that?

skimask
- 1st October 2008, 15:18
ok i get how to connect it to the pic but what i need to know is how to write code for the operation of the relay. I want to switch the relay on when it reaches a setpoint value of 30 degrees. How would i do that?

When WHAT reaches a setpoint value of 30 degrees?
The timing advance on my lawnmower?
The temperature on the North Pole? On Mars?

Kalind
- 1st October 2008, 15:46
I'm doing a temperature control system. Pretty new to PIC programming. I have managed to display temperature on the LCD using an LM35 sensor and a 16 x 2 lcd with a 16F873. I want to add on a 4 x4 matrix keypad so that i can set setpoints to switch a relay and a low warning buzzer I have no idea how to program for the above mentioned add-ons. Please could someone help me. below is my code which will obviously need additions and a scematic of my circuit is attached . Please could somebody help me with this!!

' Define LCD registers and bits

Define LCD_DREG PORTB
Define LCD_DBIT 0
Define LCD_RSREG PORTB
Define LCD_RSBIT 5
Define LCD_EREG PORTB
Define LCD_EBIT 4
dEFINE LCD_BITS 4
DEFINE LCD_LINES 2

adval var word ' Create adval to store result
temp var word ' Create temp to store result
temp1 var word ' Create temp1 to store result

TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %10000010 ' Set PORTA analog and RIGHT justify result
ADCON0 = %11000001 ' Configure and turn on A/D Module
Pause 100 ' Wait 0.1 second


loop: ADCON0.2 = 1 ' Start Conversion

AGAIN: Pause 1
If ADCON0.2 = 1 Then AGAIN ' Wait for low on bit-2 of ADCON0, conversion finished

adval.highbyte = ADRESH ' Move HIGH byte of result to adval
adval.lowbyte = ADRESL ' Move LOW byte of result to adval

Lcdout $fe, 1 ' Clear screen
temp=50*adval ' Conversion to Degrees
temp=temp/100
Lcdout "TEMP = ",DEC temp,$DF,"C" ' Display the value of temp
temp1 = temp*18 ' Conversion to Fahrenheit
temp1 = temp1+320
temp1 = temp1/10
lcdout $FE,$C0, "TEMP = ",dec temp1,$DF,"F" ' Display the value of temp
Pause 1000 ' Wait 1 second

Goto loop ' Do it forever
End

skimask
- 1st October 2008, 15:47
I'm doing a temperature control system.
No kidding...just like the other post says...
Don't double post!

aratti
- 1st October 2008, 16:01
If temp>=setpoint then
high pin
else
Low Pin
endif

skimask
- 1st October 2008, 16:04
If temp>=setpoint then
high pin
else
Low Pin
endif

Where have I seen something like that before? :D