Hi!,
Im an electrical and electronics engineer having over 5 years of automation experience. i checked your program and I think I get the idea. I have done hundreds of such programs and have also done practical implementations as well. I need to know the type of transistor u are using for this purpose. BJT or MOSFET since the operation of transistors vary according to the type. Therefore the circuit has to be build accordingly. Let me know more details of the project. I can help you to complete the project accurately and successfully.
Thanks!