“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.
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.
- Android Studio
-
Arduino IDE
-
Arduino libraries:
- smartcar shield by Dimitris Platis (*)
- NewPing by Tim Eckel (*)
- TinyGPS++ by Mikal Hart
(*) available via Arduino IDE
- 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/)
https://github.com/DIT112-V19/group-05/archieve/master.zip
- Follow the instructions for the hardware setup of the smartcar with differential control (aka driving like a tank)
- Connect front UltraSonic Sensor to pin 51 (trigger) & pin 52 (echo) [or other equivalent free pins]
- 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)
- Connect odometer to pin 3 (additional odometer: connect to pin 2) (or plugin into pins marked "Odometer right"/"Odometer left" on Hajken PCB)
- Connect Bluetooth module to (hardware) serial 3 (pin 15(RX) & 14(TX) - connect RX to TX, TX to RX)
- Connect GPS module to (hardware) serial 1 (pin 19(RX) & 18(TX) - connect RX to TX, TX to RX)
Hardware setup (with Hajken PCB):
- Open hajkenCar.ino in Arduino IDE
- Download the above-mentioned libraries (via Arduino IDE) and install TinyGPS++ manually (library folder must be called "TinyGPS++")
- Adjust pin setup if necessary.
- 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.
- Optional: Test Sensors. Smartcar Shield library includes several sketches to test sensors' functionality.
- Upload sketch to your Arduino Smartcar.
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
The basic navigation through the app can be seen in the following 3 pictures:
Connect to car | Draw and drive | Map and drive |
---|---|---|