Things used in this project

Hardware components:
A000066 iso both
Arduino Arduino UNO & Genuino UNO
×2
11812 02
SparkFun SparkFun XBee Explorer USB
×2
XBee XBee Series 2 Wireless Chip
×2
UNIKEL A2212 1000KV Brushless Outrunner Motor+30A Brushless ESC for DJI F450 550
×1
FLOUREON® 11.1V 2200mAh 3S 25C Lipo RC Battery Rechargeable RC Battery with XT60 Plug
×1
09939 01
Rotary potentiometer (generic)
4.7k
×1
11026 02
Jumper wires (generic)
×1
Amazon Web Services Selfie Stick with Bluetooth Remote
×1
Needle Roller Pin Bearing
×2
5040 Drone Prop
×1
Software apps and online services:
Ide web
Arduino Arduino IDE
XBee XCTU
Hand tools and fabrication machines:
Metal Lathe
Cordless Drill
Pillar Drill
Metal Mitre Saw
Tig Welder
Waterjet Cutter

Schematics

Receiver Setup
6660741 orig yjzfv6v3ju
Transmitter Setup
7694908 orig 8s5odoha7o

Code

Receiver CodeArduino
Code from the Arduino Uno attached to the receiver chip which is on the Camera rig arm. I did not write this code.
/*   ~ Simple Arduino - xBee Receiver sketch ~

  Read an PWM value from Arduino Transmitter to fade an LED
  The receiving message starts with '<' and closes with '>' symbol.
  
  Dev: Michalis Vasilakis // Date:2/3/2016 // Info: www.ardumotive.com // Licence: CC BY-NC-SA                    */

//Constants
const int ledPin = 3; //Led to Arduino pin 3 (PWM)

//Variables
bool started= false;//True: Message is strated
bool ended  = false;//True: Message is finished 
char incomingByte ; //Variable to store the incoming byte
char msg[3];    //Message - array from 0 to 2 (3 values - PWM - e.g. 240)
byte index;     //Index of array

void setup() {
  //Start the serial communication
  Serial.begin(9600); //Baud rate must be the same as is on xBee module
  pinMode(ledPin, OUTPUT);
}

void loop() {
  
  while (Serial.available()>0){
    //Read the incoming byte
    incomingByte = Serial.read();
    //Start the message when the '<' symbol is received
    if(incomingByte == '<')
    {
     started = true;
     Serial.print("true");
     index = 0;
     msg[index] = '\0'; // Throw away any incomplete packet
   }
   //End the message when the '>' symbol is received
   else if(incomingByte == '>')
   {
     ended = true;
     break; // Done reading - exit from while loop!
   }
   //Read the message!
   else
   {
     if(index < 4) // Make sure there is room
     {
       msg[index] = incomingByte; // Add char to array
       index++;
       msg[index] = '\0'; // Add NULL to end
     }
   }
 }
 
 if(started && ended)
 {
   int value = atoi(msg);

   
   analogWrite(ledPin, value);
   Serial.println(value); //Only for debugging
   index = 0;
   msg[index] = '\0';
   started = false;
   ended = false;
 }
}
Transmitter CodeArduino
Code for the Arduino on the remote transmitting the change in position of the potentiometer.
/*   ~ Simple Arduino - xBee Transmitter sketch ~

  Read an analog value from potentiometer, then convert it to PWM and finally send it through serial port to xBee.
  The xBee serial module will send it to another xBee (resiver) and an Arduino will turn on (fade) an LED.
  The sending message starts with '<' and closes with '>' symbol. 
  
  Dev: Michalis Vasilakis // Date:2/3/2016 // Info: www.ardumotive.com // Licence: CC BY-NC-SA                    */

//Constants: 
const int potPin = A0; //Pot at Arduino A0 pin 
//Variables:
int value ; //Value from pot

void setup() {
  //Start the serial communication
  Serial.begin(9600); //Baud rate must be the same as is on xBee module
}

void loop() {
  //Read the analog value from pot and store it to "value" variable
  value = analogRead(A0);
  //Map the analog value to pwm value
  value = map (value, 0, 1023, 0, 255);
  //Send the message:
  Serial.print('<');  //Starting symbol
  Serial.print(value);//Value from 0 to 255
  Serial.println('>');//Ending symbol
}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Arduino Like Function on Kinetis K82 Freedom Stupid Board
Intermediate
  • 55
  • 4

Protip

1000 of K82 Freedom Boards are collecting dust because of the hobbyist unfriendly IDE, pump up the duds with easy Arduino-like functions.

Arduinomated Car Parking with Voice Assistance in Smartphone
Intermediate
  • 427
  • 10

Full instructions

Make an assistant which tells you about how much to drive backwards without any collision through your smartphone by Arduino and 1Sheeld.

Reducing Arduino Power Consumption
Intermediate
  • 144
  • 5

Full instructions

One the most important feature of portable electronics should be long battery life. We can reduce the current drawn by several ways.

Sigfox Forest Fire Detector
Intermediate
  • 2,784
  • 16

Full instructions

How to prevent forest from burning? A small Sigfox signal can prevent natural disasters. We will use an Arduino MKRFOX + a flame detector.

Traffic Monitor- Monitors traffic on the Go
Intermediate
  • 84
  • 2

Full instructions

The device uses color indication to display traffic on the road you are driving or you have selected.

Magic VR Hat
Intermediate
  • 706
  • 8

Wear the hat, get transported to different 360 VR experience.

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaFree StoreBlog