Interesting, The thing that imediatly jumps out at me is the cyclic rate of the relays. At a 8 second cycle rate, that works out to be ~10,000 cycles a day - more at four seconds. I wouldn't expect a mechanical relay to have a very long lifespan at that rate. If you actualy need this switching rate I'd reccomend you look into some other options. Solid state relays are an option, or you could control it with triacs. A pic is a good match for this type of application. I would generaly reccomend the 16F877 / or 16F876 for a beginner to learn with. But something of this size could be done with a much smaller part (16F629 probably) Most of the people on this list program with assembly. Since you mention you have some BASIC experiance maybe you should look into ME labs PicBasic Pro. http://www.melabs.com They even have a demo version that's probably enough to do what you're asking. There's also some good PBP specific resources out there like this one: http://www.picbasic.co.uk/forum/ The basic program would actualy be quite simple, it'll probably look something like this: lightsensor var portb.0 relay var portb.1 on con 1 'these depend on how you wire your relays off con 0 day con 1 'depends on sensor type and how you wire it input lightsensor output relay Main: if (lightsensor = day) then relay = on pause 8000 'number of milliseconds to pause relay = off pause 8000 else relay = on pause 4000 relay = off pause 4000 endif goto main This is just a quick hack, and I imagine you will want to add features and such, but it should give you some ideas. -Denny > > Sorry for not being clear. I am working on a project using a PIC (16F877 or 16F628 ) or even AVR (90S2313, 90S8515) to control 4 relays (2 pairs); on and off for say, 8 seconds interval for 24/7. Powerheads (fish tank type) operating at 220v will be attached to the relays. During the day, when the fish tank lights are on, I want the on/ off interval to be 8 seconds. During the night when the lights are off, I want the on/ off interval to be 4 seconds. Thus, I think of using a light sensor as an input logic so as to use different interval routines within the PIC. > > As I am totally new to MCU and electronics hence, if I can get hold of a project that is as close to my requirement as possible, that will greatly help. The only plus I have is, I have some BASIC programming background. Hopefully, I can pick up quickly on modifying the source code to suit my needs. > > Thanks in advance for the help. > > cheers, > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist