0% found this document useful (0 votes)
101 views

MIT App Inventor Projects: 50+ Android and iOS Apps With Rasberry Pi, ESP32 and Arduino

This document provides an overview and instructions for using the MIT App Inventor platform to develop 50+ Android and iOS mobile apps. It discusses setting up the App Inventor environment and describes 25 simple example projects that demonstrate basic app capabilities like using buttons, text boxes, images, sensors and more. It also covers using the Raspberry Pi 4 microcomputer to enhance apps with capabilities like GPS and includes setup instructions for the Raspberry Pi operating system.

Uploaded by

Hamza Belhaj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views

MIT App Inventor Projects: 50+ Android and iOS Apps With Rasberry Pi, ESP32 and Arduino

This document provides an overview and instructions for using the MIT App Inventor platform to develop 50+ Android and iOS mobile apps. It discusses setting up the App Inventor environment and describes 25 simple example projects that demonstrate basic app capabilities like using buttons, text boxes, images, sensors and more. It also covers using the Raspberry Pi 4 microcomputer to enhance apps with capabilities like GPS and includes setup instructions for the Raspberry Pi operating system.

Uploaded by

Hamza Belhaj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MIT App Inventor Projects

50+ Android and iOS Apps with


Rasberry Pi, ESP32 and Arduino

Dogan Ibrahim

LEARN DESIGN SHARE

MIT App Inventer UK 200311.indd 3 03-04-20 10:37


Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Chapter 1 • Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

1.1 Text-Based Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

1.2 Block-Based Visual Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

1.3 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Chapter 2 • Setting up the MIT App Inventor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

2.2 Setting Up the App Inventor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

2.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Chapter 3 • Simple MIT App Inventor projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

3.2 Starting App Inventor and the Startup Screen . . . . . . . . . . . . . . . . . . . . . . . . . . 26

3.3 Project 1 – Using a Button to Generate Sound . . . . . . . . . . . . . . . . . . . . . . . . . . 27

3.4 Saving the Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

3.5 Deleting a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

3.6 Sharing a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

3.7 Project 2 – Using a Button, a Label, and Text Boxes – Language Translation . . . . . 32

3.8 Project 3 – Formatting the Layout of the Components –


Language Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

3.9 Project 4 – Text to Speech – Fixed Text Message . . . . . . . . . . . . . . . . . . . . . . . . 37

3.10 Project 5 – Text to Speech – Any Text Message . . . . . . . . . . . . . . . . . . . . . . . . 39

3.11 Project 6 – Text to Speech – English to German . . . . . . . . . . . . . . . . . . . . . . . . 42

3.12 Project 7 – Using Images – Learning Elementary English . . . . . . . . . . . . . . . . . . 43

3.13 Project 8 – Speaking a Received SMS Message . . . . . . . . . . . . . . . . . . . . . . . . . 47

3.14 Project 9 – Sending SMS Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

3.15 Project 10 – R
 eading a Message and Sending a Reply Message
Automatically when Busy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

3.16 Project 11 – Display the Received SMS Message . . . . . . . . . . . . . . . . . . . . . . . . 53

3.17 Project 12 – Calling a Fixed Telephone Number . . . . . . . . . . . . . . . . . . . . . . . . 55

3.18 Project 13 – Calling to Several Fixed Telephone Numbers . . . . . . . . . . . . . . . . . 56

3.19 Project 14 – Calling from the Contacts List . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

3.20 Project 15 – Taking Pictures with the Camera . . . . . . . . . . . . . . . . . . . . . . . . . . 59

●5

MIT App Inventer UK 200311.indd 5 03-04-20 10:37


MIT App Inventor Projects

3.21 Project 16 – A Basic Piano . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

3.22 Project 17 – Acceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

3.23 Project 18 – Light Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

3.24 Project 19 – Global Positioning System – Latitude, Longitude, Altitude, and Speed 70

3.25 Project 20 – Pinpointing Your Location on a Map . . . . . . . . . . . . . . . . . . . . . . . . 72

3.26 Project 21 – Display/Set Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

3.27 Project 22 – Record/Play Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

3.28 Project 23 – Speech Recognizer – Translate Speech to Another Language . . . . . . 79

3.29 Project 24 – Chronograph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

3.30 Project 25 – Seconds Down Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

3.31 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

Chapter 4 • M
 IT App Inventor projects using mathematical &
logical operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

4.2 Project 1 – Area of a Triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

4.3 Project 2 – Areas of Various Shapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

4.4 Project 3 – Roots of a Quadratic Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

4.5 Project 4 – Random Numbers – Dice Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . 93

4.6 Project 5 – Quiz - Learning Multiplication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

4.7 Project 6 – Table of Trigonometric Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

4.8 Project 7 – Multiplication Time Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

4.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

Chapter 5 • R
 aspberry Pi 4 – specifications – setup –
installing the operating system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

5.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

5.2 Parts of Raspberry Pi 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

5.3 Requirements of Raspberry Pi 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

5.3.1 Setup Option 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

5.3.2 Setup Option 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

5.4 Installing the Raspberry Pi Operating System . . . . . . . . . . . . . . . . . . . . . . . . . . 106

5.4.1 Raspbian Buster Installation Steps on Raspberry Pi 4 . . . . . . . . . . . . . . . . . . . 106

5.5 Remote Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

●6

MIT App Inventer UK 200311.indd 6 03-04-20 10:37




5.6 Using Putty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

5.6.1 Configuring the Putty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

5.7 Remote Access of the Desktop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

5.8 Using the Python Programming Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

5.8.1 Method 1 – Interactively from Command Prompt . . . . . . . . . . . . . . . . . . . . . . 114

5.8.2 Method 2 – Create a Python File in Command Mode . . . . . . . . . . . . . . . . . . . . 115

5.8.3 Method 3 – Create a Python File in GUI mode – Using the Thonny . . . . . . . . . . 119

5.9 Which Method? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

5.10 Accessing Raspberry Pi 4 Hardware and Peripheral Devices from Python . . . . . . 121

5.10.1 GPIO – Parallel Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

5.10.2 The GPIO Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

5.11 Example Project Accessing the External World . . . . . . . . . . . . . . . . . . . . . . . . 126

Chapter 6• Raspberry Pi Bluetooth based projects using the


MIT App Inventor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

6.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

6.2 Project 1 – Controlling an LED from Android Mobile Phone . . . . . . . . . . . . . . . . . 129

6.3 Project 2 – Sound Output while Controlling an LED . . . . . . . . . . . . . . . . . . . . . . 138

6.4 Project 3 – Controlling an LED with Speech Commands . . . . . . . . . . . . . . . . . . . 140

6.5 Project 4 – Controlling Multiple LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

6.7 Project 6 – DC Motor Speed Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

6.8 Project 7 – Sending Temperature and Humidity to Android Device . . . . . . . . . . . 160

6.9 Project 8 – Password Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

6.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

Chapter 7 • Raspberry Pi Wi-Fi based projects using the


MIT App Inventor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

7.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

7.2 Project 1 – Getting and Displaying the Local Wi-Fi Parameters . . . . . . . . . . . . . . 174

7.3 Project 2 – Web Server to Control an LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

7.4 Project 3 – Web Server to Control Multiple Relays . . . . . . . . . . . . . . . . . . . . . . . 181

7.5 Project 4 – Sending Ambient Temperature and Humidity to


Android Mobile Phone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

7.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

●7

MIT App Inventer UK 200311.indd 7 03-04-20 10:37


MIT App Inventor Projects

Chapter 8 • R
 aspberry Pi Node-Red based projects using
MIT App Inventor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194

8.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194

8.2 Project 1 – Controlling an LED – Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . 194

8.3 Project 2 – Controlling 4 Relays – Web Server . . . . . . . . . . . . . . . . . . . . . . . . . 196

8.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

Chapter 9 • A
 rduino Uno Bluetooth based projects using
MIT App Inventor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201

9.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201

9.2 Arduino Uno Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201

9.3 Arduino Uno Program Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

9.4 Bluetooth for Arduino Uno . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

9.5 Project 1 - Controlling an LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204

9.6 Project 2 - Controlling a 4 Channel Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

9.7 Project 3 - Controlling a 4 Channel Relay with Sound Output . . . . . . . . . . . . . . . 214

9.8 Project 4 - Controlling a 4 Channel Relay with Speech . . . . . . . . . . . . . . . . . . . . 216

9.9 Project 5 – Sending Text to Arduino UNO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221

9.10 Project 6 – Sending the Ambient Temperature to Android Mobile Phone . . . . . . . 228

9.11 Project 7 – Weather Watch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234

9.12 Project 8 – ON-OFF Temperature Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239

9.13 Project 9 – Modified ON-OFF Temperature Control . . . . . . . . . . . . . . . . . . . . . 246

9.14 Project 10 – Controlling a Stepper Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248

9.15 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258

Chapter 10 • Arduino Wi-Fi based projects using MIT App Inventor . . . . . . . . . . 259

10.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

10.2 Arduino Uno Wi-Fi Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

10.3 Project 1 – Controlling an LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261

10.4 Project 2 – Controlling a 4 Channel Relay Module . . . . . . . . . . . . . . . . . . . . . . 269

10.5 Project 3 – Speech Control of a 4 Channel Relay Module . . . . . . . . . . . . . . . . . 277

10.6 Project 4 – UDP Based Control – LED Control . . . . . . . . . . . . . . . . . . . . . . . . . 279

10.7 Project 5 – UDP Based Control – Digital Thermometer . . . . . . . . . . . . . . . . . . . 283

10.8 Project 6 – UDP Based Control – Speaking Thermometer . . . . . . . . . . . . . . . . . 288

●8

MIT App Inventer UK 200311.indd 8 03-04-20 10:37




10.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289

Chapter 11 • ESP32 based projects using the MIT App Inventor . . . . . . . . . . . . . 290

11.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290

11.2 ESP32 DevKitC Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290

11.3 Arduino IDE for The ESP32 DevKitC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

11.3.1 Installing the Arduino IDE for the ESP32 DevKitC . . . . . . . . . . . . . . . . . . . . . 292

11.4 Project 1 – Controlling an LED – Bluetooth Communication . . . . . . . . . . . . . . . 294

11.5 Project 2 – Speech Control of an LED – Bluetooth Communication . . . . . . . . . . 297

11.7 Project 4 – Controlling a 4 Channel Relay Module using Switch


Components - Bluetooth Communication . . . . . . . . . . . . . . . . . . . . 301

11.9 Project 6 – Displaying the Ambient Light Level on LCD –


Bluetooth Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307

11.10 Project 7 – Controlling an LED – Wi-Fi Communication . . . . . . . . . . . . . . . . . 312

11.11 Project 8 – Speaking Thermometer – Wi-Fi Communication . . . . . . . . . . . . . . 315

11.12 Project 9 – Saving the Temperature Data – Wi-Fi Communication . . . . . . . . . . 318

11.13 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321

Appendix A • Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322

Appendix B • Using the MIT App Inventor offline . . . . . . . . . . . . . . . . . . . . . . . . . 326

B.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

B.2 Installing the App Inventor Ultimate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326

Appendix C • Loading the programs from the book website . . . . . . . . . . . . . . . . 329

C.1 File Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

C.2 Loading MIT App Inventor Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

C.3 Loading Android UNO Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

C.4 Loading ESP32 DevKitC Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

Appendix D • MIT App Inventor extension components . . . . . . . . . . . . . . . . . . . . 330

Appendix E • . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331

List of components used in the book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331

Processors used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332

●9

MIT App Inventer UK 200311.indd 9 03-04-20 10:37

You might also like