Skip to content

DIT112-V19/group-05

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Route Design - The HAJKEN Car

What?

“You draw, it drives!”

An Android App in which the user can draw a (free-hand) route. The vehicle will drive according to the drawn route and, if requested, reverse and repeat it. Additionally, the vehicle can get its current GPS location and drive according to a track based on a route planned in google maps.

Why?

The interface enables a simple way of controlling the vehicle without programming. Driving according to certain user-drawn route and reversing/repeating this route, can be used for:

  • data collection
  • surveillance of area

There are many more applicable areas where there is use of a designed and predetermined route.

How?

Software:

for App

  • Android Studio

for Arduino

Hardware:

  • Mobile Phone with Android OS and Bluetooth
  • Arduino Mega
  • PCB Smartcar Shield
  • 4x DC motors
  • Bluetooth module
  • Sensors:
    • 2x UltraSonicSound Sensor (HC-SR04)
    • Odometer (speed encoders)
    • Gyroscope
    • GPS-module (Neo-6M)
  • BETA: Hajken PCB with 3 LEDs and connections for sensors (see: pcb/hajken_cutouts_v2/)

Setup and get Started

Download repository

https://github.com/DIT112-V19/group-05/archieve/master.zip

Car / Hardware

  1. Follow the instructions for the hardware setup of the smartcar with differential control (aka driving like a tank)
  2. Connect front UltraSonic Sensor to pin 51 (trigger) & pin 52 (echo) [or other equivalent free pins]
  3. Connect right-side UltraSonic Sensor to pin 5 (trigger) & pin 6 (echo) [or other equivalent free pins] (or plugin into pins marked "Sensor right" on Hajken PCB)
  4. Connect odometer to pin 3 (additional odometer: connect to pin 2) (or plugin into pins marked "Odometer right"/"Odometer left" on Hajken PCB)
  5. Connect Bluetooth module to (hardware) serial 3 (pin 15(RX) & 14(TX) - connect RX to TX, TX to RX)
  6. Connect GPS module to (hardware) serial 1 (pin 19(RX) & 18(TX) - connect RX to TX, TX to RX)

Hardware setup (with Hajken PCB):

Arduino

  1. Open hajkenCar.ino in Arduino IDE
  2. Download the above-mentioned libraries (via Arduino IDE) and install TinyGPS++ manually (library folder must be called "TinyGPS++")
  3. Adjust pin setup if necessary.
  4. Calibrate odometer(s) and gyroscope. Use Smartcar Shield sketches for calibration (Odometer: sensors->odometer->FindPulsesPerMeter / Gyroscope: sensors->odometer->GyroscopeCalibration). Update PULSES_PER_METER and GYRO_OFFSET values.
  5. Optional: Test Sensors. Smartcar Shield library includes several sketches to test sensors' functionality.
  6. Upload sketch to your Arduino Smartcar.

Android Application

1. Import Android Project

  • Open Android Studios
  • Choose import project
  • Select android inside of the cloned folder
  • Follow setup instructions

2. Create an API-key for Google Directions API
This is required for the application to build.

  • Go to the Google Cloud Platform Console .
  • From the Project drop-down menu, select or create the project for which you want to add an API key.
  • From the Navigation menu, select APIs & Services > Credentials.
  • On the Credentials page, click Create credentials > API key.
    The API key created dialog displays your newly created API key.
  • Open the Android folder
  • Create a copy of the file gradle.properties.no.git and name it gradle.properties
  • Open gradle.properties
  • Find line 15 where it says GoolgeAPIKey = "myKey"
  • Insert your API-key where it says "myKey"

3. Build and run the app in Android Studios
Tutorial for detailed instructions: https://developer.android.com/studio/run

4. Give app permission to use location
Once the application is running, it needs permission to use the phones location.

a). Open Settings. Go to Permissions b). Go to Your Location c). Enable permission for the app

5. The application is ready for using

Navigate through the interface

The basic navigation through the app can be seen in the following 3 pictures:

Connect to car Draw and drive Map and drive