Page 3 of 7

Re: Arduino Uno IR Battle System

Posted: Fri Mar 24, 2017 6:52 pm
by RobW
Is it a whitespace character issue? Common problem at work when people copy-paste from pdf to text and then try to compile.

Re: Arduino Uno IR Battle System

Posted: Fri Mar 24, 2017 8:16 pm
by LukeZ
I don't personally use Linux or Mac and I can't easily troubleshoot a problem that I can't replicate in my environment. Although everybody has their own preferences, I must probably mention that trying to get something like Arduino to work in a non-standard environment, if you are not already very familiar with Arduino, is probably the more difficult path to take.

But if you are using Linux then obviously you are not the typical computer novice, so I would suggest doing some Google searches to see if you can find some solutions, or maybe post in the Arduino forums. Perhaps Arduino uses different compilers for different platforms with different requirements. I would think C should compile just fine from one platform to the next, but again I am not familiar with what they've had to do to get the IDE to run in that environment.

Perhaps you could try the suggestion in this thread.

Re: Arduino Uno IR Battle System

Posted: Fri Mar 24, 2017 8:20 pm
by wibblywobbly
RobW wrote:Is it a whitespace character issue? Common problem at work when people copy-paste from pdf to text and then try to compile.
The code is in a downloaded zip file, no pdf's or txt files involved. :thumbup:

@Liuke - I'll see if I can find a solution, just out of interest which version do you use to compile the code?

Re: Arduino Uno IR Battle System

Posted: Fri Mar 24, 2017 8:39 pm
by LukeZ
I am using 1.8.1 right now, though the code has been tested back to 1.6.something-or-other previously, I believe I went back to 1.6.5.

Also, looking more closely at the screenshots you posted, the code actually compiled just fine with 1.8. Yes the IDE threw up some "warnings" but that's all they are, just warnings, not errors, so you can ignore them. In your screenshot it says "Done Compiling" so the code compiled.

For the error you got in 1.6 try changing this line:

Code: Select all

#define SERVONUM_RECOIL     0
to this:

Code: Select all

 ESC_POS_t SERVONUM_RECOIL = 0;

Re: Arduino Uno IR Battle System

Posted: Sun Mar 26, 2017 1:00 pm
by wibblywobbly
Wow, it works!

Only tested over a short distance. Hooked up the Uno via a USB for power. Plugged in the emitter and sensor boards.

phpBB [video]


Tested:
Fired via a switch.
Fired at it using my Panther with an Elmod board.

It hit the Panther.
It detected hits from the Panther.

Need to get some resistors so that I can hook the board into an RX18 IR port.
Need to get a jack plug to power the board from the tank battery.

If that works, it will all work perfectly.

Many, many thanks for your hard work Luke! :thumbup:

Re: Arduino Uno IR Battle System

Posted: Sun Mar 26, 2017 1:15 pm
by silversurfer1947
That's good news. Presumably, it gives a cheaper entry into Tamiya IR than replacing the RX18 completely. I don't suppose by some miracle it will also disable that silly tank recoil that seems to be standard with every Torro, Taigen and Heng Long tank?

Re: Arduino Uno IR Battle System

Posted: Sun Mar 26, 2017 1:29 pm
by wibblywobbly
The Arduino detects the hits, rather than the RX18, therefore the RX18 doesn't know it has been hit, hence the tank won't react at all.

The only part that the RX18 plays in the system is via the IR emitter pins. Those are activated when you fire the gun, they send a 5v pulse to the emitter.
By hooking up the Arduino to those pins the Arduino detects the 5v spike, and that simple change in voltage runs the Arduino code that fires the emitter connected to the Arduino board.
The sensor is only connected to the Arduino, when it detects an IR beam fired from a tank, it flashes the hit led's. I haven't got any hooked up yet, but you can see the onboard led flash on the Arduino board when a hit is detected.

The genius known as Luke has also enabled a servo recoil from the Arduino, which is amazing. I had this mad idea way back, I couldn't see any reason why it wouldn't work, and thanks to Luke he has proven that it does. I can't thank him enough for doing this.

The latest HL and Taigen RX18's have excellent sound files installed, in fact the HL Tiger/Leopard is copied from the Tamiya system, so converting the board to Tamiya standard IR is the only thing that is missing, and this system fills the gap.

I am off to Maplins to get a bag of resistors so that I can install the system in the Tiger 1 project tank that I have here.

Re: Arduino Uno IR Battle System

Posted: Sun Mar 26, 2017 1:48 pm
by silversurfer1947
looking forward to seeing it all working next Sunday.

Re: Arduino Uno IR Battle System

Posted: Sun Mar 26, 2017 5:16 pm
by LukeZ
Good news! Glad you've got it running. I'll be following along with your further experiments.

Re: Arduino Uno IR Battle System

Posted: Mon Mar 27, 2017 12:15 pm
by wibblywobbly
Just a quick pic to show the Uno mounted in the hull.

I have used the add on board for the emitter, as this comes with the circuit protection shown on the schematic. I desoldered the emitter and installed fly leads so that I can mount the emitter in the mantlet, but swapped it for a Maplins one as I have a bag of them.

The add on board for the sensors has not been used. I desoldered the single emitter, but they have used some kind of sandwiched solder joints onto the pcb, and it has proved impossible to solder fly leads or pins into the empty holes. I will just hook up sensors as shown in the schematic.

A jack plug has been wired into the tank switch, so that the board is powered up when the tank is switched on.

The IR works, just need to attach the wiring to the 5v IR pins via a voltage divider (just two resistors).

The sensors are not yet installed. Need to modify the cupola and glue those in.

The muzzle flash was wired into the HL IR emitter pins, however, these will now be used to trigger the Uno, so I will have to either install an HL high intensity flash or find another way to wire one in.

I'll also try adding a servo recoil when all of these tasks are completed. It all looks a lot more complicated than it really is, this is quite an easy installation.

Once all of this is completed I am going to see if I can build a small amplifier to boost the HL sound file, Maplins supply kits, and there are others on the web, if I can find one that will work I will give it a go.