317Views7Replies

Author Options:

how to generate signals arduino? Answered

  uhi i want to generate 3 equal variable pulse high with constant pulse low signal that vary with potentiometer and asume it repeat it self every  10us and pulse min is constant 2u and pulse high vary betwwen 5-8u and i want it to carried at specific frequency? i attach the signal i want to generatel 

Tags:signals

7 Replies

user
steveastroukBest Answer (author)2013-10-08

The arduino PWM clock can be varied.
Download the l;ibrary "timer3.zip" from here
http://playground.arduino.cc/code/timer1
In the timer3 code you will find a new option

pwm(pin, duty, period)
Generates a PWM waveform on the specified pin. Output pins for Timer1 are PORTB pins 1 and 2, so you have to choose between these two, anything else is ignored. On Arduino, these are digital pins 9 and 10, so those aliases also work. Output pins for Timer3 are from PORTE and correspond to 2,3 & 5 on the Arduino Mega. The duty cycle is specified as a 10 bit value, so anything between 0 and 1023. Note that you can optionally set the period with this function if you include a value in microseconds as the last parameter when you call it.

This should give you the control you need.

Select as Best AnswerUndo Best Answer

user
framistan (author)2013-10-07

I had some experience making an arduino put out a 512 hertz signal. We discovered that the ACTUAL frequency coming out could be PLUS or MINUS about ten hertz from chip to chip. So, I don't think you can depend on extreme accuracy unless you are making a "ONE-OFF" and can fine-tune it. Also, we discovered just SOLDERING the pins could alter the output frequency if you got the pin too hot for too long.

Select as Best AnswerUndo Best Answer

user
steveastrouk (author)framistan2013-10-08

All depends on the clock source. If you use the on-chip RC oscillator, you will get the behaviour you observe.

Use a resonator and it will be better, use a crystal and you'll be in the 20PPM level.

Select as Best AnswerUndo Best Answer

user
britich (author)2013-10-07

variable frequency and variable dutycycle(high time increase )

Select as Best AnswerUndo Best Answer

user
britich (author)britich2013-10-07

this is output on throttle stick directly

Select as Best AnswerUndo Best Answer

user
steveastrouk (author)2013-10-07

Variable frequency, fixed duty cycle, fixed amplitude ?

Select as Best AnswerUndo Best Answer