Timing Accuracy
#1
Posted 28 July 2011 - 06:19 PM
#2
Posted 29 July 2011 - 03:50 AM
#3
Posted 29 July 2011 - 06:41 AM
A simple circuit with 555 timer working in monostable mode should easily fit your needs. For more advanced logic or if the PC is not able to trigger it directly, you could use Netduino to control the 555 timer(s)....that I want a 10 ms pulse. ... Then I could tell it to do another pulse for, say, 30 ms, etc.
Just out of curiosity, have you tried Multimedia Timers?The .NET timers won't do anything less than about 15 ms and are prone to being interrupted
#4
Posted 29 July 2011 - 06:56 AM
#5
Posted 01 August 2011 - 03:41 PM
A simple circuit with 555 timer working in monostable mode should easily fit your needs. For more advanced logic or if the PC is not able to trigger it directly, you could use Netduino to control the 555 timer(s).
So, out of curiosity, how might you go about that? A 555 timer in monostable mode is controlled by the RC network attached to it. I would need to be able to vary the R and/or C in order to change the pulse width on the fly. I could imagine using the digital outputs of the Netduino as a switch to connect / disconnect several different RC networks to the 555 giving some number of pre-defined pulse widths, but is there a solution that could allow me to dial up any arbitrary pulse width?
#6
Posted 01 August 2011 - 09:08 PM
Initially I thought I could use resistors in series to program a 555 timer with the Netduino controlling which resistors are included in the series. I could have say 1K, 2K, 4K and 8K and by including various combinations of resistors I could have 15 different resistances giving 15 different pulse widths. My problem with this is that a simple switch (e.g. SCR, SCS or some type of transistor) wouldn't work. I need something equivalent to a SPDT switch because I need to bypass the unused resistors.
So then I though it would be easier to use the capacitors in parallel instead. Same deal, 4 different capacitors giving 15 different total capacitance values. The problem here is finding capacitors with big enough values and tight enough tolerances. The capacitors with good tolerances have low capacitance which then would require a huge resistor to give a useful pulse width.
Then I decided that this was all too complicated, and started look for something more integrated. I came across this:
82C54 CMOS Programmable Intervel Timer
If I'm reading this correctly, this might do the job. I could use the Netduino to program the 82C54 and it will fire off a single pulse (in mode 1) at some multiple of the clock signal. I would just have to find an appropriate clock source (a crystal perhaps?).
Any thoughts from the experts out there?
#7
Posted 02 August 2011 - 04:11 AM
#8
Posted 02 August 2011 - 12:49 PM
At this point the 555 is not convenient, because you should switch several resistor with a transitor or similar. The circuit is not particularly difficult, but it is not linear. Then you must select the exact value of any resistor, finally write a function in C# that maps the time in the relative resistor switches.
IMHO, the task is not worth.
The 82C54 is nice (supposing you're able to find somewhere), but it has a parallel access. It's designed to interface with microprocessors, and not with microcontrollers. That makes hard to exchange data with it, very hard. You need tons of I/O and the time to set them: the setting procedure could take more than 10ms!
I'd have a decent solution, but I need some parameter from you.
Which is the minimum time you need?
Which is the maximum error on the time?
If I understand well, you are going to create some pulse-sequences on/off: is it true?
Cheers
Thanks for the input Mario. I figure a minimum pulse width of 10 ms, maybe 5 ms would be nice. Anything less than that is definitely overkill. Maximum pulse might be around 200 ms. As for error, the less the better (obviously), I think around 10 - 20% would be acceptable. Precision is probably more important than accuracy, so if it's consistently 1 ms too long on a 10 ms pulse (averaging to 11 ms), that's probably better than sometimes being 9 ms, sometimes 11 ms (averaging to 10 ms).
The final application would involve, for a set of pulse widths (let's say 10, 20, 50, 100, 200 ms), generating in random order one of those pulses, then several seconds later generate another one, and so on until all pulse widths have been presented. The way I envision it, I would use an application running on the PC to order up the pulses as and when they are needed (the PC would also need to collect feedback after each pulse). The start of the pulse isn't as important as the width, so if the pulse doesn't start until 100 ms after the PC decides it needs it, it's not a problem. If it doesn't start until several seconds later, then it becomes a problem.
Hope that makes at least some sense.
Thanks again.
#9
Posted 02 August 2011 - 01:21 PM
#10
Posted 02 August 2011 - 01:24 PM
I see.
Since it costs almost zero, I'd suggest to try directly with the pure C# code in the Netduino. Then, you will decide whether the accuracy is acceptable or not.
I'd avoid to make you useless circuits unless strictly need.
It seems that the Netduino will make a very little job. There are tricks to minimize the GC task, and to maximize the precision on timings.
So, start considering the Netduino WILL BE able to solve your problem. Write the code to exchange data to/from PC, and toggle the output port on/off. When the code is ready, but the timings aren't so accurate, post your code and will trim it as the best.
Cheers
Thanks Mario.
I just got my Netduino board and I'm going to start playing around with it. I agree with you that it makes sense to see how good (or bad) the timings are with just the Netduino board by itself before I start resorting to something external. I'll play around and see what happens.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users