This week I started exploring new graphical user interface softwares (GUI) and used them to display the collected data from my sensors. As a group, we have made a comparison between different interfacing options.

Softwares used:

Unreal Engine Resources:

Processing Resources:

Assignment content:


13.1. Group assignment:

For this week the group assignment is to compare as many interface tool options as possible. We chose to discuss "LabVIEW" and "Data Dashboard LabVIEW".

Click here to enter the group assignment page.


13.2. Individual assignment:

For the individual assignment of this week, I have developed the Graphical User Interface (GUI) for my final project. I tried two interface softwares, which are Unreal Engine and Processing IDE. My operating system should communicate and send collected data to the interface program via Bluetooth.


Using Arduino UNO

13.2.1. Hardware.

For my final project I will use MPU-6050 to measure the range of movement for knee. The MPU-6050 communicates with the micro-controller through I2C protocol. Data will be transmitted wirelessly via HC-05 Bluetooth module to the computer.

Bill of Materials (BoM):

QtyComponent namePart name
1Micro-controllerArduino UNO
1BluetoothHC-05
1Inertial Measurement Unit (IMU)MPU-6050

Connection: hardware


13.2.2. Sofware.

13.2.2.1. Unreal Engine.

First, I tried to use Unreal Engine to create the interface for my final project. I made a research about it and found that it's one of the most powerful real-time 3D creation platforms. Also, results of users that published on the internet are amazing in terms of graphics quality.

First you should sign up and download Epic Games launcher from here. Then click on the launcher to run the setup installation.

sign_up

After Installation is complete, open Epic Games software and sign in with your account.

sign_in

The next step is installing Unreal Engine Plugins. To do that, click on Unreal Engine tab from the left bar menu. Click on the Install Engine orange button on the top right side.

Install_Engine

Choose a location for the installation file then click Install button. Installation process may take some time to finish.

Choose_local

After installation is done, your system is ready to launch Unreal Engine by clicking on the Launch button on the top side. This will take time too to finish.

Launch

Now you will be able to create projects using Unreal Engine. project

However, I found that Unreal Engine is using large space (approx. 8 GB) of my disk space. Therefore, I decided to not using it for my project and shifting to another software.


13.2.2.2. Processing.

Processing IDE is an open-source programming language similar to Arduino IDE, but it's used for visualizing data and application programming interface (API).

First, you should install the processing IDE from here. Choose the type of your computer operating system. If you are using windows, but you don't know which CPU type to choose (64-bit or 32-bit), follow these steps from this link.

processingIDE

Next step is to install the libraries required by the processing IDE to create the graphical user interface for my program. I have used a library from the internet called "Toxi"; you can download it from here.

Unzip ToxicLibs and place all the contents to the processing libraries folder in your computer. To know where is your processing folder follow these steps:

  • Open Processing software.
  • Click on File >> Preferences.
  • Copy the folder path from the "Sketchbook location:" value provided. preferences
  • Paste the copied path in your folder browser.
  • Inside that folder, there should be another folder called "libraries". Libraries
  • Copy the content of the toxiclib and paste it into this location. added_libraries

I will use the example code provided from the Arduino MPU6050 library: (File >> Examples >> MPU6050 >> MPU6050_DMP6) mpu_arduino

To simulate the 3D model in Processing, you need to:

  • Comment the line in the Arduino MPU6050_DMP6 code which says: #define OUTPUT_READABLE_YAWPITCHROLL
  • Uncomment the line which says: #define OUTPUT_TEAPOT
lines_comments

Now your code is ready for uploading, but first disconnect the HC-05 Bluetooth module RX and Tx pins because the micrconroller will use these pins to upload the code. Click on Upload from the Arduino IDE to upload the code.
doneUploading After uploading is done, pair the bluetooth module HC-05 with your computer. To do that:

  • Go to the compuer Bluetooth settings and turn it ON.
  • Click on Add Bluetooth or other devices. TrunBluetooth
  • The computer will discover the HC-05 module, click on it and enter the password "1234". connecting

After uploading is done, open the folder where you added the MPU6050 library for the Arduino: (MPU6050 >> Examples >> MPU6050_DMP6 >> Processing >> MPUTeapot.pde) MPUTeapot

When you open the Processing IDE, you will see something like this. start_page

Connect RX and TX pins again to the Bluetooth module and change the following lines of code. If you are using Linux edit the first highlited line, if Windows edit the second one. processingCode Run the code in Processing IDE and you should got the real-time movement of the MPU-6050 as shown in the following video.

-----------------------------------------------------------------

Using ATtiny44

In this step, I'll build an interface using MIT App Inventor. First thing I did was navigating the App Inventor website to get familiar with it. Next thing I did was building a setup program for Bluetooth communication. To do that I followed this tutorial.

I have created a simple program, which turn an LED on and off from a mobile device using "HC-05" bluetooth module for communication with ATtiny44.

Communication between ATtiny44 and "HC-05" is over serial commands through Tx and Rx pins. However, these pins should be disconnected when uploading the code to ATtiny44.

I have uploaded the following code to my ATtiny44 board. The code tells arduino UNO to turn on the LED connected to pin "PA3" when the user click on "ON" button and turn it off when click on "OFF" button from the MIT app.

#include<SoftwareSerial.h>
SoftwareSerial mySerial(PA1, PA0);

char Incoming_value = 0;               
void setup() 
{
  mySerial.begin(9600);         
  pinMode(PA3, OUTPUT);        
}
void loop()
{
  if(mySerial.available() > 0)  
  {
    Incoming_value = mySerial.read();      
    mySerial.print(Incoming_value);        
    mySerial.print("\n");       
    if(Incoming_value == '1')            
      digitalWrite(PA3, HIGH); 
    else if(Incoming_value == '0')     
      digitalWrite(PA3, LOW);   
  }                            
}

After uploading the code, connect back Tx and Rx pins. The next step is to build a mobile app using MIT app inventor website. It provides a free programming enviroment that is easy to understand and follow for beginners in programming.

The following screenshot shows my Designer window that contains all the components I used and shows how the app will look like when installed on the mobile phone later: BluetoothAppDesigner

While the following screenshot shows my Blocks window that contains all the programming code: BluetoothAppBlocks

Now the app is ready to install on mobile phone. To do that click on Build from the top menu then App(provide QR code for .apk). MITbuild Wait until the QR produced. This may take 1 to 2 minutes based on your internet speed. QRcode

When QR code appears on the screen, open The MIT AI2 Companion app and scan it with your mobile phone. QRcode2 Follow the below steps on the mobile phone to install the app: installingSteps

Finally, the app is installed on the mobile phone. Pair the mobile device with the bluetooth module "HC-05", connect it, and turn the LED on and off. The following video shows how to connect to bluetooth module and the operated system.

⤧  Next post 14. Invention, Intellectual Property and Business Models ⤧  Previous post 12. Output Devices