RCar | App


MIT App Inventor

Fig. 1 - MIT App Inventor 2.

MIT App inventor 2 is an open-source web application created by Google and, now, maintained by MIT. It was made available on July 12, 2010 and publicly released on 15th December of the same year. Development was in charge of a team led by Hal Abelson and Mark Friedman. The programming language on the back of App Inventor is Java.
  This way, the development of Android apps was significantly simplified. Furthermore, it is considered a very reliable service by checking the classification of the app in the Play Store: 4.1/5 (Sept, 2018). Due to these 2 crucial features, it was already downloaded over 1 million times. By September 2018, there were already 6.8 million registered users spread over 195 countries, running a total of 24 million built applications. It is now available in 12 languages.
  One can divide the development process in 3 stages. 1) Consists in developing a prototype app using AI Companion. A feature that allows us to directly check in the smartphone the programming performed in the web browser. The newest version, MIT App Inventor 2 (Fig. 1), already includes a new functionality that allows real-time debugging via Wi-Fi (and not just USB). In this case, a QR code is scanned by the smartphone or a connection is established by manually inserting an alphanumeric code, provided by the website, in the MIT AI2 Companion app. 2) Then, it is possible to build what was previously developed and saved in a computer, with the right Android extension: .apk. The transference of this file to an Android device may be done by cable or online. 3) Finally, the app may be published in Play Store and, consequently, made accessible to everyone, everywhere...


Android App

Using MIT App Inventor 2 (Fig. 1), we developed an Android app that is able to control many features of a RC car, using a Bluetooth connection. Specifically, the angular velocity of the back wheels, the rotation angle of a front servo, a horn, music, light and GPS components.
  Once the application has many controls (one joystick and several buttons), we needed to clearly define the source of data received by the Arduino. This is particularly important because we were only able to send one type of values (either strings, bytes or integers) to the BT module. Communication between the app and the Arduino was done using 1 byte numbers. Thus, each command was associated to a specific integer ranging from 0 to 255.
  The inclusion of a GPS module ended up increasing the complexity of the app. The reason is that, at certain moments, the app is sending values and, in others, receiving longitude and latitude coordinates. It was not particularly easy to transmit these numbers due to their high number of decimal digits (requisite to achieve an acceptable location accuracy). The root of the problem was to transmit both values in real time and without overlapping the previously received.
  Similarly to what happened with the GPS module, the joystick action was not easy to coordinate. Again, the transmission of horizontal and vertical coordinates was done by including a small delay between their transmission. This was carefully adjusted, so that the Arduino did not understand x as y or y as x. And, at the same time, to prevent overlapped signal transmission. Moreover, a range of numbers common to the command buttons of the app, was also avoided.
  As said above, the presence of a single communication channel prevents us from transmitting multiple values at once. For this reason, one should carefully disable all the previously activated timer commands while trying to send new instructions.
  Another issue out of our control was the number of bugs still present in MIT App Inventor 2. Along the project development, we faced a great number of unexpected issues while programming a more recent version of the Bluetooth module (HM-10). BLE (Bluetooth Low-Energy) library present in MIT App Inventor 2 is still very limited in terms of its functional tools. We ended up using HC-05. If our goal was to transmit sporadic on/off values, such as in the case of a button or a set of them, it would be fine. But, for now, to send many values and in a very reduced time interval (as requested by the joystick to obtain real-time responsive commands) will crash the application still in AI2 Companion Mode or, later, after building the app.

Global Variables

Connecting to Bluetooth Module

Disconnecting from Bluetooth Module

Openning/Closing Bluetooth Window

Receiving GPS Latitude and Longitude Coordinates

GPS Map - Setting Zoom Definitions

Enabling/Disabling Headlights

Enabling/Disabling Right Turn Lights

Enabling/Disabling Left Turn Lights

Enabling Buzzer On Touch Down

Disabling Buzzer On Touch Up

Opening App Info Window

Defining Backpress Button Functionality

Play Music

Sending Joystick Coordinates from App to Arduino

Defining Non-Active Joystick State

Video 1 - DIY RCar project. Includes design, electronics and programming explanation.

User Guide

  In order to use the app, the first step is to go to the smartphone’s definitions and pair up with the car’s Bluetooth receptor, which goes by the name HC-05. The (default) password is 1234. After this step is concluded, open the app, click on the Bluetooth icon on the bottom end of the screen and establish a connection with the module. All the features the app controls - the front lights, the turn signal lights, the horn, the music player and the joystick - are now ready to be used. The GPS, whose icon is next to the Bluetooth one, can also be accessed (note it does not work indoors). In Fig. 2, some features of the app were depicted.

Fig. 2 - Description of the main functions of RCar app.

Download Files


Future Improvements