Author Topic: Control period of multiple timers from one input  (Read 3417 times)

0 Members and 1 Guest are viewing this topic.

Offline michaelivTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
Control period of multiple timers from one input
« on: July 04, 2015, 10:39:36 am »
Hi,

I'm looking to control the time duration of multiple separately triggerable timers ( monostable oscillators ) from a single input.
So, basically, have a potentiometer (or similar) that sets the period of multiple individually triggerable timers.
The time duration for the timers should be configurable between say 5s - 100s.
Ideally I would also like:
- The control should be linear (potentiometer is at 0% - 5s delay, at 50% - 53s, at 100% - 100s).
- Display the delay in seconds on a voltmeter ( 0.05v = 5s ... 1.00v = 100s.. etc...)
- Have it be relatively accurate ... +- 5%.

What I've managed to come up with so far is to have the timer be a basic 555 monostable but have it's capacitor charged by a shared PWM source. By altering the duty cycle of the PWM I can control unlimited individually triggerable monostables separately ( see attached schematic ).
However this has the issues of not being linear, I can't find an easy way to convert the final timer delay to a voltage and it's also somewhat inaccurate.

Does anyone have any hints on better approaches for this / ideas to research / how to improve my current approach ?

Thanks!
 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1576
  • Country: de
Re: Control period of multiple timers from one input
« Reply #1 on: July 04, 2015, 10:46:20 am »
Any specific reason why not to use a microcontroller?
Trying is the first step towards failure - Homer J. Simpson
 

Offline michaelivTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
Re: Control period of multiple timers from one input
« Reply #2 on: July 04, 2015, 05:46:50 pm »
I'm not that familiar with micro-controllers, but learning wouldn't be a problem.
I'm thinking it would require much more circuitry and I'm not sure it would be that easy to implement since I need 20 separate channels I want to control( 20 inputs[switches] and 20 outputs ).
Also I was trying to keep the size down.
Would this be easily done with a micro controller - am I wrong about what I'm assuming above ?
 

Offline michaelivTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
Re: Control period of multiple timers from one input
« Reply #3 on: July 05, 2015, 08:27:50 am »
I've been thinking more about the micro-controller approach and I think I would need to route 20 inputs + 20 outputs across the board which wouldn't be ideal. I would also require a multiplexer probably so the project would get quite complex.
Are there no good solutions for accomplishing what I'm trying to do ?
 

Offline picandmix

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: gb
Re: Control period of multiple timers from one input
« Reply #4 on: July 05, 2015, 09:06:41 am »
Your 555 method seems rather unusual, every time you adjust your pwm output you directly affect the timing of All the monostables; that would surely produce confusion trying to work out what each of th 20 outputs timing has changed to ?

There probably is a way to do it using discrete logic chips but would need a good few chips to do it properly.

Agree with the others that a micro is the best way to achive things, but for the 40 + i/o you would need to look at a board like a Arduino Mega 2560, not too expensive if you buy a decent clone board.

The advantage of the Ardunio is that it has everything you need to prove things, nothing more to buy.

However you could buy a cheap display to show all the timer details etc, plus you do not say what the 555 outputs will be driving, so depending on the load you might need to fit extra transistors to each Ardunio output pin  if the load is more than a small led of under 10ma.
 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1576
  • Country: de
Re: Control period of multiple timers from one input
« Reply #5 on: July 05, 2015, 09:12:57 am »
I'm still not 100% sure what you're trying to achieve, but routing 20 pins is certainly not very complex, especially if you can use pins located next to each other. I would assume your discrete approach will be much more complex and expensive. E.g. it's certainly not a problem to have 10 inputs and 10 outputs on a typical 48 pin µC and with the 5% accuracy, you can use the internal RC oscillator (typically 1% accuracy) and use simple port access. You just need to set up e.g. a 1ms timer where you count your delays, read in your inputs and toggle the outputs.
Also using a port expander is not really complex. E.g. a simple 74HCT595 can be used as 8 pin output that is controlled by 3 SPI lines (clock, MOSI, CS). You can simply daisy chain two of them to get 16 outputs. Admittedly, I never used input multiplexers myself, but the idea is the same.
I didn't quite understand you approach to set the different triggers. One pot per channel? A small µC with 20 ADCs could be difficult, but with a microcontroller it would probably make more sense to toggle the channel with one or two buttons and use either a pot or a rotary encoder to set the value. Obviously, while you're at it, you could add a display to show the value (and the channel).
Then again, with a microcontroller, you could as well control the whole thing via RS232 or even USB (depending on the  µC).
Trying is the first step towards failure - Homer J. Simpson
 

Offline PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5127
  • Country: nl
Re: Control period of multiple timers from one input
« Reply #6 on: July 05, 2015, 09:21:09 am »
For the cost of a 555 you can also get a small pic processor like 12LF1552 with a built in ADC. If you hook your pot up to the ADC pins of the processors you can have the same layout you will have with the 555 but control will be much easier.
Keyboard error: Press F1 to continue.
 

Offline Hideki

  • Frequent Contributor
  • **
  • Posts: 256
  • Country: no
Re: Control period of multiple timers from one input
« Reply #7 on: July 05, 2015, 09:24:56 am »
What's the problem with routing 40 traces?

If you don't want multiplexers or shift registers or anything like that, just pick a microcontroller that has enough general purpose input/output pins for your 40 signals.
For a low price, the STM32F030C6T6 can almost do it (only 39 GPIO, you need one more). That's a 48 pin package. But of course, you want a display as well, so the STM32F030R8T6 has 64 pins and should do the trick (55 GPIO). Costs about $2.

With +/-5% accuracy you might even be able to skip the crystal and run it off the internal oscillator. Apart from some decoupling capacitors and perhaps some pullup/down resistors there's not much more you need, except a voltage regulator if you want to run it off a less "microcontroller friendly" voltage.

But... if it's a one-off project and you don't want to spend all your time learning to do PCB layout and program the MCU, just use the largest Arduino you can find.
 

Offline michaelivTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
Re: Control period of multiple timers from one input
« Reply #8 on: July 05, 2015, 09:51:16 am »
@picandmix - The PWM will only be adjusted when all the monostables are off(they will subsequently be triggered) - so the period of all the timers will be the same after the PWM has been adjusted ( this is what I'm trying to achieve ). The output is driving a MOSFET.

@0xdeadbeef - A channel would not have a pot, the main controller(in my schematic, the PWM) would have the pot - each channel would have a button that triggers the output on for as long as the main controller says it should be on.

@12LF1552 - Wow, that's impressively cheap for a PIC.

@Hideki - Thanks for the very specific info, I don't know enough to be able to understand how easy it would be to do this with a micro-controller but it doesn't sound that difficult.

Thanks all for your replies, I think I need to get familiar with Arduino / micro-controllers, I was hoping there would be an easier solution using basic components / IC's.
 

Offline picandmix

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: gb
Re: Control period of multiple timers from one input
« Reply #9 on: July 05, 2015, 03:50:20 pm »
Strongly suggest you look more at the Arduino as its so much user friendly and complete in terms of setting up.

While that little Pic12F is cheap, you will have to buy extra port expander chips, make your own circuit board and buy a programmer  - not quick and easy.

The most popular Arduinos are the Uno  , which can be bought as a clone for about £6 on Ebay, good for learning with, but only has 14 i/o pins, whereas the bigger, but compatible Mega 2560 has 54 i/o pins, again for about  £9 on ebay.
They are complete devices, no need to build any extra board or buy a programmer, the software is free and easy and  has a massive help forum etc.
https://www.arduino.cc/

You will find  many examples of reading in a pot and timers controlling outputs, so it should not be too difficult to get it programmed up and running.

Just curious, what are you controlling with the 20 timers ?
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Control period of multiple timers from one input
« Reply #10 on: July 05, 2015, 07:23:55 pm »
Use a constant current source to charge a capacitor; compare the capacitor voltage to the reference voltage (0.05-2V); use a switch (2N3904, 2N7000, etc.?) to discharge the capacitor.  Use logic between input and compare signals to obtain your monostable (i.e., output = input low && comparator low).

The current sources and capacitors need to be matched for equal time constants; if they need to be better than 5% matched, you probably want a calibration step (lengthy!) and some low range trimmers (5-10% range) per CCS output.

Don't bother with 555s.  They're terrible, and not suitable for long time constants like this anyway.  Attempts to force them into such applications result in such hacks as, well.. :) ..

To be fair, PWM into a timer is interesting, but you probably won't be able to get the design range and linearity quite right.  You're also subject to the leakage of the diode (~uA) from the control line (which will be significant against 100k ohms and a long time constant like this), which doesn't have a good solution (a lower leakage diode, like a diode-strapped BJT (C-B junction) would be better -- transistors have much less leakage than generic switching diodes -- but it's still something of a hack).

I'll have to remember that though... suppose you PWM'd a variable current into your timer.  Now you have two joint variables, and the result is the product of them.  So if you needed a variable time based on the multiplication of two signals, this would be one way to do it.

Your circuit might not be best for its intended purpose, but it connects with some interesting analog math functions than can be quite useful for certain purposes!

Note that the PWM clock period must be N times faster than the minimum time period, for 1/N accuracy.  Since it can only tick over in quantized steps, so you need N steps per duration to get that granularity.

Which has another valuable feature: you can use a similar circuit as a clock divider or counter: yes, a counter, in analog parts, using a few orders of magnitude fewer transistors than the equivalent digital process (e.g., a chain of T flip-flops).

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline michaelivTopic starter

  • Frequent Contributor
  • **
  • Posts: 260
Re: Control period of multiple timers from one input
« Reply #11 on: July 05, 2015, 09:26:34 pm »
@picandmix: I am considering basing this on a Arduino with lots of inputs/outputs but I think that it would take me too much time to ramp up just to get this project finished.
The 20 timers will be controlling a output signal. Basically, I have 20 buttons + 20 outputs to the user. The user presses each button and the output is turned on for however much the controller says it should be on. All outputs should be inter-linked that's why I'm looking how to controll them from one source instead of having 20 different pots that you have to adjust to the same position.

@T3sl4co1l: Yup, I breadboarded my schematics and although it works it has very dodgey behavior - i.e. as the timing period gets higher the more leakage is in the circuit and the delay varies a lot. The constant current source idea is great though I think I need a sepparate IC for comparing the voltage.

I actually think I've thought of a good, accurate solution - Have a 555 timer as a variable clock generator as the controller and have a CD4060bc frequency divider for each channel - start counting when the button is pressed and stop after 8k tics. For max 100s time duration, I can get 12ms accuracy for the timing which is more than enough. The CD4060bc are cheap also around 10c and come in SOP16 which is great. I've simulated this and seems to work, I'll have to check if it actually works in reality :)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf