Need help with a RC Servo signal project - Page 1
Forum section: electronics / projects

author: dexters_lab
author_rank: Unknown
timestamp: February 18, 2013, 08:58:28 pm
content: i need some help, i have a little project i need to complete for myself, in fact it's for my HPI Baja (a 1/5 scale gas buggy), unfortunatly i know i'll never get it finished without some help! I dont mind making a donation to someone, charity etc or maybe i could find something for Dave to take apart!So the project, this should be pretty simple, basically my killswitch isn't compatible with my oddball radio, i have already done some legwork to figure out what i need to make it work.We're working with the RC servo signal from my RC receiver, i need to adjust the output of one of my receiver channels, the aux channel is controlled with a on/off switch from the transmitter so it's output is either 1 , 2 (when the switch is on or off) or 1.5 ms (during signal loss), i want to change this so it if the output is 1.5ms it's changed to 1ms to activate the killswitch under radio signal loss situations.So this little widget will sit between my receiver and my killswitch.power supply is my receiver battery, a 5 cell nimh so will need to operate between about 4.5 and 7v.signal from the receiver is 3.3v, 20ms pulse cycle (just like all other RC receivers) with the pulse working between approx 1 and 2ms.i'll document and provide the design free to anyone else in the rc community in case anyone else needs it

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 18, 2013, 11:37:29 pm
content: I don't know a lot about R/C stuff but it sounds like your requirements are pretty simple.If I understand what you are saying the signal is 3.3V and the system voltage is a maximum of 7V. If so then the circuit (one possible circuit, anyway) would be nothing more than a MCU (just 8 or 14 pins), a 3.3V voltage regulator, a crystal and some passives.The MCU would then just sample the signal and detect when it is in the neutral position (1.5ms pulse width) and output a minimum pulse width in that case (1.0ms.) The circuit would just repeat the signal unchanged when it is outside of the neutral position.Does this sound right?Do you have MCU development experience and a MCU programmer?

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 19, 2013, 04:44:45 am
content: Here's a possible solution using 4 discrete logic ICs and some passives.The idea is to generate a short delayed pulse triggered by each positive going edge of the input signal. The pulse is centered at 1.5ms and just a couple hundred microseconds wide. If the input signal's negative-going edge is continuously seen when this pulse is high then, after a delay, the output is switched to a pulse whose width is 1.0ms and has its positive-going edge synchronized with the input signal's positive-going edge.

author: dexters_lab
author_rank: Unknown
timestamp: February 19, 2013, 08:22:02 am
content: Thanks terminaljack505I do have some experience with PIC 16 & 18s, see here:http://www.mr2.net/article_charge_temp_monitor.htmlThis might give the impression i know what i'm doing but hardware wise that project is very simple, its just a bunch of spi and i2c, i am far better at software.When it comes to discrete circuits i'm clueless, so yes if i can plug my rc receiver directly to a pic then i should be ok, if i can remember everything! But if i need to build any interface circuit i will be stumped. Its been 5 years since i did the project above and done nothing since.Incidentally the killswitch will also activate when there is no pulse at all. If its simpler, then if the input pulse is anything other than about 2ms then you could drop the output signal completely.

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 19, 2013, 09:44:10 am
content: I don't deal with PICs myself. There seem to be a ton of PIC guys that hang out here. I bet one of them will chime-in.All you would need is an 8-bit MCU. Are you able to program 8-bit PICs?

author: dexters_lab
author_rank: Unknown
timestamp: February 19, 2013, 09:50:52 am
content: Yea can do most pic16 and pic18I am going to start playing with a pic tonight as i have a few bits and bobs here i can work with, you never know i might remember some of it

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 19, 2013, 09:58:18 am
content: Ah, okay. pic16s and pic18s have 8-bit cores. That goes to show how much I know about them.I heard they don't have stacks so they're a pain in the ass to write C code so I never bothered with them.

author: Baliszoft
author_rank: Frequent Contributor
timestamp: February 19, 2013, 10:34:16 am
content: Well, this is a nice project to start with (pics or any micro), but these devices are readily available or built into receivers as "fail-safe".

author: muvideo
author_rank: Frequent Contributor
timestamp: February 19, 2013, 11:09:43 am
content: Hello, as Baliszoft told you, please consider fail-safe mechanism of yourRC system. In my past experience usually if the receiver has no failsafeit's output could be anything: none, erratical or last received.If it has failsafe you can program it's output state during signal loss tobe any value you like.As a side note, if you like to play with RC stuff and learn electronics,I remember you that there are "new" telemetric systems that can beretrofitted to existing transmitters. These systems have two directionalcommunication, with open standard and you can have feedback channeluseful for all sort of things from signal strenght to battery/fuel levels etcFabio.

author: dexters_lab
author_rank: Unknown
timestamp: February 19, 2013, 01:21:24 pm
content: Yea, i have checked this, my radio has a failsafe mode built in which i have been using since i had it, under signal loss it sets the throttle and steering servos to a value i preset. But this is simply making the servos move to a safe position and only works on channels 1&2.The killswitch is designed to kill the ignition to the engine (2 stroke petrol engine, not nitro) under signal loss, normally this plugs into the 3rd channel, most other radio systems will drop the servo signal completely or set the pulse to 1ms or less, this is what my killswitch is looking for. But my radio will only set the 3rd channel to 1.5ms pulse under radio loss so never triggers the killswitch to kill the engine.I guess i could ditch this radio system and use another brand which i know is compatible or design my own killswitch but i dont really want to spend the £300+ GBP on a new radio or loose the other features of the killswitch i have.This is why i need the adaptor circuit, my local club... Must have an engine killswitch and failsafe to run.

author: muvideo
author_rank: Frequent Contributor
timestamp: February 19, 2013, 02:31:58 pm
content: Well, I was not suggesting to change your radio system, and thinkingabout two way radios I dont know if they are useful for cars, since theyare 2.4GHz.Back to topic, I can suggest two possible ways, the first isto substract 500uS from your pulse, so you will have 0.5mSwith switch in position 1, 1.5mS in position 2 and 1mS duringa signal loss. This can be done probably with one 555 and fewexternal passives, the rising edge triggers the timer, after 500uS the timer generates a pulse, the timer is reset by the fallingedge of your pulse. I confess I've still not tought how to build itin the details.The second way is to use a 6pin mcu, since you know the picmicrocontrollers, you could use a device like a PIC12F2xx,measure the input pulse width and generate the output pulseat your will. It has even an internal timer, but the timingsyou require can be generated by a simple loop, at 4MHzprobably you could achieve easily less than 50uS resolutionon both input measurement and output pulse generation.You will build 3 blocks of code:- measure the input, simply test a pin status and increment a counter,- generate a pulse: the inverse of the previous point, increment a counterand hold a pin high until the counter is less than your setpoint.- logic: something like "if input width < setpoint then output=1mS"or something similar.It should be simple enough and fun to do. An oscilloscope couldbe useful, but not needed, a led on some spare pin canbe used as aid to debug the thing.Fabio.

author: dexters_lab
author_rank: Unknown
timestamp: February 19, 2013, 03:28:38 pm
content: my radio is a 2.4g digital system, one-way, i know spektrum do some telemetry systems but they are not highly regarded in the 5th scale sceneAnywayI had a look through my parts last night and found a suitable pic so will try hacking it all together directly tonight, with good luck it will work and will just be a software issue for me, otherwise i might need some more help

author: muvideo
author_rank: Frequent Contributor
timestamp: February 19, 2013, 05:59:15 pm
content: Quote from: dexters_lab on February 19, 2013, 03:28:38 pm(OT...)Sorry, I didnt know if the 2.4GHz was used by cars also.By the way I'm happuly using frsky telemetry and works likaa charm, solid signal and very fast rebind.Quote from: dexters_lab on February 19, 2013, 03:28:38 pmLet us know the result

author: dexters_lab
author_rank: Unknown
timestamp: February 20, 2013, 12:50:10 am
content: well that went well!Here's me looking likeand then if i just sit down and stop worring about if i can do something i should just get on and do it.Basically, project completeWill probably deadbug it onto the back of the killswitchUsed a PIC16F648 i had in my parts box, bit of tinkering with mikroBasic using interrupts and it's all working:thanks for the help guys!

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 20, 2013, 04:01:33 am
content: Good deal. I was pretty sure you wouldn't have too much trouble with a project like this since you built that temperature monitor project.

author: MrsR
author_rank: Regular Contributor
timestamp: February 20, 2013, 03:31:09 pm
content: It would be easier and cheaper to get an Opto kill switch, cheap ones from DL ENGINES work well.Rachael

author: dexters_lab
author_rank: Unknown
timestamp: February 20, 2013, 04:47:12 pm
content: Thanks for the tip, but I wanted the killerrc product as there are loads of extras coming soon for it including temperature monitoring. My adaptor has cost nothing so far apart from a few hours tinkering

author: TerminalJack505
author_rank: Super Contributor
timestamp: February 21, 2013, 08:25:11 am
content: Personally I'm glad you went the DIYer route. You can take pride in something that you made yourself.The only problem now is what to do with all of those unused MCU pins! My suggestion is a KITT knight rider LED chaser.Not that it matters but I took it as a challenge to myself to design a (discrete logic) circuit for your second set of requirements.QuoteThose requirements are actually harder to meet due to the possibility that there may be no 50Hz input signal. The earlier circuit works based on the assumption that there will be a 50Hz input signal.I've attached the schematic for those that might want to study it.

author: dexters_lab
author_rank: Unknown
timestamp: February 21, 2013, 11:04:46 am
content: Thanks TJ505!You know i wish when i was younger i'd studied electronics, i might have been able to understand it! It just looks like voodooIt was only a few years ago when i realised how easy it was to plug and play with microcontrollers and peripherals using i2c and spi that i started to do something. But meant i missed out on all the discrete knowledge i should have had!Yes, i wonder if i should use those spare pins for something else, my 3.3v regulator is rated at 100ma so i could probably get some leds working off it.