Car pc usb power delay controller

Hi, im installing a PC into my car, i have a startup-shutdown controller built on to the psu,

i need some way of turning on a powered usb hub when the ignition turns off, thats simple,

but i need a way to keep it on for x amount of time after the ignition is turned off, aswell as stay on if the ignition is switched back within said x amount of time. could you help me with the coding?

How is your PC related to an Arduino?

if you cannot solder it yourself just go to a scrapyard and pull the internal-light-delay-thingy out of a car and use this.

Otherwise i would use a relais with a condensator at the controlwire. when ignition is out the condensator will unload until the relais opens again. Duration is set by capacity of condensator

DrDiettrich:
How is your PC related to an Arduino?

id be using the arduino to control power to a usb hub, that way i can keep devices on while im filling with petrol.

dreadkopp:
if you cannot solder it yourself just go to a scrapyard and pull the internal-light-delay-thingy out of a car and use this.

Otherwise i would use a relais with a condensator at the controlwire. when ignition is out the condensator will unload until the relais opens again. Duration is set by capacity of condensator

scrappies are really dear, considering i have a spare atmega328 chip with the bootloader already on it, i thought i would be easier to code a delay system instead of buying one

oh. well then just put ignition + to a serial pin and implement a timer which starts after the signal at this pin is lost.

after this timer counts to zero the ardunio will go to a standby-loop (check every second) until ignition is on again.

when signal returns before counter reaches zero, reset and stop it.

arduino can left turned on.. it will takes years to run your battery dry just from the arduino