PDA

View Full Version : Mini-HowTo PIC 10f202 pwm to ppm converter (BL-converter)


Cesco
May 03, 2009, 12:53 PM
Hi,
i hav made a single channel pwm tp ppm converter with a pic 10f202. I use this on a walkera 4.1.

Video of the thing in action here:
http://www.rcmovie.de/video/b32b441c0cc1d87caa76

Pin assignement:
;GP0 pwm input, 0.5ms rate
;GP1 test output, the pulse here must be a multiple of pwm rate.
;GP2 ppm output
;GP3 calib input, short to gnd at start for bl-esc max-min-ppm calibration

Source attached

Cesco
May 03, 2009, 05:06 PM
I forgot ... in the attached source the max throttle is set to 50%. That is because my motor in the 4#1 is much too strong. It would rip apart the rotor. Change the division to /4 from /8 to use full throttle range, or increase the filter additions by the two elements that are out-commented with "too mcho power".

Terry S
May 03, 2009, 05:25 PM
Thats great !
Can you explain how the calibrate is done.

Thanks, Terry

Cesco
May 03, 2009, 05:50 PM
The esc throttle range is calbrated by shorting gp3 to ground, powering up and wait for the esc's beep-beep. Then remove short and wait for normal esc statrtup Beeeeieeep. This works with esc's with turingy / pentium style throttle range programming.

The calib-output pin shows the internal pwm measuring time. This is adjusted for 1.5ms, 3 times the 4in1 pwm rate of the walkera 4#1 4in1.

The pwm-ppm translation will not be linear if your 4in1 uses 1ms pwm timing. Adjust the calib-output to 2ms in that case (or any multiple of 1ms) by inserting nop's, and slightly changing the number of loop passes to fine tune.
You will need a scope for this.

Almaz
May 03, 2009, 07:50 PM
Do you have any code in basic or example in basic?

Cesco
May 03, 2009, 10:27 PM
Basically, such basic chips like the 10f202 do like to be programmed in a basic variant called assembler. :p

Almaz
May 03, 2009, 10:51 PM
Basically, such basic chips like the 10f202 do like to be programmed in a basic variant called assembler. :p


lool who needs assembler when we have Picbasic Pro and Proton Basic and does the same job but takes 20 times less coding.

Cesco
May 03, 2009, 11:11 PM
I would not know how to do a timing loop in basic. Sounds scary difficult in the interpreted basic variants i know. That is why i use assembler.
I also think a chip with a total of 16 bytes memory and reduced instruction set is fun in assembler :D

Terry S
May 05, 2009, 03:09 AM
Thanks for the info I will give it a try for sure ;)
Will it work with any pwm motor signal ?

Terry

Cesco
May 05, 2009, 11:27 AM
Read the posts again. This vers. is for 0.5ms pwm. It may work up to 1.5ms pwm with some jitter / reduced linearity, but you better change the code to fit your signal timing.

I have a test version for coaxial heli's with 1ms timing. This is a 2 channel version, not tested in flight yet. Demo video:

http://www.rcmovie.de/video/55fc1add054b412a8771/PWM-to-PPM-converter-mit-PIC-10f202