mm-uav_arm_bluetooth_operation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
mm-uav_arm_bluetooth_operation [2016/08/02 04:19] – dongbinkim | mm-uav_arm_bluetooth_operation [2016/10/23 20:22] (current) – dwallace | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== MM-UAV Arm Bluetooth Operation ====== | ====== MM-UAV Arm Bluetooth Operation ====== | ||
- | <!-- Replace the above line with the name of your "How To" Tutorial e.g. How to Laser cut Your Name in Wood --> | + | **Author:** Dongbin Kim Email: < |
- | + | ||
- | <!-- Everywhere you see <some sentence>, | + | |
- | + | ||
- | **Author: | + | |
\\ | \\ | ||
- | **Date:** Last modified on <08/01/16> | + | **Date:** Last modified on 08/01/16 |
\\ | \\ | ||
- | **Keywords: | + | **Keywords: |
\\ | \\ | ||
- | |||
- | <!-- Add a representative photo of your tutorial below. | ||
{{: | {{: | ||
Line 24: | Line 18: | ||
* Know how to write down Arduino sketch, Serial communication | * Know how to write down Arduino sketch, Serial communication | ||
\\ | \\ | ||
- | * Perhaps also know how to understand | + | * Perhaps also know how to understand |
\\ | \\ | ||
* Perhaps additional background needed may include basic electrical engineering knowledge | * Perhaps additional background needed may include basic electrical engineering knowledge | ||
Line 31: | Line 25: | ||
\\ | \\ | ||
The rest of this tutorial is presented as follows: | The rest of this tutorial is presented as follows: | ||
- | * [[tutorialTemplate# | + | * [[mm-uav_arm_bluetooth_operation# |
- | * [[tutorialTemplate# | + | * [[mm-uav_arm_bluetooth_operation# |
- | * Programming <!- delete this line if not applicable -> | + | |
* Final Words | * Final Words | ||
Line 40: | Line 33: | ||
US-based vendors to obtain material to complete this tutorial include Amazon.com. | US-based vendors to obtain material to complete this tutorial include Amazon.com. | ||
\\ | \\ | ||
- | To complete this tutorial, you'll need the following items. But I omitted the items from MM-UAV arm assembly because this page is to learn how to manipulate the arm wirelessly. | + | To complete this tutorial, you'll need the following items. But I omitted the items from MM-UAV arm assembly because this page is to learn how to manipulate the arm wirelessly. |
- | + | ||
- | <!-- Alternatively create: (1) a Google XLS document that's publicly viewable and provide link; and (2) a PDF version of the Google XLS, store the PDF file in your site, and provide link to it --> | + | |
\\ | \\ | ||
Line 70: | Line 60: | ||
{{: | {{: | ||
\\ | \\ | ||
+ | Arduino Uno only supplies 6 PWM control pins(3, | ||
\\ | \\ | ||
+ | \\ | ||
+ | **Step 2. Bluetooth installation** | ||
+ | \\ | ||
+ | \\ | ||
+ | {{: | ||
+ | \\ | ||
+ | Bluetooth operation is working much, much better in Android enviorment. Please download ' | ||
+ | \\ | ||
+ | \\ | ||
+ | {{: | ||
+ | \\ | ||
+ | Click 'Set Keys' button and set up the button. 'Data of Key' stands for a data that the app will send Serial communication to Arduino. Make sure you write the same data as in Arduino sketch which is on the next section. | ||
+ | \\ | ||
+ | \\ | ||
+ | **Step 3. Arduino Sketch** | ||
+ | \\ | ||
+ | \\ | ||
+ | Please refer the **Programming** section to Sketch Arduino. If you understand Cpp language, you can easily understand the algorithms. When you are done building up Arduino Sketch, Compile the code and upload on Arduino. | ||
+ | **WARNING** - When you upload the sketch, make sure you take off the VC line(+) of battery for servos. Otherwise, you will encounter lots of operating errors. | ||
\\ | \\ | ||
\\ | \\ | ||
- | **Step | + | **Step |
\\ | \\ | ||
\\ | \\ | ||
- | < | + | {{: |
+ | \\ | ||
+ | \\ | ||
+ | To set up the bluetooth for yours, you should know how to run AT(Attention) commands. AT commands help you check if bluetooth is connected or not, and help you change name, password, baud rate. The followings are basic AT commands language. | ||
+ | When you type the word at Sent on Serial display, you must check whether you have seen the received word. | ||
+ | |||
+ | 1. Communications Test : | ||
+ | *Sent : AT | ||
+ | *receive : OK | ||
+ | |||
+ | 2. Change baud rate : | ||
+ | *Sent : AT+BAUD1 | ||
+ | *receive : OK1200 | ||
+ | |||
+ | *Sent : AT+BAUD2 | ||
+ | *receive : OK2400 | ||
+ | |||
+ | 1 : 1200 | ||
+ | |||
+ | 2 : 2400 | ||
+ | |||
+ | 3 : 4800 | ||
+ | |||
+ | 4 : 9600 | ||
+ | |||
+ | 5 : 19200 | ||
+ | |||
+ | 6 : 38400 | ||
+ | |||
+ | 7 : 57600 | ||
+ | |||
+ | 8 : 115200 | ||
+ | |||
+ | Baud rate setting can be save even power down. | ||
+ | |||
+ | 3. Change Bluetooth device name: | ||
+ | *Sent : AT+NAMEdevicename | ||
+ | *receive : OKname | ||
+ | (devicename is the name you want the device to be , and it will be searched with this name) | ||
+ | Name setting can be save even power down. | ||
+ | |||
+ | 4. Change Pincode: | ||
+ | *Sent : AT+PINxxxx | ||
+ | *receive : OKsetpin | ||
+ | (xxxx is the pin code you set) | ||
+ | Pin code can be save even power down. | ||
+ | \\ | ||
+ | \\ | ||
+ | **Step | ||
+ | \\ | ||
+ | \\ | ||
+ | {{: | ||
+ | \\ | ||
+ | Once you are done setting up through AT Commands, Connect the power to Arduino and Motors. Then, click ' | ||
+ | GOOD LUCK! | ||
+ | \\ | ||
\\ | \\ | ||
==== Programming ==== | ==== Programming ==== | ||
- | A link to the source code can be found <provide URL to your code, probably saved in this DASL Wiki>. | ||
\\ | \\ | ||
- | The goal of the code is <brief explanation> | + | The goal of the code is to manipulate MM-UAV with bluetooth. It works in the following way |
\\ | \\ | ||
---- | ---- | ||
- | <ervo servo1; // | + | <code c++ mmuavarm.cpp> |
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | int tx = 2; //input | ||
+ | int rx = 4; //output | ||
+ | int servopin1 = 5; //motor pin no.1 | ||
+ | int servopin2 = 6; //motor pin no.2 | ||
+ | int servopin3 = 3; //motor pin no.3 | ||
+ | int servopin4 = 11; //motor pin no.4 | ||
+ | String myString = ""; | ||
+ | int ini1 = 120; //motor1 starting point | ||
+ | int ini2 = 45; //motor2 starting point | ||
+ | int ini3 = 20; //motor3 starting point | ||
+ | int ini4 = 60; //motor4 starting point | ||
+ | int angle1, angle2, angle3, angle4; | ||
+ | int pos1, pos2, pos3, pos4; | ||
+ | int goal1, goal2, goal3, goal4; | ||
+ | int dly = 120; //motor speed | ||
+ | |||
+ | |||
+ | Servo servo1; // | ||
Servo servo2; | Servo servo2; | ||
Servo servo3; | Servo servo3; | ||
Line 230: | Line 315: | ||
servo4.detach(); | servo4.detach(); | ||
} | } | ||
- | myString = ""; | + | myString = ""; |
} | } | ||
} | } | ||
- | > | + | |
- | ---- | + | </code> |
- | \\ | + | |
- | The snippet above serves to <fill in the blank>. It does this by <fill in the blank> | + | |
- | \\ | + | |
- | ---- | + | |
- | <!- Insert another snippet of your code here. Try to keep to less than 0.5 page long --> | + | |
---- | ---- | ||
- | Next, the code does <fill in the blank> | ||
- | <!-- Keep entering snippets of code and descriptions until you've given enough for a reader to understand how it works --> | ||
// | // | ||
// | // | ||
==== Final Words ==== | ==== Final Words ==== | ||
- | This tutorial' | + | This tutorial' |
\\ | \\ | ||
\\ | \\ | ||
- | Speculating future work derived from this tutorial, includes | + | Speculating future work derived from this tutorial, includes |
\\ | \\ | ||
\\ | \\ | ||
- | For questions, clarifications, | + | For questions, clarifications, |
mm-uav_arm_bluetooth_operation.1470136746.txt.gz · Last modified: 2016/08/02 04:19 by dongbinkim