RC India

General Topics => Chatter Zone => Topic started by: taksh on July 01, 2018, 11:41:24 AM



Title: Why pwm value are not constant
Post by: taksh on July 01, 2018, 11:41:24 AM
I am working on diy radio transmitter & receiver.
I found difference in pwm values. On Serial moniter, pwm values are constant.
I have made an another arduino system to check pwm values but pwm values are not constant.
Why pwm values are not constant?
I tried many times to get no difference but there is a difference of 4~11. (Usingg servo functions)
when I changed code and applied interrupts then difference is so large.
1472 1468 1468 1420 1416 1468 1472 1468 1468 1420 1420 1468 1468.
too much difference in values.
but using servo.h,
I am getting pwm values 1495 1489 1495 1496 1489 1496 1489 1496 1489 with difference of 4 ~ 11.
Receiver sending 1500 pwm value but pwm checker(arduino with pulseIn function) getting values with difference of 4 ~ 11.
Why i can't get exact 1500 value?
Problem with arduino pwm value system?
If problem is not with pwm value checker system then what is the problem?
How to fix this?
Any solution ?
Please tell me .....





Title: Re: Why pwm value are not constant
Post by: KALYANPRODHAN on July 01, 2018, 09:53:19 PM
Check LPF at output and/or filters in your power line.
The dropped ticks are on leading edge, not trailing edge of the square wave envelop.
Stray capacitance of the final stage buffer transistor (MOS) of your arduino chip may be the cause.
Also keep eye on error signal.. If your A/D resolution, not proper, hunting may occur.


Title: Re: Why pwm value are not constant
Post by: ghoshatanu56 on July 02, 2018, 05:28:26 AM
Taksh I don't know if you have mapped the reading of adc from 0-1024 to 0-255 for transmission of one value  in one byte. If that's the case then it might be the culprit.


Title: Re: Why pwm value are not constant
Post by: taksh on July 02, 2018, 08:37:36 AM
i am using int to store 1000-2000. byte can't store more than 255. so i used int.
Transmitter system is off So receiver will know that signal is lost so default values will be  used & send via pwm
Throttle 1000 and other 1500
I used 1500 pwm output pin and pwm value checker system is getting values but with difference.


Title: Re: Why pwm value are not constant
Post by: Balakrishna Reddy on July 02, 2018, 12:14:32 PM
I tried to understand your problem by reading your post couple of times but unable to interpret your problem.
First tell me few things.
What serial monitor is giving you constant PWM values?
Indeed I am unable to understand what is your entire setup.
What all are you connecting to what?

I would not suggest you to build a transmitter of your own. Better would be to try for a mod for an existing tx. I don't say it is impossible indeed that is not much complicated at all. But building a good transmitter is difficult job which involves countless hours of investment.

Anyway you need to be clear on your problem statement and what all have you setup.


Title: Re: Why pwm value are not constant
Post by: taksh on July 02, 2018, 03:48:21 PM
@Balakrishna Reddy

Serial monitor with Recevier's  port showing constant  but Serial monitor with arduino pwm checker system showing pwm values different values.
Diy transmitter & receiver is my project.
I will not use diy radio for rc planes.
I will use diy radio for quadcopter.
I will make video and i will upload on youtube and i will share video with you.



Title: Re: Why pwm value are not constant
Post by: tictoc21 on July 02, 2018, 04:38:31 PM
What is purpose in building building own tx and rx


Title: Re: Why pwm value are not constant
Post by: ambattuhari on July 02, 2018, 04:54:50 PM
Reinvent the wheel  8-)


Title: Re: Why pwm value are not constant
Post by: tictoc21 on July 02, 2018, 04:56:11 PM
 ;D :giggle:


Title: Re: Why pwm value are not constant
Post by: taksh on July 02, 2018, 06:09:18 PM
@tictoc21
Purpose is "knowledge" I am from electronics field and want to gain knowledge of making good tx & rx.


Title: Re: Why pwm value are not constant
Post by: taksh on July 02, 2018, 06:14:53 PM
@ambattuhari
This thread is not related for reinventing wheel.
You may try to reinvent wheel & make another thread for reinvention of wheel. Okay.  :giggle:
All the best for your reinvention :thumbsup:


Title: Re: Why pwm value are not constant
Post by: girishsarwal on July 02, 2018, 06:50:27 PM
- Show us some hardware of how you've setup things
- How are you generating the signal? i am assuming a pot leading to the ADC pin. On the pot, have you connected VCC and GND to the end pins? Also cover with heat-shrink
- int on the arduino is a 16 bit so byte clamping or byte rollover is not a problem



Title: Re: Why pwm value are not constant
Post by: taksh on July 02, 2018, 08:22:14 PM
@girishsarwal
A transmitter & receiver & pwm value checker system(PVCS) made with arduino.
Transmitter is not in use. Receiver & PVCS are in use.
Receiver is generating pwm signal and i have used electronoobs codes.
Servo.h is used for generating pwm signal. PWM PINS - D2(throttle),D3(yaw),D4(pitch),D5(roll)
When transmitter is not working & signal is lost then receiver have default system to send 1000 as throttle 1500 as other values(roll,pitch,yaw). So there is no role of transmitter & receiver is sending default values.
So, receiver is sending 1500 & 1000 by default.
I connected D3 pin of Receiver to D3 of pwm value checker system(PVCS) via jumper wire.
but i am getting a constant value(1500).
I am getting value with difference.
1489 1495 1502
not exact 1500

Sir please see video
https://www.youtube.com/watch?v=Izh4AoyTjRo
(sorry for tv serial sound)



Title: Re: Why pwm value are not constant
Post by: girishsarwal on July 03, 2018, 05:26:27 PM
This is most likely due to stray noise on your PVCS made using arduino. you might want to insulate it properly and ensure that all ADC pins besides D3 are not floating. ground them if necessary for testing.

You are using a 0-5v range with a 10 bit ADC resolution which means each value represents (5-0)/1024 = 0.00488v/notch
Your worst value is 1489 which is 11 notches below 1500 means 11 * 0.00488 = 0.0537v,  noise is a possibility

Arduino ADC's are pretty basic and do get thrown off at times. Also, it'd be useful to know what are you using as Vref on the ADC? see https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference/

As a general rule of thumb, when one is dealing with analog circuits, one must step up to deal with "windows" of signals rather than discrete values in digital.


Title: Re: Why pwm value are not constant
Post by: girishsarwal on July 03, 2018, 05:31:05 PM
And this as well:

https://www.arduino.cc/en/Tutorial/AnalogInputPins