Control a Relay with ESP32 via Bluetooth Using MIT App Inventor _Part 5
Welcome to the final installment of our series on controlling an ESP32 Relay via Bluetooth. In Part 5, we move beyond basic functionality and focus on App Deployment and UI Customization using MIT App Inventor.
A functional app is good, but a usable app is better. In this guide, I will walk you through the specific properties you need to change to brand your app, how to generate the installable APK file, and how to backup your source code using the .aia format.
Step 1: UI Customization in Designer View
To make your app look professional, you need to modify the Screen1 component properties. Here are the specific settings I use for a clean IoT dashboard:
- AlignHorizontal: Set to
Center(3). This ensures your ON/OFF buttons stay in the middle regardless of phone size. - Icon: Upload a 512x512px PNG file here. This replaces the default MIT robot logo on your phone's home screen.
- Title: Change this from "Screen1" to your project name, e.g., "Smart Relay Controller".
- BackgroundColor: Avoid pure white. I recommend a dark grey (
#333333) for better visibility of status LEDs.
Step 2: Understanding File Formats (.AIA vs .APK)
When working with MIT App Inventor, it is crucial to understand the difference between the two export options, as they serve different stages of the development lifecycle:
| File Type | Purpose | Action |
|---|---|---|
| .AIA | Project Source Code. Use this to backup your blocks or share the editable project with other developers. | Projects > Export selected project (.aia) |
| .APK | Installable Package. This is the compiled app that runs on Android. It cannot be edited. | Build > Android App (.apk) |
Step 3: Compiling and Installing
To move the app from the browser to your phone:
- Go to the top menu and select Build.
- Choose Android App (.apk). The server will take about 60 seconds to compile your blocks.
- A QR code will appear. Scan this with your phone to download the file directly.
- Note: You may need to enable "Install from Unknown Sources" in your Android settings since this app is not coming from the Play Store.
Troubleshooting Common Errors
If your APK fails to build or install, check these common issues I have encountered:
- Error 1101 (Unable to get a response): This usually happens if your uploaded image assets (icons/backgrounds) are too large. Keep images under 1MB.
- Parse Error on Install: This occurs if you export an
.aiafile and try to install it as an app. Ensure you are exporting the.apkfrom the Build menu. - Bluetooth Permission Denied: For Android 12+, ensure your MIT project properties have
BluetoothClientpermissions explicitly enabled in the settings.
Downloads & Resources
You don't have to start from scratch. You can download my completed project file (.aia) and import it directly into your MIT App Inventor account to inspect the blocks.
📂 Project Repository:
Watch the Full Walkthrough
For a visual guide on navigating the MIT App Inventor interface, watch the full tutorial below:
Missed a step? Check out Part 1 (Wiring) or Part 3 (App Design).
Comments
Post a Comment