Drive 5v relay with 2N2222

Did you try adding a base resistor ?

Do you have a 555 timer ?

When does the 5v appear ?