Home     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science

### Author Topic: resistance controlled timer  (Read 3396 times)

0 Members and 1 Guest are viewing this topic.

#### steveyg

• Newbie
• Posts: 4
##### resistance controlled timer
« on: October 23, 2012, 21:16:28 PM »
Hi all,

Ive been asked to make a circuit that operates a relay for a selectable amount of time.

Using dials like that from a decade box i hope to be able to set the time for how long the relay is 'on' before returning to its 'off' state, it should be operated using a push switch regardless if the switch is still pressed down.

The trouble is I cant find any type of circuit where a timer is controlled by resistance, or multiple resistance dials, hopefully i can make it in the range of microseconds to 10 seconds.

#### kam

• Hero Member
• Posts: 1849
##### Re: resistance controlled timer
« Reply #1 on: October 24, 2012, 09:17:05 AM »
Do you need precision? If not, then you can make it with a 1-shot 555 timer. Check this page:
http://www.pcbheaven.com/wikipages/555_Circuits/

Got o the "Basic monostable circuit". You can now make a batch of switches each one adding a parallel resistor to the circuit, so each switch when closed will decrease R, thus the pulse will be shorter.

#### steveyg

• Newbie
• Posts: 4
##### Re: resistance controlled timer
« Reply #2 on: October 26, 2012, 00:17:51 AM »

Ive now been told not to use a 555 because theyre hard to calibrate and i should try for a harder project to make as 555 is deemed too basic, PICs and TTL counters are the route i should take!

It has to be pretty accurate, maybe to 10's of microseconds so the switching of the relay will be a factor so maybe i could start counting after the relay makes contact!

Im now thinking of other ways to control the time other than resistance wheels and may likely use an oscillator

Im not very good at programming PICS either so the simpler the better really

any thoughts?

#### cheerio

• Sr. Member
• Posts: 306
##### Re: resistance controlled timer
« Reply #3 on: October 26, 2012, 00:56:45 AM »
you can try to use atmel attiny or a small pic with similar options. use the 10bit adc for calculating the time setting of the resistors. use hardware timers and interrupts for the timing. if you add a crytal you get very good accuracy. For fast switching you can use a Soldistate relay for AC or a transistor for DC.

#### kam

• Hero Member
• Posts: 1849
##### Re: resistance controlled timer
« Reply #4 on: October 26, 2012, 20:41:37 PM »
solid state relay as cheerio said is a must for fast switching. Although i work with PICs, i am pretty sure that doing this with arduino will be much easier (with the arduino libraries) and cheaper in overall (with PCB etc).

A microcontroller (arduino, pic...) will certainly be much more accurate than a 555. You may also wanna use digital electronics with gates and counters to achieve similar high accuracy but i totally recommend a microcontroller solution. One chip does the job.

#### cheerio

• Sr. Member
• Posts: 306
##### Re: resistance controlled timer
« Reply #5 on: October 26, 2012, 22:34:55 PM »
Using arduino would make all this very easy indeed. If you want to do this the old fashioned way w/o all the fancy libs i can help you if you go for AVR.
If you want to go the arduino way i cannot help you much as i don't use arduino much. But you won't need much help with arduino i guess
It would be very cheap to use a small Attiny13 (ebay) (dataheet). It has a 10bit ADC which is more than good enough for the job, a 8-Bit timer which should be sufficient, it even has SPI if you want to be able to expand your circuit with anything. Just keep the 1kb flash in mind that is more than enough for your project but is not very much. If you use the tiny then you should get a 8mhz crystal for example and 2 22pf capacitors for the oscillation. you need a 100nf capacitor between vcc and gnd and a 10k pullup on reset as well.
« Last Edit: October 26, 2012, 22:44:04 PM by cheerio »

#### steveyg

• Newbie
• Posts: 4
##### Re: resistance controlled timer
« Reply #6 on: October 31, 2012, 00:01:10 AM »

ive talked it over with a few people but the majority seem to think that going down the PIC route may be easiest. i will also use solid state relays to take away the switch time although i see they are still not perfect but i suppose ill get that sorted at a later date

An alternative someone else suggested was an oscillator, TTL counters/dividers, latches, BCD switches and signal gates but i dont quite understand the whole picture, i gathered they were counting each pulse and dividing it until the required amount of pulse occurs calculated from 1/t etc...

But as stated i will try for the PIC route so if you could suggest;

1)what PICs look at first and why

2) how to set the time/counter from an operators point of view i.e. from switches on a box that operates the required count/time. im just unsure on whether i need BCD counters or decimal counters.

i.e. http://uk.rs-online.com/web/p/thumbwheel-switches/4250136/ or http://uk.rs-online.com/web/p/thumbwheel-switches/4250120/

any thoughts

#### kam

• Hero Member
• Posts: 1849
##### Re: resistance controlled timer
« Reply #7 on: October 31, 2012, 08:10:52 AM »
I really wonder who told you that PIC is simpler than Arduino

PIC would be my #1 choice but i happen to know about PICs already. Regarding the TTL circuitry, if you plan to make it for educational purposes then this would be the best solution, but if you plan to make something that will work without anyone care how it works, then go with a microconotroller.

As for the PIC, i suggest you start with the 16F88. It is not as cheap as the one that cheerio suggests, but I have an on-line guide to help you start based on this chip. Actually, this chip is rather an expensive one due to its capabilities (a load of modules and protocols).

- With mcrocontrollers you can leave your imagination free regarding the time selection. An LCD for example with a rotary switch can be used to set time.
- Or you can go with a simple potentiometer
- Or you may wanna use 4 buttons which will set a 7-segment counter (2 buttons for hour up-down, 2 buttons for minutes up-down)

#### steveyg

• Newbie
• Posts: 4
##### Re: resistance controlled timer
« Reply #8 on: October 31, 2012, 22:41:32 PM »
im still on the fence regarding PIC/4017 chip.

First i dont know how i would connect the thumbwheels to the PIC or the 4017, i just cant see it in my head!

im trying to keep it simple at first and then maybe add it it later so i will consider the 7segment display as an after thought. i was thinking of having 3 thumbwheels i.e. 0-9 and a multi-select type switch that either adjusts the decimal points to the left or right i.e. 20mS, 200mS etc... or it will change the range i.e. x10-3, x10-6, x10-9

any thoughts?