10 years, 4 months ago.

how i can bulid a clock for my light?

hey there,

i will create a Realtime (RTC) clock to control my lights at home.

the mbed is already working in my house :-)

but the next project is when i standig up the light are always on.

E.G.

if (button==1)

{

monday - sunday 7am all lights on

monday - sunday 7:30am all lights off

}

i am a little beginner in mbed and C.

have anybody a sample code for me?

greets

Sascha krüger

1 Answer

10 years, 4 months ago.

Do you want a movement sensor to operate lights or just switch them at certain times of the day/week?

I would suggest to produce a flow chart or truth table of the on/off times and add movement detection parameters within these times if required and what kind of movement detection you want to use.

Once you have the exact lighting time parameters then you can construct the code.

If you are using the RTC for timing then you will need to synchronise the meb clock to the correct time either by network time or atomic clock code (don't forget winter/summer time offsets). Using atomic clock (DCF77 best for European locations) is preferable as you will not need internet access. Using an automated time setting function is more accurate and save setting the time, reduces physical key functions and to set the time.

The LPC1768 has a good battery backed up RTC but pricy, with Freescale you will need an independent RTC for stability.

The LP1768 does not have very good low power modes so your project MCU will depend on if you want a low power battery controller or mains powered.

Decide these factors first then look at code.