Forums

Hardware question: Interfacing a servo PPM to a 3.3v micro...

Started by frenchy March 17, 2008
Hello,
I am bringing an RC servo signal into the input capture module of the
PIC24FJ64GA002.  The RC receiver outputs a voltage pulse that has an
amplitude which approximately tracks the battery level of the
receiver.  Therefore the servo pulse-high  voltage can be up to 8volts
and can sag down to 4 volts or so.  Which of these options is the best
design practice?...
1) Put a 10k in series and hook the servo pulse up directly to the
input capture pin.  Any injected current will be very small (<0.5mA).
2) A resistor divider seems like a bad idea because as the battery
voltage sags, the input to the input capture will not be in a reliable
range because it will sag to.
3) Use an NPN transistor with the emitter tied to GND.  The 4-7v
pulses will go to the base through a ???ohm resistor and the collecter
will go through a ???ohm resistor to the +3.3v rail.  The collector is
now input into the input capture.  This will invert the signal, but it
will also force it to be nicely in the 0 to 3.3v digital range.

Being that this is my first PIC24F project AND my first dealings with
Radio Controlled hobby applications, I am dealing with the system as
it is.  My friend's system that I am working with uses the motor
batteries through the motor controllers (Traxxas XL-1) to "backfeed"
power to the receiver (Futaba FP-R7H).  The receiver therefore does
not have its own independent power, it runs off the motor batteries
(PowerMax 2400mAH Peak Racing Pack) and varies from approx 7v to 4v as
they discharge.  Should I actually prefer to run the receiver off from
its own power and use the resistor divider scheme?  I was thinking
that the inverting transistor scheme (#3 above) would be more
versatile because it provides a digital signal that is always between
3.3v and GND, no matter which battery and no matter how discharged.

Thanks for any input.
respectfully,
frenchy
On Mar 17, 9:37 am, frenchy <d...@houseofharmonystudios.com> wrote:
> Hello, > I am bringing an RC servo signal into the input capture module of the > PIC24FJ64GA002. The RC receiver outputs a voltage pulse that has an > amplitude which approximately tracks the battery level of the > receiver. Therefore the servo pulse-high voltage can be up to 8volts > and can sag down to 4 volts or so. Which of these options is the best > design practice?... > 1) Put a 10k in series and hook the servo pulse up directly to the > input capture pin. Any injected current will be very small (<0.5mA).
I wouldn't. It is possible to do things like this but I dislike deliberately using the protective diode as part of the normal signal conditioning. You have to watch for exceeding the pins latchup specifications.
> 2) A resistor divider seems like a bad idea because as the battery > voltage sags, the input to the input capture will not be in a reliable > range because it will sag to.
That might work but you would need to carefully consider the threshold levels and any possible high voltage noise spikes on the line.
> 3) Use an NPN transistor with the emitter tied to GND. The 4-7v > pulses will go to the base through a ???ohm resistor and the collecter > will go through a ???ohm resistor to the +3.3v rail. The collector is > now input into the input capture. This will invert the signal, but it > will also force it to be nicely in the 0 to 3.3v digital range.
Other possibilities are - small signal MOSFET such as a 2n7000. Same basic hookup as the NPN - a simple comparator. This has the advantage of easily set up hysteresis and threshold levels. It is physically larger though. If I had the space I'd use the comparator for the flexibility it offers, otherwise I'd use a SS FET. But an NPN should work too. Robert
frenchy wrote:
> Hello, > I am bringing an RC servo signal into the input capture module of the > PIC24FJ64GA002. The RC receiver outputs a voltage pulse that has an > amplitude which approximately tracks the battery level of the > receiver. Therefore the servo pulse-high voltage can be up to 8volts > and can sag down to 4 volts or so. Which of these options is the best > design practice?... > 1) Put a 10k in series and hook the servo pulse up directly to the > input capture pin. Any injected current will be very small (<0.5mA). > 2) A resistor divider seems like a bad idea because as the battery > voltage sags, the input to the input capture will not be in a reliable > range because it will sag to. > 3) Use an NPN transistor with the emitter tied to GND. The 4-7v > pulses will go to the base through a ???ohm resistor and the collecter > will go through a ???ohm resistor to the +3.3v rail. The collector is > now input into the input capture. This will invert the signal, but it > will also force it to be nicely in the 0 to 3.3v digital range. > > Being that this is my first PIC24F project AND my first dealings with > Radio Controlled hobby applications, I am dealing with the system as > it is. My friend's system that I am working with uses the motor > batteries through the motor controllers (Traxxas XL-1) to "backfeed" > power to the receiver (Futaba FP-R7H). The receiver therefore does > not have its own independent power, it runs off the motor batteries > (PowerMax 2400mAH Peak Racing Pack) and varies from approx 7v to 4v as > they discharge. Should I actually prefer to run the receiver off from > its own power and use the resistor divider scheme? I was thinking > that the inverting transistor scheme (#3 above) would be more > versatile because it provides a digital signal that is always between > 3.3v and GND, no matter which battery and no matter how discharged. > > Thanks for any input. > respectfully, > frenchy
Please check Wikipedia for the definition of "crossposting", and compare it to multiple posting. Cross posting should be done with care, multiple posting not at all. So please stop multiple posting! -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html
On Mar 17, 12:08 pm, Tim Wescott <t...@seemywebsite.com> wrote:
> frenchy wrote: > > Hello, > > I am bringing an RC servo signal into the input capture module of the > > PIC24FJ64GA002. The RC receiver outputs a voltage pulse that has an > > amplitude which approximately tracks the battery level of the > > receiver. Therefore the servo pulse-high voltage can be up to 8volts > > and can sag down to 4 volts or so. Which of these options is the best > > design practice?... > > 1) Put a 10k in series and hook the servo pulse up directly to the > > input capture pin. Any injected current will be very small (<0.5mA). > > 2) A resistor divider seems like a bad idea because as the battery > > voltage sags, the input to the input capture will not be in a reliable > > range because it will sag to. > > 3) Use an NPN transistor with the emitter tied to GND. The 4-7v > > pulses will go to the base through a ???ohm resistor and the collecter > > will go through a ???ohm resistor to the +3.3v rail. The collector is > > now input into the input capture. This will invert the signal, but it > > will also force it to be nicely in the 0 to 3.3v digital range. > > > Being that this is my first PIC24F project AND my first dealings with > > Radio Controlled hobby applications, I am dealing with the system as > > it is. My friend's system that I am working with uses the motor > > batteries through the motor controllers (Traxxas XL-1) to "backfeed" > > power to the receiver (Futaba FP-R7H). The receiver therefore does > > not have its own independent power, it runs off the motor batteries > > (PowerMax 2400mAH Peak Racing Pack) and varies from approx 7v to 4v as > > they discharge. Should I actually prefer to run the receiver off from > > its own power and use the resistor divider scheme? I was thinking > > that the inverting transistor scheme (#3 above) would be more > > versatile because it provides a digital signal that is always between > > 3.3v and GND, no matter which battery and no matter how discharged. > > > Thanks for any input. > > respectfully, > > frenchy > > Please check Wikipedia for the definition of "crossposting", and compare > it to multiple posting. > > Cross posting should be done with care, multiple posting not at all. > > So please stop multiple posting! > > -- > > Tim Wescott > Wescott Design Serviceshttp://www.wescottdesign.com > > Do you need to implement control loops in software? > "Applied Control Theory for Embedded Systems" gives you just what it says. > See details athttp://www.wescottdesign.com/actfes/actfes.html
So in this case for comp.arch.embedded and sci.electronics.design (with presumably different attendees) you are saying I should have crossposted? I apologize, I didnt realize double posting was taboo. I viewed it like putting a for sale sign up at the laundromat and another at the pool hall....with twice as much helpful responses. I actually thought that crossposting was more taboo, because then it is more obvious that you are blanketing the area. I sincerely apologize. frenchy
On Mar 17, 11:20 am, Robert Adsett <s...@aeolusdevelopment.com> wrote:
> On Mar 17, 9:37 am, frenchy <d...@houseofharmonystudios.com> wrote: > > > Hello, > > I am bringing an RC servo signal into the input capture module of the > > PIC24FJ64GA002. The RC receiver outputs a voltage pulse that has an > > amplitude which approximately tracks the battery level of the > > receiver. Therefore the servo pulse-high voltage can be up to 8volts > > and can sag down to 4 volts or so. Which of these options is the best > > design practice?... > > 1) Put a 10k in series and hook the servo pulse up directly to the > > input capture pin. Any injected current will be very small (<0.5mA). > > I wouldn't. It is possible to do things like this but I dislike > deliberately > using the protective diode as part of the normal signal > conditioning. > You have to watch for exceeding the pins latchup specifications. > > > 2) A resistor divider seems like a bad idea because as the battery > > voltage sags, the input to the input capture will not be in a reliable > > range because it will sag to. > > That might work but you would need to carefully consider the > threshold > levels and any possible high voltage noise spikes on the line. > > > 3) Use an NPN transistor with the emitter tied to GND. The 4-7v > > pulses will go to the base through a ???ohm resistor and the collecter > > will go through a ???ohm resistor to the +3.3v rail. The collector is > > now input into the input capture. This will invert the signal, but it > > will also force it to be nicely in the 0 to 3.3v digital range. > > Other possibilities are > - small signal MOSFET such as a 2n7000. Same basic hookup as the > NPN > - a simple comparator. This has the advantage of easily set up > hysteresis and threshold levels. > It is physically larger though. > > If I had the space I'd use the comparator for the flexibility it > offers, otherwise I'd use a SS FET. But an NPN should work too. > > Robert
Robert, Well, since I have some ZTX449 transistors laying around I decided to go that way (overkill I know, but I can prototype now and build tonight!!). If I had more time for ordering parts, what would be the advantage of the mosfet solution? I presume that if I could spare the room that an open-collector comparator solution with hysteresis would be the best because it inherently eliminates noise and cleans things up...but it costs more. Which of the 3 would be the best as far as saving on the precious battery power? thx, frenchy
On Mar 17, 12:08 pm, Tim Wescott <t...@seemywebsite.com> wrote:
> frenchy wrote: > > Hello, > > I am bringing an RC servo signal into the input capture module of the > > PIC24FJ64GA002. The RC receiver outputs a voltage pulse that has an > > amplitude which approximately tracks the battery level of the > > receiver. Therefore the servo pulse-high voltage can be up to 8volts > > and can sag down to 4 volts or so. Which of these options is the best > > design practice?... > > 1) Put a 10k in series and hook the servo pulse up directly to the > > input capture pin. Any injected current will be very small (<0.5mA). > > 2) A resistor divider seems like a bad idea because as the battery > > voltage sags, the input to the input capture will not be in a reliable > > range because it will sag to. > > 3) Use an NPN transistor with the emitter tied to GND. The 4-7v > > pulses will go to the base through a ???ohm resistor and the collecter > > will go through a ???ohm resistor to the +3.3v rail. The collector is > > now input into the input capture. This will invert the signal, but it > > will also force it to be nicely in the 0 to 3.3v digital range. > > > Being that this is my first PIC24F project AND my first dealings with > > Radio Controlled hobby applications, I am dealing with the system as > > it is. My friend's system that I am working with uses the motor > > batteries through the motor controllers (Traxxas XL-1) to "backfeed" > > power to the receiver (Futaba FP-R7H). The receiver therefore does > > not have its own independent power, it runs off the motor batteries > > (PowerMax 2400mAH Peak Racing Pack) and varies from approx 7v to 4v as > > they discharge. Should I actually prefer to run the receiver off from > > its own power and use the resistor divider scheme? I was thinking > > that the inverting transistor scheme (#3 above) would be more > > versatile because it provides a digital signal that is always between > > 3.3v and GND, no matter which battery and no matter how discharged. > > > Thanks for any input. > > respectfully, > > frenchy > > Please check Wikipedia for the definition of "crossposting", and compare > it to multiple posting. > > Cross posting should be done with care, multiple posting not at all. > > So please stop multiple posting! > > -- > > Tim Wescott > Wescott Design Serviceshttp://www.wescottdesign.com > > Do you need to implement control loops in software? > "Applied Control Theory for Embedded Systems" gives you just what it says. > See details athttp://www.wescottdesign.com/actfes/actfes.html
I just researched it and found that I will never multi-post again!! "Multi-posting is a waste of bandwidth, money, and people's time, with no advantages whatever, and should never be indulged in." sorry, frenchy
On Mar 17, 2:35 pm, frenchy <d...@houseofharmonystudios.com> wrote:
> On Mar 17, 11:20 am, Robert Adsett <s...@aeolusdevelopment.com> wrote: > > > On Mar 17, 9:37 am, frenchy <d...@houseofharmonystudios.com> wrote: > > > > Hello, > > > I am bringing an RC servo signal into the input capture module of the > > > PIC24FJ64GA002. The RC receiver outputs a voltage pulse that has an > > > amplitude which approximately tracks the battery level of the > > > receiver. Therefore the servo pulse-high voltage can be up to 8volts > > > and can sag down to 4 volts or so. Which of these options is the best > > > design practice?... > > > 1) Put a 10k in series and hook the servo pulse up directly to the > > > input capture pin. Any injected current will be very small (<0.5mA). > > > I wouldn't. It is possible to do things like this but I dislike > > deliberately > > using the protective diode as part of the normal signal > > conditioning. > > You have to watch for exceeding the pins latchup specifications. > > > > 2) A resistor divider seems like a bad idea because as the battery > > > voltage sags, the input to the input capture will not be in a reliable > > > range because it will sag to. > > > That might work but you would need to carefully consider the > > threshold > > levels and any possible high voltage noise spikes on the line. > > > > 3) Use an NPN transistor with the emitter tied to GND. The 4-7v > > > pulses will go to the base through a ???ohm resistor and the collecter > > > will go through a ???ohm resistor to the +3.3v rail. The collector is > > > now input into the input capture. This will invert the signal, but it > > > will also force it to be nicely in the 0 to 3.3v digital range. > > > Other possibilities are > > - small signal MOSFET such as a 2n7000. Same basic hookup as the > > NPN > > - a simple comparator. This has the advantage of easily set up > > hysteresis and threshold levels. > > It is physically larger though. > > > If I had the space I'd use the comparator for the flexibility it > > offers, otherwise I'd use a SS FET. But an NPN should work too. > > > Robert > > Robert, > Well, since I have some ZTX449 transistors laying around I decided to > go that way (overkill I know, but I can prototype now and build > tonight!!).
An important consideration.
> If I had more time for ordering parts, what would be the > advantage of the mosfet solution?
For me there's a rather vague unjustifiable feeling of rightness :) Plus I keep ss FETs as a standard part. There's really not a lot to choose between the two. The transistor has a forward drop, the FET has a resistive drop when on. The FET should be able to pull the voltage lower for low currents than a transistor. The FET is a capacitive rather than a current input so it has a higher impedance and less drive current needed to keep it on, probably not very important compared to the pull-up resistor. The FET turn on characteristics have more of a jump to them than the transistor.
> I presume that if I could spare the > room that an open-collector comparator solution with hysteresis would > be the best because it inherently eliminates noise and cleans things > up...but it costs more.
That's basically the argument. It's not that you cannot do much of that with discretes, it's just quicker and easier with a comparator. Although a quad comparator can be had for about $0.25 IIRC so the cost difference is not huge, especially for small quantities.
> Which of the 3 would be the best as far as saving on the precious > battery power?
Well, The transistor and FET have a pull-up draining power during turnon. The transistor has a continuous drain during turn on (probably small compared to the pull-up) The FET needs its gate charged (probably small compared to the pull- up) The comparator needs some power to run. An OC comparator needs a pull-up just as the transitor and FET do A push -pull type comparator can eliminate the pull-up How much time do you want to spend optimizing it? ;) Does it save a few seconds runtime over an hour, or 10's of seconds over a minute? Robert
frenchy wrote:
>
... snip ...
> > So in this case for comp.arch.embedded and sci.electronics.design > (with presumably different attendees) you are saying I should have > crossposted? I apologize, I didnt realize double posting was taboo. > I viewed it like putting a for sale sign up at the laundromat and > another at the pool hall....with twice as much helpful responses. > I actually thought that crossposting was more taboo, because then it > is more obvious that you are blanketing the area.
You also forgot to snip your quotation. Cross-posting (limited) is handy, because the better newsreader will mark the cross-posted copies, in other newsgroups, as answered when you read the first copy. Also, only one copy is sent. You should also set follow-ups to cohere the results back to a single news-group. -- [mail]: Chuck F (cbfalconer at maineline dot net) [page]: <http://cbfalconer.home.att.net> Try the download section. -- Posted via a free Usenet account from http://www.teranews.com
On 2008-03-17, frenchy <deja@houseofharmonystudios.com> wrote:
> Hello, > I am bringing an RC servo signal into the input capture module of the > PIC24FJ64GA002. The RC receiver outputs a voltage pulse that has an > amplitude which approximately tracks the battery level of the > receiver. Therefore the servo pulse-high voltage can be up to 8volts > and can sag down to 4 volts or so. Which of these options is the best > design practice?...
I did something similar a while back - it my case it was an elevon mixer using a PIC12. The Rx output signal were basically TTL compatible and I wired them directly to GPIO pins. Similarly the servo outputs (although it doesn't sound as if you will need them) were simply fed from GPIO pins. The only external components were for the crystal - I didn't trust the internal RC oscillator to measure the pulse widths accurately enough although I may have been able to get away with it. However, that was running from a standard four cell battery pack, delivering a nominal 4.8V. True, a freshly charged pack may briefly deliver the best part of 6.0V but it will quickly settle down to something rather less. The moment it goes below 4.0V at the other end of the discharge curve you can assume that the Rx itself will pack up - although Hitec are notable for working down to around 3.6V IIRC. That is still above what is needed to keep a PIC running. 8V sounds like a lot to run a normal receiver - are you sure it does not incorporate a BEC for use with electrically powered models? If it does then the voltage will be much more constant than you envisage here. -- Andrew Smallshaw andrews@sdf.lonestar.org