Hi all, first i would like to say that i'm a electronics hobbyist with no formal education on this subject so please bare with me

I have those ebay 5V relay module with 3 pins - VCC, GND and IN - and to latch the relay i just need to pull IN pin to ground.
But the circuit that i intend to use to control it has a little quirk. I need to monitor a voltage source (about 9V) and i would like to drive the relay in the following manner:
1-
If the voltage source = 0V
Then relay
OFF2-
If the voltage source = 9V
Then relay still
OFF3-
If the voltage source drops from 9V to 0V
Then relay
ONThe voltage source always starts at 0V, after 'x' amount of time it jumps to 9V, after 'y' amount of time it goes back down to 0V and after 'z' amount of time the whole "system" resets and repeats again.
I could use a microcontroller to implement this (like an Arduino) but i think its an overkill... I'm in the impression that this could be done with some transistor logic and also, maybe, with some OP AMP, but i can't get my head into it..
Please help!

Big thanks in advance!
