Skip to content
Advertisements

Arduino RC LASER Tank, Self-propelled LASER Turret

 

 

           Hello, and welcome to this project, it’s a self-propelled LASER turret, RC LASER Tank… I don’t know its name yet :D. So this project is very simple, it’s a remote controlled tank chassis with a remote controlled LASER turret and you can activate the LASER remotely too.

Teaser video

So this project combines different things I did before, make sure to check on them if you’re having a problem:

Hardware:

For this project we gonna need a motorized chassis, the usual 2 WD / 4 WD robot chassis, or anything you have in hand… This one is a tank chassis with 2 tracks driven by 2 DC motors.

a1

To control the Motors we have a dual H-bridge DC motor driver, I’m using the L298n, it’s powered by a 7.4V Lithium battery through it’s +12v pin, and also this module provides power to the Arduino board and the servos thanks to its 5v output.

a4

Then we have the FPV camera cradle, it’s just that acrylic frame with two servo motors that we control.

a3_1         a3

On that I placed a LASER module

a5

PS2X wireless remote controller with its receiver

a7

All these controlled with Arduino board I’m using UNO as usual

a6

And an Arc Reactor for power

a2

 

Wiring:

wiring 2

That’s pretty much my wiring, Don’t forget the L298n has a 7.4V Li battery on it’s +12V/GND pins, which powers all the things, you can use 9v battery if you want.

For the LASER so you won’t be confused, actually the LASER needs two pins, GND and a pin that can provide 5V voltage, so here in the wiring schematic I could have wired the (-) pin with GND but I prefered to do as written in the Code, I wired the (-) pin with an Analog pin and put it to LOW level, instead of using a breadboard or some other dodgy thing (And you know I’m not very handy)… You can use what you want just it should be grounded, and the other Analog pin is now acting like a Digital Output and it sets High or LOW to activate the LASER

For the PS2 Receiver, it has 9 pins and we used (1,2,6,7) for data and (4,5) for power, the gray square are not connected.

Libraries:

The only libraries we’re using are:

  • Servo library which is already installed
  • PS2X Library: Download here

Code:

               You can download the code here in .ino format.

For some part of the code I’m gonna explain them bellow:

c1

Those lines are for the LASER, (-) pin on A0 and (S) on (A1), so we declare them as outputs and put the A0 to low constantly to act as our GND.

c2a and b, constantly reading the servos current positions and we increment or decrement (other part of code). Stop() is always active as long as no stick are moved.

Then if “X” is press, the vibrate variable takes a value, wich makes the controller vibrate, and the same value is on the A1 pin, normaly the vibrate value is analog but you know there’s a threshold for analog signals to be considered as LOW or HIGH digital Level, and so the Laser turn on everytime we press the “X” button.

c3In an other part of the code the Arduino is constantly listening for new signals, and we did some math to make the value of the left analog stick to go from 130 to 255 for up (forward).

and 120 to 0 for down (backward).

So here we adapted this signal received from 130 – 255 to 0 – 255 which is proportionnal on how you push the stick and we adapted the signal so it can be written as PWM signal on the speed pin as we know the speed is controlled by a value from 0-255.

Same thing I did for Backward, and for Left and Right I just turn off one motor to make it turn in a certain direction, for the HIGH/LOW values it depends on your system you may swap them or swap your wiring…

Advertisements

Yassine View All

Electronics, Automation engineering student... I try to share my little experience with other electronics amateur.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: