Thursday, January 5, 2012

Projector Control Circuit Details

 I have received several requests for schematics and source code for the control system i built for my projector. After several months of delays and procrastinating here they are:
 The circuit is relatively straightforward, the relay is sunk by an npn transistor... there is a protection diode to prevent any unfortunate kickback. The reset pin on the micro controller is puled up with a 1k resistor and there is a 0.01 uF capacitor to filter power. The micro controller listens for a control signal and a feedback signal is given by pulling it to ground using an npn transistor.

The code is extremely simple, the mcu waits for the control signal to be high for more than 250ms then enables the feedback signal and turns on the relay until the control signal goes low. The entire thing is in an infinite loop.

#include <htc.h>
#define _XTAL_FREQ 4000000

__CONFIG(MCLREN & UNPROTECT & BORDIS & WDTDIS & PWRTEN & INTIO);

void main()
{
    TRISIO = 0b111010;
    ANSEL = 0;
    CMCON = 7;
   
    while(1)
    {
        GPIO = 0b000000;
        // wait for power on signal
        for(int x = 0; x < 250; x++)
        {
            __delay_ms(1);
            if(GPIO1 == 0) x = 0;
        }
        GPIO = 0b000101;
        // wait for power off signal
        while(GPIO1);

    }
}

3 comments:

  1. Thanks for sharing this. How's your projector coming along?

    ReplyDelete
  2. still in pieces in a box somewhere, i still have to finish cleaning my work space and finishing other projects

    ReplyDelete
  3. Wonderful! Thanks for sharing this. I'm sure this will prove to be a great help for all of us trying to automate the controller. Meantime, I've been controlling startup of my board manually by attaching a 3.5v (watch style) battery to the control signal connection. This fools the projector in staying on while in operation.

    ReplyDelete