On/Off switch com efeito - On/Off switch with fade effect

On/Off switch com efeito - On/Off switch with fade effect

Esta semana apresento um projecto facil de fazer e que pode ter interesse para os automobilistas.

Certos veiculos tal como mercedes, BMWs, entre outros, possuem um sistema que desliga a luz do habitáculo uns segundos depois das portas fecharem e com efeito "fade-out".

Este projecto fará exactamente isso.

A alma do circuito é o microcontrolador 12F615. Nos pinos 2 e 3 são usados jumpers que, consoante estejam ligados a 0V ou 5V mudam o comportamento do circuito.

This week I’m presenting a project easy to build and it might be in interest of automobile enthusiasts.

Certain vehicles, like Mercedes, BMWs and others, have a system that turns the cabin light off a few seconds after the doors are locked and with a fade-out effect .

This project does that.

The soul of the circuit is a 12F615 microcontroller. Pins 2 and 3 will be connected to jumpers that, either connected to 5V or 0V change the behavior of the circuit.

 

Photobucket

 

O jumper 2 permite escolher se o circuito terá uma pausa de 5 segundos até desligar a luz.

Jumper 2 will determine if there will be a 5 second delay before dimming the lights.

O jumper 1 permite escolher o modo de funcionamento de entre 2 possiveis:

1- Controlado por pulsador

2- Controlado por voltagem

Jumper 1 determines if the circuit will work between modes:

1 – pulse control

2 – voltage control

 

No primeiro modo, o circuito liga e desliga a luz conforme for premido o pulsador.

Um primeiro toque activa a luz e no segundo toque, e 5 segundos depois, a luz começa a apagar-se.

The first mode ( pulse control ) the circuit will turn on/off the lights if the push button is pressed.

A first press on the touchbutton will turn on the lights and with a second touch 5 seconds later the light starts to fade out.

No segundo modo, o circuito detecta uma voltagem á entrada do pino 7 do microcontrolador.

Enquanto tiver uma voltagem de 5V a luz manter-se-á ligada. Assim que os 5V deixarem de estar presentes no pino 7 a luz, 5 segundos depois, começa a apagar-se.

 The second mode ( voltage control ) the microcontroller detects the voltage in pin 7.

While the voltage in pin 7 is 5V, the light will stay on. If pin 7 no longer has a logic high value, it will start the light shutdown sequence.

 

Também é possivel usar uma fonte de luz diferente. No esquema em cima é usado um led, enquanto que no esquema em baixo pode ser usado uma fonte de luz de 12V.

It’s also possible to use a different type of Light. In the schematic above it uses a led, while in the schematic bellow a 12V light source can be used.

 

Photobucket

 

O transistor utilizado foi o 2N2222 mas caso não se utilize uma fonte de luz com mais de 500mA pode utilizar-se o BC548.

No pino 7 não se deve ligar voltagens superiores a 5V. Caso se ligue a um automovel, a tensão deste será 12V logo é necessário regular a tensão para os 5V antes de ligar ao circuito.

 Na foto em baixo pode ver-se o circuito a controlar uma barra de leds de 12V.

The transistor used is a 2N2222 but in case the light used does not draw more than 500mha a BC548 transistor can be used instead.

For voltage control, Pin 7 cannot accept voltages greater than 5V. If this circuit is intended to be used in an automobile, which voltages are around 12V, it’s necessary to use a voltage regulator to drop the voltage down.

In the picture bellow the circuit is controlling a 12V led bar.

 

Photobucket

 

Antes de fazer downloads veja este aviso

Before starting any download please check this warning

 www.ruijc.webnode.com/news/downloads/

 

O código Hex para programar o microcontrolador 12F615 pode ser descarregado aqui:

The Hex code for the 12F615 microcontroller can be downloaded here:

CODIGO HEX

  

Como sempre, aqui fica um pequeno video do circuito a funcionar.

Ele está no modo de pulsador e com o tempo activado.

As always, here’s a small video of the circuit working.

I’ve used the pulse mode and with the 5 second delay.