Arduino Wireless Laser Turret

27,375

168

26

Introduction: Arduino Wireless Laser Turret

Very easy to build arduino wireless laser turret, also very cheap components you can buy on ebay for example.

Step 1:

To make this project I used 2.4GHz RF transceiver modules that is built in the nRF24L01+ IC.

nRF24L01+ are extremely cheap and cost a few dollars for one piece.

List of components you need to buil this awesome project:


Arduino UNO (only as programmer)
Arduino Pro MINI ---------------2pcs
Breadboard 830 Tie-points
Breadboard 170 Tie-points
Laser module
Servo 9g -------2pcs
nRF24L01+ module ------ 2pcs
Joystick module
Cellphone Li-ion battery 3.7V -----2pcs
male-to-male cables, male-to-female cables,female-to-female cables
cable tie
fix wire

Step 2:

How to upload sketches on Arduino Pro MINI.

  1. Remove Atmega328 from Arduino UNO
  2. Using male-to-female cables connect Pro MINI to UNO RX-RX; TX-TX; RST-RST; GND-GND; VCC-+5V
  3. Change in Tools-Board-Arduino Pro or Pro MINI
  4. Upload sketch

Step 3: Receiver Sketch

#include <Servo.h>
#include <SPI.h>
#include "RF24.h"Servo servo1;
Servo servo2;
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL; 
int msg[1]; 
int data; 
int pos;
voidsetup()
{
servo1.attach(3); 
servo2.attach(7);
radio.begin();
radio.openReadingPipe(1,pipe); 
radio.startListening();
}
voidloop()
{
if (radio.available())radio.read(msg, 1);
if (msg[0] <128 && msg[0] >-1)data = msg[0], pos = map(data, 0, 127, 7, 177),servo1.write(pos);
if (msg[0] >127 && msg[0] <255)data = msg[0], pos = map(data, 128, 254, 9, 177),servo2.write(pos);
}


Step 4: Transmitter Sketch

#include <SPI.h>
#include "RF24.h" 
RF24 radio(9,10);
const uint64_t pipe = 0xE8E8F0F0E1LL; 
int msg[1]; 
int potpin_1 = A0; 
int val_1; 
int potpin_2 = A1; 
int val_2; 
voidsetup(void){
radio.begin();
radio.openWritingPipe(pipe); 
}
voidloop() {
val_1 = analogRead(potpin_1),val_1 = map(val_1, 0, 1023, 0, 127),msg[0] = val_1,radio.write(msg, 1);
val_2 = analogRead(potpin_2),val_2 = map(val_2, 0, 1023, 128, 255),msg[0] = val_2,radio.write(msg, 1);
}

Step 5:

Fix laser module and servo components by wire like it shown on pictures.

Step 6: Transmitter Scheme.

Transmitter scheme.

Step 7: Recivier Scheme

Receiver scheme

Step 8: Final Result

http://youtu.be/Nt5nIwc3mYA


https://github.com/maniacbug/RF24      -------- RF24 library

Full Spectrum Laser Contest

Participated in the
Full Spectrum Laser Contest

123D Circuits Contest

Participated in the
123D Circuits Contest

Be the First to Share

    Recommendations

    • The 1000th Contest

      The 1000th Contest
    • Battery Powered Contest

      Battery Powered Contest
    • Hand Tools Only Challenge

      Hand Tools Only Challenge

    26 Discussions

    0
    Lucasd116
    Lucasd116

    3 years ago

    how to control 4 servos with 4 potenciometer with this module?

    i'm making a radio plane and i only can control two servos, i need 3 servos and a ESC. someone can help me with a code?

    0
    MateusR20
    MateusR20

    Reply 2 years ago

    amigo estou fazendo o código do aviao e terminando ele. se ficar bem profissional lhe contato

    0
    amulder1
    amulder1

    6 years ago

    This could get a cat insane!!!

    0
    Manolov4
    Manolov4

    Reply 3 years ago

    Imagine an autonomous version of this, working for your cats while you are at work. And then you walk in and see your cat walking on the ceiling... :-P

    0
    GianL
    GianL

    3 years ago

    Hi, great job! I wish to ask you if it is possible to let the servos to keep the position reached until the joystick is moved again as when it is released, the sevos back in the initial position.

    Thank you for any help you can give me

    0
    remaa
    remaa

    4 years ago

    hi sir, i have to control the robot car project. Where the rear wheels in the form of a dc motor is controlled with flex sensors and front wheels in the form of a servo motor controlled by the accelerometer sensor. Robot controller with a car connected with nrf24l01. if one of the sensors to control I can. but if it combines both to control I can not. Both sensors transmit data simultaneously . dc motors and servo motors confused receive data so that its movement is chaotic. How should I fix this? can you help me.? Can I send my program to you and you see.? Please. My email: rema_adhe@yahoo.com

    0
    giantpair
    giantpair

    4 years ago

    I'm using UNOs instead of Pro Minis. Does that mean I use Vin instead of Vcc? I'm not getting so much as a twitch out of the servos. Help! All my recent project attempts are f'ing failures.

    0
    JaviL2
    JaviL2

    4 years ago

    why would you want to?

    0
    giantpair
    giantpair

    Reply 4 years ago

    Because I don't have one for the time being

    0
    SIM-Tech
    SIM-Tech

    4 years ago

    why are you using only one element of the array ? in msg[1] arent this implying that theres 2 elements 0 & 1 ? ,....why ?

    here your only using msg[0] and not msg[1];

    if (msg[0] <128 && msg[0] >-1)

    data = msg[0];

    pos = map(data, 0, 127, 7, 177)

    servo1.write(pos);

    if (msg[0] >127 && msg[0] <255)

    data = msg[0];

    pos = map(data, 128, 254, 9, 177);

    servo2.write(pos);

    0
    giantpair
    giantpair

    5 years ago on Introduction

    I'm going to go ahead and order stuff to make this. How could I make it autonomous? How would it go sitting on or hanging off a quadcopter?

    0
    GianL
    GianL

    5 years ago on Introduction

    Hi, i love this project!! I wonder how to let the turret reach the initial position (x=90 Y=90) when the joystick button is pushed.

    Thank you for your help

    0
    ihart
    ihart

    6 years ago on Introduction

    What an awesome project!

    Re: voltages, He is not using the regulator (RAW input) but connecting directly to the Vcc pins.

    it looks like both the arduino pro mini 3.3V and 5V Atmega 168 microcontroller chips can handle up to 5.5V Vcc. so he is fine here.

    http://www.atmel.com/devices/atmega168.aspx

    0
    SIM-Tech
    SIM-Tech

    Reply 5 years ago on Introduction

    simple setup for a triac and this can very easly be put to use one the wall OR just cut the end of any USB wall charger 500mA @ 5v

    0
    hasansuleman1

    Hi, i need to control 4 servos for my project. is it possible to send more than an integer of information at once? or do i need to divide 255 by 4 to for each servo?

    nice project...
    i think you can send char array with two 8bit integers,

    that way it is so easy to understand and less codding...

    0
    SIM-Tech
    SIM-Tech

    Reply 5 years ago on Introduction

    trust this is already small coding i been working on this code since Jan and while my setup has one componenet diff from this one it is still the same, i actually like this guy style of code

    0
    akinich
    akinich

    6 years ago on Introduction

    Hi again

    Can i get some help with the radio modules?