DJ SmartCar is a dancing SmartCar controlled by an app that can also play music via Spotify. During these “unprecedented times” we wanted to develop a product that is fun and entertaining, while also showing off the capabilities of the SmartCar. When using our product, the user can choose between two modes: Dance without Music or Dance with Music. In Dance without Music, the user can make the car dance by choosing from four pre-programmed dance moves or a randomized sequence of these moves. In Dance with Music, the user connects to Spotify and the car will dance in a randomized sequence to the average tempo of the currently playing track. The car’s speed will change based on the tempo of the current track.
DJ SmartCar is a two-tier system that includes a SmartCar and an Android app. The app sends requests to the SmartCar server via WiFi. To play music and receive track tempo data, the app connects to the Spotify Web API. Please refer to Resources for a list of the hardware and software used during development and in the final product. To see the evolution of the DJ SmartCar software architecture, please refer to the Class Diagram Wiki page.
We have created a "fun" infomercial-style demo video. Please enjoy!
There are a few things you need to do before getting started:
- Download Arduino IDE
- Download Android Studio
- Install Java SDK version >= 11
- Clone the repository:
https://github.com/DIT112-V20/group-06
- Open the Arduino IDE and navigate to File > Preferences and paste the following link in the Additional Boards Manager URL section:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
. - Navigate to Sketch > Include Library > Manage Libraries, then search and install the Smartcar shield library.
- Go to Tools > Board and select
DOIT ESP32 DEVKIT V1
. - Go to Tools > Port and select the port the car is connected to.
- Change the WiFi credentials on lines 36 and 37 in
carLogic.ino
. - Calibrate the sensors to get
GYROSCOPE_OFFSET
andLEFT_PULSES_PER_METER
andRIGHT_PULSES_PER_METER
for the odometers and add the number to the variables in thecarLogic.ino
sketch. In the Arduino IDE:- File > Examples > Smartcar shield > Sensors > gyroscope > gyroscopeHeading
- File > Examples > Smartcar shield > Sensors > odometer > findPulsesPerMeter
- Open carLogic.ino and upload the sketch to the car.
- Open the
src/app
project in Android Studio. - Sync the Project with the Gradle Files either by clicking the elephant button in the top right corner or by entering the following command:
./gradlew build --stacktrace
. - Register the app on Spotify to get the Client ID and Client Secret. For assistance on finding the fingerprint, refer to the following link: https://developer.spotify.com/documentation/android/quick-start/
- Input the IP address of the car in
BASE_URL
inRetrofitClient.kt
. To get the IP address, follow the steps below:- When the car is connected to the computer, open the serial monitor window.
- Turn on the car.
- Press the EN button on the car.
- Input the Client ID in
CLIENT_ID
for Spotify inSpotifyService.kt
. - To find out how to acquire authorization for the Spotify Web API, go to: https://developer.spotify.com/documentation/general/guides/authorization-guide/
- In
Endpoint.kt
, input the authorization on line 25. - The
CLIENT_SECRET
variable is also available inSpotifyService.kt
for those who want to implement the base 64 encoding of the Client ID and Client Secret programmatically.
- In
- Run the app!
Thank you for choosing the DJ SmartCar system!
We hope this product will bring you joy and entertainment for years to come. Before you can get started, there are a few things you need to do:
- Download and install the DJ SmartCar app.
- Download and install the Spotify app.
- Log in to the Spotify app on your phone.
- Click Dance with Music in the DJ SmartCar app and accept the Spotify terms and conditions.
- Turn on the SmartCar.
Now that you have downloaded the DJ SmartCar and Spotify apps, you can start enjoying the DJ SmartCar system!
The Dance with Music mode allows you to play music from Spotify right in the DJ SmartCar app. When pressing the Play button, the music will begin and your car will start dancing! When you press Pause, both the car and the music will stop. If you want to change the track, press Pause then change it in the Spotify app and return to the DJ SmartCar app to start dancing. When the track automatically changes, press Pause and then Play again to get the new tempo for DJ SmartCar to dance along to. If you press the home button while the car is dancing, the music and car will automatically stop and you will go back to the home screen. Pressing it while the music and car are paused will just take you back to the home screen.
You will see this screen once you have selected a dance move.
The Dance without Music mode features four unique dance moves: two-step, spin, shake, and macarena. The random button will make the car do these dances in a randomized order. After you have selected a dance move, press the Start button to make it dance until you press the Stop button.
To go back to the home screen, simply press the home button in the top right corner.
Thank you again for choosing the DJ SmartCar system, the most entertaining SmartCar on the market!
- DOIT ESP32 devkit v1
- TTL level shifters
- GY-50 Gyroscope
- Adjustable DC regulator
- Power switch
- Motor drive
- Bumpers
- Motors
- Odometers
- Ultrasonic sensor
- Cables
- Battery recharger
- 8x AA recharageable batteries
- Android Studio
- Arduino IDE
- SmartCar Library
- Spotify Web API
- Spotify Android SDK
- Postman (Only used during development)
- Fayona Cowperthwaite (guscowfa@student.gu.se)
- Dominique Deramat (gusderdo@student.gu.se)
- Shonaigh Douglas (gusdoush@student.gu.se)
- Negin Hashmati (gushashne@student.gu.se)
- Jennifer Nord (gusnorjea@student.gu.se)
- Victoria Vu (gusvuvij@student.gu.se)