120V outlet timer

Discussion in 'The Projects Forum' started by vortmax, Oct 14, 2012.

  1. vortmax

    Thread Starter Member

    Oct 10, 2012
    I'm working on a simple timing circuit that controls power to a 120VAC device through a relay. My goal is to be able to turn a heater on and set it to shut off after a set period of time (which is adjustable).

    The basic function of the device is:

    1. 120V is run through a 15A power relay which is controlled by the micro.
    2. 3 pins on the micro are connected to hold up resistors and grounded through momentary push switches. These switches advance the hours and minutes of the timer and reset/open the relay.
    3. 2 banks of 4 LED's show show time. These each have their own pin on the micro...not as efficient as multiplexing, but I had the pins.
    4. Micro reads ambient light level with a photodiode and built in ADC and uses that to dim the display leds

    So first question.... can anyone take a glance at my schematic and make sure I'm not doing something completely wrong? I have a Ti launchpad on order and will breadboard it up once it gets here, but I like to be prepared. I don't have the step down transformer or rectifier in the diagram, as I'm still figuring out if I want to make one myself or just salvage one from an old phone charger...but I do have a 3.3V regulator. The resistor and cap values are just for show...I still need to figure out what they need to be, but I would appreciate any suggestions.

    Also...once I get this built and debugged, I want to put in a rigid case and I'm thinking about encasing it in epoxy, but I'm not sure how that will play out with the heat dissipation of the transformer.
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    I think you have a typo on P1.0.

    I strongly doubt P1.7 drive that relay itself.
  3. takao21203

    Distinguished Member

    Apr 28, 2012
    1. Use a digital MOSFET or BJT to drive the relay.
    2. Install a diode antiparallel to the coil. This is pretty much mandatory.
  4. vortmax

    Thread Starter Member

    Oct 10, 2012
    okay. I hadn't picked out a particular relay yet so I didn't even think about that or protection. Thanks. Would there be a benefit to using a BJT over the MOSFET?
  5. vortmax

    Thread Starter Member

    Oct 10, 2012
    The only relay I can find takes a 5V coil, so I had to add a 5V rail and switch it through the MOSFET. New schematic attached

    P1.0 is an analog input reading the voltage across R1. It's my simple attempt to read light level off the photo diode. I'm going to try it on the breadboard before deciding if I need to add an amp.
    Last edited: Oct 15, 2012