I tried several days to get a solution to my dilemma, maybe some help will be useful. Long history short: I have a electric thing to put towels (
http://goo.gl/kCeCZ) uses little energy but montly it is more than 1 towel, so I want to add a timer like an oven to this device to push a button and program let say, 5 hours.
OK. My current idea (I know I can use a mechanical timer or something like that but I wish to make a little device with a small attiny to learn):
The sensor is an inductance sensor to detect when the momentary button is pressed (after relay is connected by the attiny so in this way the relay works like a 'life-supporting' device and the attiny can kill itself).
So the first attached photo shows the current circuit, my small relay board, inductance sensor so I need to finish the software now. Here is the problem. This attiny has 4 analogs, 2 pwm. As I don't have an HV programmer I have 3 analogs, but I am using 1 as an output (2 leds and relay), one analog input pin for the current sensor and I want to connect a 8-dip-switch in the last remaining pin.
Base delay is 10s (instant off), and every switch will add some time to have a total of 16 hours max (8 bits):
Second attached photo shows the dip switch and my test environment with an arduino, I am guessing this is possible with some combination of current dividers and maybe another idea? (attiny IO is 10 bits so I think I can reach 8 bit resolution including some noise of the reads)
Last attached photo shows the attiny in the usb programmer, it is working well but I am debugging first the logic in an arduino because it is a lot easier with the usb serial.
So, any recommendation/idea?
Thanks!