DIY Infrared combat module

by hans | July 17, 2012 | (14) Posted in Projects

This is a simple combat module using IR signals. I implemented this very similar to the parkzone sonic combat module (except for using IR instead of ultrasonic sound).

I didn't have the time (nor friends) to test it up in the air though so in case the IR part isn't working properly you might want to use ultrasonic sound isntead. Both price and implementation are very similar. Then it can even be made compatible with the sonic combat module also. => You'll need to analyze the signal from the combat module then. I would do it with pleasure but I need to pay 140 USD shipping to get this 20 USD module delivered to my door :s.

You don't need much parts. If you really want to keep the cost low you could go for a barebone arduino set up (make sure to add a crystal, don't use the internal clock since timing is crucial here).  I used the arduino pro mini because of it's size.


I linked an IR led, an IR receiver, a few status leds, a buzzer and 4x 3 pin headers for servo wires & buzzer. The buzzer and leds are optional. Everything is on the same power rail (+ and -) fed from the ESC input channel (or any other power source on the 3 pin headers) and goes to the arduino pro mini's GND and RAW pins.

The PCB pictured on top isn't very optimal in terms of layout... I'll redo that soon with a pcb the size of the pro mini and then stacked upon each other. Should allow for a smaller foot print.

This is a sketch of how everything is connected (sorry no electronic background here so no use of correct symbols):


The pins are not listed. If you get the sketch from my project website (listed below) and want to run it right away you need to connect the parts to the following pins:

// sensor pin
#define PIN_SENSOR 3
// Infrared LED on Pin
#define PIN_SENDER 2
// Trigger on Pin
#define PIN_TRIGGER 5
// Positive Lead on the Piezo
#define PIN_SPEAKER 4
// Positive Leg of the LEDs
#define PIN_LED_GREEN 13
#define PIN_LED_ORANGE 12
#define PIN_LED_RED 11
// throttle input
#define PIN_THROTTLE_IN 6
// throttle output
#define PIN_THROTTLE_OUT 7

The software is very basic for now. Main function is to retrieve the throttle input and pass it through to the throttle output if no hits were detected. If an IR signal is found then the throttle will be blocked for a predefined amount of time. 10 seconds by default though that might be too much to recover from... use at your own risk :-). 

There is no check yet on the type of IR signal. So with current code release you could shoot a passing plane with a remote control for TV if you want (might be a fun game :-)). In later iterations I will work with an IR signal with encoded data.

The code also needs optimalisation on the throttle handling. You can see in the video that it has some delay. This has several reasons:

- I have no wait time defined on reading pulses so you'll always get the default max wait time if no signal is present = delay.

- The throttle is handled in the same loop of the other logic for now. Can be moved to an interrupt if desired. Then move the throttle input to pin 8 or another interrupt pin (is it 10 or 9?). And code needs update.

- I added smoothening to fix the jitterish feedback from the servo I first had. This causes the reduced resolution of the servo movement. Not sure what the effect of this kind of non smooth signal is on an ESC?

The sketch can very easily be adapted to whatever you can think of. You can add channels or add rules to the logic. Feel free to contribute and improve this code. I'll do my best to find someone with flying skills close to me to take it all up in the air and get a video of this thing in action! 

For more details and code visit: http://redmine.hcpl.be/projects/tag-combat/wiki. If someone else gets this tested in action please let me know.

COMMENTS

hans on July 29, 2012
Some news. I had a first test flight today with nr of samples for throttle smoothening reduced to 2 (is one of the define statements in the sketch. Flew fine. The weather wasn't so good. Too much wind. So I couldn't do slow fly by's for my daughter waiting on the ground with another module to shoot me down (she sure wanted to shoot me :P).

So instead I did a range test on the ground. Without any lenses, just the bare sensor and ir led I got up to 8m range.

I'll do my best to get it up in the air soon with another plane equipped with this module. Should be fun.
Log In to reply
Nonamerc on August 1, 2012
Can you make an setup/build along video? I would love to make one of these!! Kan je het ook naar nederland versturen? Provincie groningen om precies te zijn.
Log In to reply
hans on August 2, 2012
I'll do my best to prepare a build video. Do you have experience with arduino? If so this should really be straight forward as long as you get the connections right. I should make a better electrical diagram (I'll look into that also).

The arduino pro mini is light and small so I picked that one. For first time Arduino it might be better to start with a proper Arduino UNO. These have a USB connection built in. The cheaper barebone arduino's and this arduino pro mini need an external USB connection. If you check my project website you'll find a link to a tutorial using a 4.4 USD nokia cable for this.
=> http://letsmakerobots.com/node/23728

I know a good (dutch!) shop that will deliver these parts (except for the cheap programmer). I'll PM you "in het Vlaams" about that.
Log In to reply
chipgt on October 13, 2012
I have been looking for something like this for some time. Ever since the days of the F-27A. Very cool and easy to do. Thanks
Log In to reply
Rc Mania Cyprus on October 25, 2012
Very nice!

Log In to reply
Doctor3 on July 21, 2012
very good. but im not sure if IR works too well outside ? im not sure
Log In to reply
hans on July 21, 2012
I already have some ultrasonic sound modules ordered. I'll test this IR first since I think my dogs don't like the ultrasonic that much. If IR fails dogs have to stay home and I'll adapt the code.
Log In to reply
TheRCNewbie on December 27, 2012
So I assume you are using the arduino mini? And the code is basically a lot of if statements? So if it is not receiving any IR signals, it won't do anything to the throttle's signal cable. But if there is an IR signal it will set the PPM to 0, correct? then for the attacking you just wire up a transistor going to an IR LED, with the collector soldered to the red (power) servo wire, the emitter soldered to the positive lead of the LED and the base soldered to the signal. It would have to be from an on/off switch on your tx for it to work...
Log In to reply
hans on December 27, 2012
I used a mini pro for this project. A mini would work.

The arduino handles The in coming throttle pwm signal and just forwards in normale state. On hit it will block The signal for some predefined time. You could implement more realistic actions like motor stutter or even control other signals.

The ir led is triggered by the arduino when it finds a high pwm signal on the connected channel. So no switches needed.

Check the link at the bottom of the article for all the code. You can check it out from svn and adapt to your need.
Log In to reply
TheRCNewbie on December 28, 2012
Oh, cool! Thanks for explaining it!
Log In to reply
Juandre on October 25, 2012
I like the idea very much, pretty cool.

Log In to reply

You need to log-in to comment on articles.


DIY Infrared combat module