Pages: 1 [2] 3 4 ... 12   Go Down
Author Topic: Decoding Radio Control signal pulses  (Read 25499 times)
0 Members and 1 Guest are viewing this topic.
London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would have thought that the transistor and resistor would have been enough to invert the signal with the 2.5 volt pulses and drive the Arduino input. But no worries if you now have something that works.
« Last Edit: February 25, 2009, 02:43:24 am by mem » Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 594
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, I have a suggestion for the code, instead of using "TCNT1 = 0;", why not remember the previous value of ICR1 and keep track of overflows, this way you can get an unlimited value for the pulse width, also it's more accurate since it takes a few clock cycles to clear TCNT1

http://code.google.com/p/circle-of-current/source/browse/vex_ppm_reader/main.c

The only thing that can go wrong is if the capture event happens when TCNT1 is 0 and the capture interrupt executes before the overflow interrupt
Logged

Freelance engineer, consultant, contractor. Graduated from UW in 2013.

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Frank, resetting TCNT to 0 takes 250 nanoseconds on a 16Mhz Arduino. Because the timer is counting in 500 nanosecond ticks I don't think this delay makes any difference. Indeed I would be surprised to hear if any of the radio control equipment that would be used with this kind of application would notice differences in timing of less than a microsecond.

I am  not clear if  the ability to detect unlimited values for the pulse width are something one would would use in radio control or if you have another application for the code.

Many thanks for taking the time to share your comments, its always interesting to see the different ways people approach things.
« Last Edit: March 11, 2009, 10:40:58 am by mem » Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 594
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

oh i totally agree that it's overkill, the RC radio would need a 16 bit ADC for the joystick if it wants to make the accuracy worthwhile, i'm not dividing my timer so i'm getting 0.05 microsecond resolution if i run my chip at 20 MHz
« Last Edit: March 11, 2009, 11:29:21 am by frank26080115 » Logged

Freelance engineer, consultant, contractor. Graduated from UW in 2013.

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
You connect the PPM stream to arduino pin 8.

Hi all, mem.... could you tell me what would be the designation for the pin 8, i´m using an Arduino Duemilinove board with an atmega 328 and i think pin 8 is not the indicated one for this board . :smiley

 thanks in advance
« Last Edit: March 23, 2009, 08:37:38 am by gmv » Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

All the pin assignments are the same for the 328 and the 168. have you tried it on pin 8?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi again, i think you mean pin 8 at the top board, i haven´t tried yet...i ment IC pin 8(atmega), so i understand now,...i´ve loaded the code and i could visualize the data stream on the arduino serial monitor.
One more dumb question, what are the pin´s used for the outputs ?  smiley

  regards
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are using Arduino (and most compatibles) ,  digital pin 8 is clearly marked on the board.
http://arduino.cc/en/Main/ArduinoBoardDuemilanove

If you have built your own board, the pin assignments can be found here: http://www.arduino.cc/en/Hacking/PinMapping168
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks again mem . smiley-wink

 gmv
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have the ServoDecode_pde sketch working with my chepo VEX transmitter.  When I attach my scope probe to the ppm pin to view the pulses while it's going to the arduino it switches to Failsafe mode the moment I touch the pin.

Any ideas what would cause this?  The scopes input impedance is 1M ohm.  Not sure why this would effect anything.  I can see the pulses fine on the scope but the arduino goes immediately into failsafe.

Edit:
I just noticed that if I touch the pull-up resistor with my finger it also goes into failsafe mode....  I'm confused!
« Last Edit: March 23, 2009, 09:41:00 pm by ubuntucat » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Also when I have the sticks centered the values displayed are ~1500.  The pulses when viewed on the scope are ~1ms so I would have expected the values to be around 1000 instead of 1500.  (or is it 2 ticks per us so then it would be 2000)
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Most transmitters send 1.5ms pulses with the stick centered. When was the last time you had your scope calibrated?  smiley-wink

How are you connecting the signal to arduino – are you sure you need pull-ups?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks for the reply the details of the ppm signal from the vex are listed here http://www.allelectronics.com/mas_assets/spec/JS-6.pdf  As you can see the total range for the pulses is 0.5ms - 1.5ms and 1ms is the center position.  

And yes you do need a pull up in order to see the pulses.
« Last Edit: March 24, 2009, 08:38:29 am by ubuntucat » Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You would need to change MIN_IN_PULSE_WIDTH and MAX_IN_PULSE_WIDTH constants to lower values to work with the vex. It looks like the space betwen pulses is the same as  valid pulse width so some of the error checking wont work.

Does the vex support 12 channels?

I don't have a vex so may not be much help if you run into problems. I suggest you keep things simple at first and try to get it working with 6 channels.
« Last Edit: March 24, 2009, 08:55:17 am by mem » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks mem will try that when I get home....I forgot about the min pulse widths....  The vex only supports 6 channels (4 analog, 2 digital)

Also it is the low portion of the pulse that changes not the high the high pulses are always 500us.  Is this different than most transmitters?
Logged

Pages: 1 [2] 3 4 ... 12   Go Up
Jump to: