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

Run Google Assistant on Your Amazon Echo
Intermediate
  • 499
  • 8

Full instructions

This is an implementation of the Google Assistant API wrapped as an Alexa skill.

UK Treasure Hunt
Intermediate
  • 65
  • 4

Full instructions

Find Precious Treasures from across the United Kingdom..!

Parliament Election Support from you Alexa
Intermediate
  • 71
  • 3

Full instructions

Democracy calls! Use this Alexa skill for who is running for the UK Parliament on the snap election for the 8th of June, as well as who won.

I'm Fine for the Workplace
Intermediate
  • 565
  • 5

Full instructions

A system to let someone ask for help at school or in the workplace without having to do it publicly.

I'm Fine for the Workplace

Team National Star and EDF Energy Hackathon

Christmas Gift Box
Intermediate
  • 3,598
  • 595

Full instructions

Christmas Gift Box plays music and sends an email when it is opened.

Synonimi
Intermediate
  • 13
  • 0

Full instructions

Synonimi puts the entire thesaurus at your disposal to get the alternatives to the word that you want, to improve your vocabulary!

Add projectSign up / Login