Arxterra: Understanding the Communication Between Arduino and Phone Connection Type: How Connect Phone To Arduino Communication from Phone to Arduino Communication.

Slides:



Advertisements
Similar presentations
These slides will show an example of connecting the UI5480SE-M-GL camera to a network using an Intel NIC card in a laptop computer. The UI5480SE-M-GL achieves.
Advertisements

Custom Commands: Arxterra Control Panel & Android Application Creating A Custom Command Command Control Panel Interface Implementation Example Tommy Sanchez.
Getting Started: Arxterra Control Panel & Android Applications
Lab7: Introduction to Arduino
IR Control Materials taken from a variety of sources including IR Remote for the Boe-Bot by Andy Lindsay.
Introduction to the Enhanced AIM When Q.i was first introduced, a ladder logic driver program – called the Application Interface Module (AIM) - was created.
OutLine Overview about Project Wii Robot Escaper Robot Problems and Solutions Demo.
TEMPLATE DESIGN © Bluetooth Login Key RIT Computer Engineering Senior Design Project Tim Wesley, Dan Chen Spring 2009.
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Programming in easyC.
CSULB EE400D TECHNICAL DOCUMENTATION ARDUINO/ARXTERRA PROGRAMMING PART II - TELEMETRY.
Microprocessors Tutorial 2: Arduino Robotics
Intel Do-It-Yourself Challenge Lab 1: Intel Galileo’s Arduino side Nicolas Vailliet
ENGG1100 Lecture7: Introduction To Engineering Design (Digital Logic) Part 2 Kin Hong Wong ENGG1100. Ch7-Digital Logic (part 2) 16/02/15 1.
LEGO NXT Robot Programming Introduction to Programming a Lego NXT robot in Java.
CSULB EE400D TECHNICAL DOCUMENTATION ARDUINO/ARXTERRA PROGRAMMING PART I - COMMANDS.
Github & Arduino How To: Post On Github How To: Download from Github How To: Upload Code Downloaded from Github to Arduino Tommy Sanchez EE400D Spring.
by Chris Brown under Prof. Susan Rodger Duke University June 2012
Program ultrasonic range sensor in autonomous mode
Programming Concepts Part B Ping Hsu. Functions A function is a way to organize the program so that: – frequently used sets of instructions or – a set.
GIRLS Robotic Camp. Let’s Begin Meet and Greet – Camp leaders introduce themselves – Students introduce themselves.
Introduction to the Basic Parts of LEGO’s NXT Robotics
Ruslan Masinjila Aida Militaru.  Nature of the Problem  Our Solution: The Roaming Security Robot  Functionalities  General System View  System Design.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering 1 Hsu/Youssefi.
The New FTC Platform (Connecting your legacy hardware)
7.2 V battery pack and charger Put the battery in the charger station at the end of the lab. period. Red light indicates charging. Ken Youssefi Introduction.
Barclays Robot Challenge Learn how to Program Robots.
ALL TERRAIN ROBOT 1 Wilmer Arellano. The Client’s Need  Verbally presented at class time.  Modify the All Terrain Manual Robot into an autonomous Gripper.
Introduction to Vexnet
Microprocessors Tutorial 2: Arduino Robotics. Agenda 1. Robot Anatomy 2. Sensor Review 3. PWM 4. MAKE: Fade 5. Motors 6. H Bridge 7. Robot Control library.
ROBOTIC ARM 2 Wilmer Arellano © Hardware  Next slide shows sensor connection to analog pin 0 and Motor 1 connection. Lecture is licensed under.
Quick guide to ASIMON configuration For version 3.0 or greater SAFETY AT WORK Date: 3/18/2009.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class3/Lab 2.
Arxterra Telemetry Code Example is the Temperature Sensor from ATechTop Here is the setup subroutine of the original code from Sparkfun: #define TRUE 1.
Programming - Motion Intro to Robotics. Motors and Sensors Setup The first thing we need to do is tell ROBOTC that we have motors on our robot. Choose.
1. At least two computers 2. Network adapters for each computer. The cost should be approximately $ If you have a 10Base-T adapters, and only.
Automation and Robotics.  First you select the platform type so that you can use Natural Language PLTW.
Casne.ncl.ac.uk Taking care of the CrumbleBot Please do NOT stress the robot's motors 1.Do NOT push the robot 2.Do NOT hold the.
Mechanical Components and Programming Ken Youssefi Introduction to Engineering – E10 1.
The Marshall car. INDEX Introduction The team What is it Arduino General Handling Manual handling Automatic Handling Sensors.
How to configure alarm system
Lego Mindstorm Robots 9797 kit.  Students will learn how to identify how to detect a change in a condition.  Students will learn where and how to identify.
Accelerometer based motion gestures for mobile devices Presented by – Neel Parikh Advisor Committee members Dr. Chris Pollett Dr. Robert Chun Dr. Mark.
1 of 20 How to use the Compass A. Compass. 2 Compass: - Provides heading relative to Magnetic North, not true North HMC5883L V input - I2C (not.
Transfer Contacts from iPhone to Android From:
© 2006 Carnegie Mellon Robotics Academy Designed for use with the LEGO MINDSTORMS ® Education NXT Software and Base Set #9797 Sentry System Two-Way Communication.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
3DoT Technical Documentation
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Arxterra: Understanding the Communication Between Arduino and Phone
Getting Started: Arxterra Control Panel & Application
Getting started with the Arxterra software and 3DoT Firmware
3DoT Technical Documentation
Dr. Kyung Eun Park Summer 2017
3DoT Technical Documentation
Robotics Programming Using Shaft Encoders
A Tutorial on How to Turn PowerPoint Presentations into Slideshows
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Programming Boe-Bots (Part 1)
Automation and Robotics
Sensors and Logic Switches
Welcome to Digital Electronics using the Arduino Board
Switch Blocks check a value and choose a path based on that value
Dave Mawdsley, DACS Member, Linux SIG January 16, 2013
Bluetooth operated Arduino Controlled Car
Robotics Programming Using Shaft Encoders
Instructions for tracking booth sales
Robotics Programming Using Shaft Encoders
Robotics Programming Using Shaft Encoders
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Presentation transcript:

Arxterra: Understanding the Communication Between Arduino and Phone Connection Type: How Connect Phone To Arduino Communication from Phone to Arduino Communication from Arduino to Phone Tommy Sanchez - EE400D

Connection Type: How to Connect Phone to Arduino There are two ways to connect your phone. Connection Type 1: OTG and Connection Type 2: ADB Connection Type 1: OTG This method allows USB devices (such as a phone) to act as a host. In this method you use a USB to OTG adapter. This method works on both Arduino Uno or Mega ADK. The type B USB input is used.

Connection Type: How to Connect Phone to Arduino Connection Type 2: ADB (Android Debug Bridge) In our implementation it’s called Microbridge. This method allows communication from the type A input of an Arduino Mega ADK. In other words no adapter is required here.

Connection Type: Which Method Should You Choose Connection Type 1: OTG Any phone compatible with the Arxterra App can connect using this method. Connection Type 2: ADB For this method your phone must be compatible with the Arxterra App and you must also have USB debugging enabled on your phone(See your phone manual). You must also have the ArduinoADB library(link provided on next slide). If your phone does not communicate even with debugging enabled then use Connection Type 1.

On The App: Choosing Arduino Connection Protocol Base On Connection Type Depending on whether the OTG or ADB connection type is being used, the Arduino Connection Protocol must be changed accordingly. If using ADB choose Microbridge. If using OTG choose Android as Host

The Code: There are two other sketch’s available if desired, one specifically for Rosco (OTG) and one for Pathfinder(ADB) that only work for that connection type. Note: A hybrid code of these two is covered in this PowerPoint. CjY05SQ3lkMDR6VHM&usp=sharing In order to simplify communication there is one Arduino sketch that accounts for both connection types. It can be found by going to the link shown below along with the necessary libraries: The following slides will talk about how the communication works and where to add your code using this Arduino sketch.

Communication: Quick Robot Configuration Robot Configuration In this section at the top of the sketch you configure your connection type, battery types and if using an ultrasonic sensor. Reading the comments here will help you get started with how you should configure each option.

Communication: Quick Robot Configuration Robot Configuration pinouts_robot.h The “pinouts_robot.h” tab is where you assign your specific pin configuration for the predefined identifiers. For example, Clean_BAT_PIN, a pin designated for your clean power, is defined to be pin A3.

Communication: Phone to Arduino Commands Command ID: The Arxterra Control Panel is set up for the following Phone to Arduino Commands These are also all defined in the Arduino Sketch. With the exception of custom commands which are determined by you. CommandCommand ID Move0x01 Camera Move0x02 Camera Move Home0x04 Camera Move Reset0x05 Read EEPROM0x06 Write EEPROM0x07 Safe Rover0x08 Sleep0x0A Wakeup0x0B Custom Command0x40 to 0x5F

Communication: Phone to Arduino CommandCommand ID Move0x01 [byte array index] descripton [0] = 0x01 (MOVE) [1] = left run (FORWARD, BACKWARD, BRAKE, RELEASE) [2] = left speed 0 to 255 [3] = right run (FORWARD, BACKWARD, BRAKE, RELEASE) [4] = right speed 0 to 255 Command ID and Associated Bytes:

Communication: Phone to Arduino [byte array index] descripton [0] = 0x02 (CAMERA_MOVE) [1] = pan degrees (Most Significant Byte) 0 for most servos [2] = pan degrees (0 to 180 for most servos) [3] = tilt degrees (Most Significant Byte) 0 for most servos [4] = tilt degress (0 to 180 for most servos) Command ID and Associated Bytes: CommandCommand ID Camera Move0x02

Communication: Phone to Arduino [byte array index] descripton [0] = 0x04 (CAMERA_HOME) Command ID CommandCommand ID Camera Move Home0x04 Camera Move Reset0x05 Command ID [byte array index] descripton [0] = 0x05 (CAMERA_RESET) In these two cases there are no associated bytes

Communication: Phone to Arduino CommandCommand ID Read EEPROM0x06 Write EEPROM0x07 Command ID and Associated Bytes: [byte array index] descripton [0] = 0x06 (EEPROM_READ) [1] = Address High [2] = Address Low [3] = Number Bytes Read Write [byte array index] descripton [0] = 0x07 (EEPROM_WRITE) [1] = Address High [2] = Address Low [3] = Number Bytes [4] = Data (Most Significant Byte) [5] =... [N] = Data (Least Significant Byte) N

Communication: Phone to Arduino CommandCommand ID Safe Rover0x08 Sleep0x0A Wakeup0x0B Command ID [byte array index] descripton [0] = 0x08 SAFE_ROVER) Command ID [byte array index] descripton [0] = 0x0A (SLEEP) Command ID [byte array index] descripton [0] = 0x0B (WAKEUP) In all cases there are no associated bytes

Communication: Phone to Arduino [byte array index] descripton [0] = command ID in range of 0x40 to 0x5F (64 to 95) [1 to ?] = Data as dictated by data type user configured Command ID and Associated Bytes: CommandCommand ID Custom Command0x40 to 0x5F Take a look at the Custom Commands Tutorial for examples:

Communication: Phone to Arduino How It Receives Commands OTG With OTG type the following is executed to obtain the Command ID and it’s associated bytes. They are put into an array called data[]. The function commandHandler() uses this data array.

Communication: Phone to Arduino How It Receives Commands ADB With adb type the following Interrupt is executed to obtain the Command ID and it’s associated bytes. They are put into an array called data[]. The function commandHandler() uses this data array.

Communication: Phone to Arduino commandHandler() commandHandler() : This function is where you will decide what your robot does based on the command received. cmd is set equal to the Command ID which is in data[0]

Communication: Phone to Arduino commandHandler() commandHandler() : As an example if your command ID(data[0]) is 0x01, that means you received a Move command. You would then be in the “if (cmd == MOVE)” section. Here would be your code for Movement. The kind of movement can be decided based on the associated bytes(i.e data[1]-data[4]).

Communication: Phone to Arduino commandHandler() commandHandler() : When using OTG connection. The Communicator app will show the data coming in. All the ones shown to the right are Move instructions with its associated 4 bytes. Only a few have been highlighted for illustrative purposes. You can decide what the associated bytes mean for your application Recall: [byte array index] descripton [0] = 0x01 (MOVE) [1] = left run (FORWARD(1), BACKWARD(2), BRAKE(4), RELEASE) [2] = left speed 0 to 255 [3] = right run (FORWARD(1), BACKWARD(2), BRAKE(4), RELEASE) [4] = right speed 0 to 255

Communication: Phone to Arduino commandHandler() commandHandler() : When using ADB connection you can view incoming data from the Arduino Serial Monitor. All the ones shown to the right are Move instructions with its associated 4 bytes. This is the same idea as in the previous slide.

Communication: Phone to Arduino commandHandler() commandHandler() : On the Arxterra app with the debug switch to enable you should also be able to see what kind of data you are receiving on the window space with either connection type(OTG or ADB).

Communication: Phone to Arduino commandHandler() commandHandler() : In order to help you better understand how you can translate the associated bytes using the convention at the bottom right, the byte arrays highlighted are illustrated in a structured manner. Recall: [byte array index] descripton [0] = 0x01 (MOVE) [1] = left run (FORWARD(1), BACKWARD(2), BRAKE(4), RELEASE) [2] = left speed 0 to 255 [3] = right run (FORWARD(1), BACKWARD(2), BRAKE(4), RELEASE) [4] = right speed 0 to 255 Move forward Slowly Move forward faster Stop Turn Right Slowly Byte array index [0] [1] [2] [3] [4]

Communication: Phone to Arduino commandHandler() commandHandler() : Back in our example the MOVE section called a move() function. This function handles what kind of move to do (left, right, forward, backward) based on the data while leaving that section uncluttered. Again, the associated bytes can be used to help you decide direction.

Communication: Phone to Arduino commandHandler() commandHandler() : You’ll notice that in the commandHandler function, all the Phone to Arduino Commands are checked. On the right is the check for the CAMERA_MOVE command ID. If 0x02 is the command received it calls a move_camera function. (used for pan and tilt) Recall: [byte array index] descripton [0] = 0x02 (CAMERA_MOVE) [1] = pan degrees (Most Significant Byte) 0 for most servos [2] = pan degrees (0 to 180 for most servos) [3] = tilt degrees (Most Significant Byte) 0 for most servos [4] = tilt degress (0 to 180 for most servos)

Communication: Phone to Arduino commandHandler() commandHandler() : CUSTOM COMMANDS If you have a custom command you will have to add your own elseif check and be aware of What your associated bytes if any are. Naming convention for the command would be up to you. Be sure to look at the PowerPoint on custom commands. Recall: [byte array index] descripton [0] = command ID in range of 0x40 to 0x5F (64 to 95) [1 to ?] = Data as dictated by data type user configured

Communication: Arduino to Phone To send telemetry information from the arduino to phone the following ID’s are used. These are also all defined in the Arduino Sketch. With the exception of custom commands which are determined by you. TelemetryID Motor 1 Current0x01 Motor 2 Current0x02 Body Temperature0x03 Ultrasonic Ranger Left0x04 Ultrasonic Ranger Right0x05 Digital Battery0x06 Motor Battery0x07 Pan0x08 Tilt0x09 EEPROM Read Results0x0A Custom Command Status0x40 to 0x5F

Communication: Arduino to Phone TelemetryID EEPROM Read Results0x0A Custom Command Status0x40 to 0x5F Telemetry ID and Associated Bytes: [byte array index] descripton [0] = command ID in range of 0x40 to 0x5F (64 to 95) [1 to ?] = Data as dictated by data type user configured Custom EEPROM [byte array index] descripton [0] = 0x07 (EEPROM_WRITE) [1] = Address High [2] = Address Low [3] = Number Bytes [4] = Data (Most Significant Byte) [5] =... [N] = Data (Least Significant Byte) N

Communication: Arduino to Phone sendData() Send Data: The sendData function is used to check whether there has been a change in anything from the telemetry table on the previous slides. The two if statements on the right check if a new pan or tilt position was detected and if so go to the sendPacket function with this information.

Communication: Arduino to Phone sendData() Send Data: For the Ultrasonic sensor, telemetry is only sent to the phone if the difference from a previous ping to the new ping is greater than the tolerance. Again if this is true, the information is used by the sendPacket function.

Communication: Arduino to Phone sendData() Send Data: The other telemetry checks in this function work much the same way of detecting a change. If custom commands are used this is where you would add a telemetry check based on your robot needs. The Example on the right could be used as a template.

Communication: Arduino to Phone sendPacket() sendPacket: If any change is detected in sendData that information is taken over to the sendPacket function. This function contains the ID for the telemetry and its associated values. Depending on if you’re using OTG or ADB connection type the information is sent to the phone accordingly.

Extra Resources/Information Setting Up the Code For The Arduino ADK: Tutorial Provided by Ryan Fiske (Fall 2013) USB to USB OTG cable to connect to Android phone using the OTG connection Type Tutorial on logging in to control panel and applications Tutorial on Custom Commands on the Arxterra Control Panel/App