Difference between revisions of "Leap Controlled RC Car"

From ESE205 Wiki
Jump to navigation Jump to search
Line 75: Line 75:
 
== Links ==
 
== Links ==
 
* Our github with all relevant code can be found [https://github.com/djdagrosa/LeapMotion Here!]
 
* Our github with all relevant code can be found [https://github.com/djdagrosa/LeapMotion Here!]
* An example of our Leap Motion code in action can be found on Youtube by searching for Leap Motion Example
+
* An example of our Leap Motion code in action can be found at youtu.be/6KYSonVOybY
* An example of our WASD code in action can be found at https:// youtu.be/8SPkMzXISdI
+
* An example of our WASD code in action can be found at youtu.be/8SPkMzXISdI
 
[[Category:Projects]]
 
[[Category:Projects]]
 
[[Category:Spring 2016 Projects]]
 
[[Category:Spring 2016 Projects]]

Revision as of 02:32, 6 May 2016

Proposal

Project Overview

The goal of this project is to create an RC car that is controlled by a Leap Motion pad through hand gestures. The Leap Motion will be connected to a computer and will communicate with an Arduino on the RC car. This communication will most likely occur via a bluetooth dongle. The RC car will be purchased from a kit online and customized as needed.

Team Members

  • David D’Agrosa
  • Andrew O’Sullivan
  • Alden Welsch (TA)

Objectives

The primary objectives of this project involve the construction of an RC car, exploring the capabilities of programming with Arduino, and controlling the RC car via a Leap Motion pad. The RC car is the foundation of our project so finding a suitable kit which can be modified to incorporate an Arduino is the first objective. Building a circuit to connect the Arduino to the RC car will allow us to begin writing code to control the RC car. The final and most difficult objective involves understanding how the Leap Motion pad outputs information, transforming a hand motion into a bluetooth signal, and sending that information to control the RC car. If bluetooth proves to be too difficult of an option, we may pursue simpler ideas with time permitting. If we finish our project early, we will work on a mobile app to control the RC car.

Challenges

Challenges we might encounter include learning how to program in Arduino, taking data in from the Leap Motion pad, communicating wirelessly between a computer and the Arduino, and programming the Leap Motion pad. With minimal experience coding, extra time will need to be devoted to understanding the most accessible language and its functionality.

Budget

  • RC car $13.99 (Link)
    • We need this component to act as the body of our car. It is a simple kit that includes wheels and motors that can be configured with the Arduino
  • Arduino (supplied by class)
    • We need this component to be our motor controller and run our code on the car.
  • Batteries $9.99 (Link)
    • We need batteries to drive the motors and run the Arduino on our RC car
  • Leap Motion $58.99 (Link)
    • Leap motion is a fun, new tool that can easily read hand motions and will act as the input to drive our RC car.
  • Bluetooth dongle $13.99 (Link)
    • We need a this component because the computers in our lab do not have Bluetooth built in. We will be communicating with the Bluetooth shield on the RC car via Bluetooth.
  • Bluetooth Transceiver Module Slave $9.99 (Link)
    • This component allows the Arduino to easily receive information from the computer and act based on whatever inputs it receives.
  • Ardumoto Shield Kit $35.45 (Link)
    • The Ardumoto Shield included in this kit is an easy-to-use dual motor controller. This will allow us to control the motors in 2 directions and integrates easily with our Arduino. Additionally, this kit comes with 2 spare wheels, 2 spare motors, 3 screw terminals which are necessary for our Arduino, stackable headers, extra black wire, and a 9V to barrell jack adapter so that our battery can easily configure with the Arduino.
  • Note: All prices include shipping

Total: $142.40

Gantt Charts

Gantt.png


Ganttt.png

Design and Solutions

Arduino, Ardumoto Shield, and Motors Circuit

Java and Leap Motion

Working within Java with the Leap Motion module took some getting used to before working smoothly. The first steps involved downloading the necessary .jar and .dll files from the Leap Motion website. Once these libraries were added to Java, the next step involved understanding how to set up a frame and a controller. To do this, we created a sample listener and controller after looking at other examples of code. This listener acts to update the values in our frame every 100ms (due to a pause we put in). We wanted to utilize the pitch value which goes from -pi to pi so we rounded it and made a few other changes so we got values ranging from -2 to 4. With these values set to variables, we then call our writetoArduino function which has various if statements in it. These if statements look at the values we have and will then write a unique character to our Arduino. Our Arduino sketch then reads that unique character and actuates the motors accordingly.

Arduino Code

  • Arduino Code was written to take in the data from the bluetooth slave, analyze the data, and send information to the motor controller to move the rover forward.
  • The Arduino 'saw' the bluetooth slave as if it were a Serial Monitor. The Arduino would look at it and take in the available information.
  • The raw data that was displayed by the bluetooth were numbers between:
    • 49 and 52 to signal moving forward with variable speed
    • 65 and 68 to signal turning right with variable speed
    • 69 and 72 to signal turning left with variable speed
    • an input of 90 moved the rover backwards at roughly half full speed
  • The Arduino mapped the raw data so that it would move with a variable speed from 0 to 255. (0 being off and 255 being full power)

Results

Leap Control

Due to difficulties getting our Bluetooth Module talking with our Java code, we had to be hardwired into the computer in order for our Leap Motion pad to control the car. Initial setup simply involves making sure the COM port specified Once the code is running, it will send a signal to the car every 50ms. If no hand is detected above the Leap Motion module, our Java code outputs "No hand detected". Once a hand is detected it will display the speed that the car is going. A hand flat above the Leap Motion module equals a speed of zero. Tilting the hand downwards increases the speed with three levels of intensity (speed=1, speed=2, speed=3) which are also displayed in our Java code. When the hand is displaced laterally from the Leap Motion module, the direction can be changed. Turning works in unison with the hand tilting so three are three speeds which the car can turn.

WASD Control

RC Control

Links

  • Our github with all relevant code can be found Here!
  • An example of our Leap Motion code in action can be found at youtu.be/6KYSonVOybY
  • An example of our WASD code in action can be found at youtu.be/8SPkMzXISdI