# smallest variable timed switch circuit?

Status
Not open for further replies.

#### legepe

Joined May 11, 2016
9
Hi all
Is it possible to build a variable timed switch that can fit into a space of around 20mm x 15mm which would have a range of something like 10min to 5hrs
Ive done some googling/youtubing but there doesnt seem to be anything suitable.
The only thing ive found which looks ok is https://www.ebay.co.uk/itm/152478915048
Can anyone give me advice, Im a complete newbie
Thanks
legepe

#### sghioto

Joined Dec 31, 2017
1,450
Can anyone give me advice, Im a complete newbie
That module should do what you need. How were you planning on activating the timer and what will the timer be controlling?
SG

#### legepe

Joined May 11, 2016
9
It will be controlling an automotive device..12v around 4000mah
What i want to do with the switch is shut down a supply for a set time, create an open contact for that time chosen, then once the time is lapsed it will create a closed contact, a time again will then be manually chosen.. regarding the actual mah's of device is not important, however it will need to be this battery power that drives the circuit
Would it be possible to have chosen times such as: 10min / 30min / then 1 hr / 2 hr / 3hr and so on?
What other components will I need to complete this?

#### sghioto

Joined Dec 31, 2017
1,450
Would it be possible to have chosen times such as: 10min / 30min / then 1 hr / 2 hr / 3hr and so on?
Unfortunately not with that timer as it has no programming access. To get something as small as you requested would require building it yourself.
SG

Joined Mar 10, 2018
4,057
Thats easly done with a low end micro like a ATTINY85, PSOC 4, uChip....

Can you code ? If not have you tried block coding ?

Ardublock, , San4Arduino, Scratch, Blocky, the first two can be used with embedded
micros.

If you want changeable time periods how do you want the interface to function,
switch to select timing, LCD interface to look at while selecting timing, just a set of
dip switches........?

Regards, Dana.

#### legepe

Joined May 11, 2016
9
Thats easly done with a low end micro like a ATTINY85, PSOC 4, uChip....

Can you code ? If not have you tried block coding ?

Ardublock, , San4Arduino, Scratch, Blocky, the first two can be used with embedded
micros.

If you want changeable time periods how do you want the interface to function,
switch to select timing, LCD interface to look at while selecting timing, just a set of
dip switches........?
No I cant code.. I have a arduino starter pack and I have a microchip programmer but I don't have experience
To know what time is being selected I would think a row of mini led's might work ok

Joined Mar 10, 2018
4,057
How do you want to implement the time delay selection, switches, a button
'and LCD with a menu choice ....?

Regards, Dana.

#### legepe

Joined May 11, 2016
9
I guess to keep it as simple as possible it could be done with one button. press once for 10min, twice for 30min, third 1hr, forth 2hr and so on up to 5hrs with a 5 second press of the button to select the time

Last edited:

#### pmd34

Joined Feb 22, 2014
518
Hi legepe, you might be able to use something like a 555 timer or Mic1555 to get a very long time period. Though the most flexible would be to use a Microcontroller's built in timer maybe using 2 timers 1 feeding the other to get a very long time period. Then use push buttons or small selector switches as a way to set the time.

Joined Mar 10, 2018
4,057
If you are not in a rush maybe try Ardublock, a graphical way of programming
Arduino ? There are training videos there as well.

http://blog.ardublock.com/

ArduBlock

Maybe think about using ATTINY85 as the processor, you could use your Arduino board
to program it after doing the code in Ardublock.

Regards, Dana.

#### DickCappels

Joined Aug 21, 2008
6,587
Sounds like something that could fit
In 100 or maybe 200 bytes. Should not take a compiler and could be a good learning experience.

Joined Mar 10, 2018
4,057
TS do you have an oscilloscope or a DMM ?

With Ardublock do something as simple as toggle a pin. Tie to the pin an
LED (use 200 ohms vs 1K shown) -

Set pin high LED goes off, pin low it turns on.

Then do it in a loop with delays and make led blink.

Regards, Dana.

Last edited:

Joined Mar 10, 2018
4,057
Here is an basic example using Ardublock using an ATTYINY85 UP, 8 pin dip.

The ATTINY85 is programmed using an Arduino Uno setup as a programmer.

The software programming is done visually using Ardublock. Drag and drop
visual blocks each having a code purpose, like name a variable, add two items,
write to a pin.....

What Ardublock does when you upload its block solution is convert the block
objects into Arduino C code that will run on ATMEGA chips, the ones used in
Arduino and by ATTINY. The C code you can look at, but its not documented same
ways as Ardublock showing comments, unfortunately. But at least you can get the
gist of what C code looks like. Then from Arduino IDE you compile and upload to
the Arduino, or in this case the ATTINY85 chip.

Ardublock is free, ATTINY85s around $1. This particular program uses the onboard PWM in ATTINY85 and sweeps its duty cycle from 255 (100%) down to 0%, and keeps repeating this. There are some nuances to this approach as Ardublock normally used for programming the Arduino, not another external chip, the ATTINY85, so you have to setup Arduino as a chip programmer for ATTINY85. But is not a galactic leap to do this. And once Arduino is setup you can program to your hearts delight using Ardublock for many applications. Fun for sure. Very productive to boot. And not too steep a learning curve. Schools for kids in 8 th grade and above using this as a teaching vehicle. Another language like Ardublock is MIT Scratch, but its not Arduino targeted, more PC focused. Interestingly once you learn one language the other becomes much easier. Like a flat bladed screwdriver, learn how to use that and the others in the kit become obvious. (Although took me years....so sad.....) ATTINY85 you can do lots of stuff, timed pulse generation sequences, analog measurements, display handling (character type), button sequences.........tons of applications. Web is full of them. Regards, Dana. Last edited: Thread Starter #### legepe Joined May 11, 2016 9 Thanks for all your replies everyone...! You are pointing me in the right directions thats for sure.. and that is what I need at this stage.. I do realize I have some learning to do here.. and my problem at the moment is time to do this.. I will en devour to do this once I can get the time.. Thanks again... legepe ps: regarding this project of mine.. I will get at least one attiny85.. so I have it to get started... what other components should I buy.. and for sure.. will the attiny85 do what I need it to do.. with 10min to 5hr selections of time? Last edited: #### danadak Joined Mar 10, 2018 4,057 ps: regarding this project of mine.. I will get at least one attiny85.. so I have it to get started... what other components should I buy.. and for sure.. will the attiny85 do what I need it to do.. with 10min to 5hr selections of time? 1) Buy 2 ATTINY85's, around$ 2-3 each, dip. One for spare.

2) Yes on 10 min to 5 hours

https://forum.arduino.cc/index.php?topic=245628.0

3) Buy 1 Arduino UNO ~ $6, get one with cable if you do not have one. That will be used as the programmer for the ATTINY. 4) Jumpers, assortment, male to male, female to female, male to female https://www.banggood.com/search/jumper-wires.html 5) Proto board, say this size or one bigger https://www.banggood.com/Mini-Solderless-Prototype-Breadboard-170-Points-For-Arduino-Shield-p-74814.html?rmmds=search&ID=233&cur_warehouse=CN You are going to need a relay, or a SSR, or a MOSFET to handle the 4A. Do you have a R assortment ? And some small caps, range 1 - 100 uF, and ceramic disks, .1 uF, 25 - 50 volts ? While you are waiting some projects on web https://hackaday.io/projects?tag=attiny Regards, Dana. Last edited: #### djsfantasi Joined Apr 11, 2010 6,799 You’ll need a programmer for The ATTiny85 and an IDE. I use this one It has great support and training from SparkFun. It also supports using the Arduino IDE. Arduino code is well supported and mostly supported on the ATTiny85 Development is done on your PC and uploaded to the ATTiny. You don’t need an Arduino. It’s about$16, but you only need one.

You can do long delays in code with one timer. Simply. 10 minutes to 5 hours. Or 5 days or more

Last edited:

#### sghioto

Joined Dec 31, 2017
1,450
Since we are leaning toward micro programming I would like to suggest the Picaxe system which is also very user friendly.
SG
http://www.picaxe.com/

Joined Mar 10, 2018
4,057
Since we are leaning toward micro programming I would like to suggest the Picaxe system which is also very user friendly.
SG
http://www.picaxe.com/
That can be programmed with Blocky, graphical language just like Ardublock, or typed Basic
language.

Regards, Dana.

#### ScottWang

Joined Aug 23, 2012
6,933
The thread was temporary closed andwaiting for Moderation Team to discuss.

Status
Not open for further replies.