Week 13

Getting started with Interface and application Development

This weeks assignment was to create an Graphical interface with the board we have made ...........

To do this .... I decided to work with NI LabView with its VISA Module...... I chose this platform as I was a bit familier with this software and its very easy to make an interface with LabView as its a graphical programming platform.

I was only familier with basic operation on LabView ..... to create an interface I went through some TUTORIALs. Its very important to understand the VISA Module of LabView while working with any other hardware (which in my case was custom made ATTINY44 Board) other than NI, as VISA provides an interfacing between other party hardwares and LabView.

Image

But before starting with LabView, I decided to check the Serial Data from the board using Arduino Serial Monitor and FTDI Convertor.

Image Image

I modified my previous code to write the data over the Serial...... Here I faced one problem while configuring Rx Tx pins ..... On my board Connections were as :

RX on physical pin 12

Tx on physical pin 13

What I was doing was ....... I was using Software Serial and passing 12,13 pins as Rx Tx pins but in case of attiny I missed that nomenclature of pins on arduino IDE is different ..... So again I saw the data sheet and then replaced the pin numbers by 0,1 ... then it was working .....

Image

Now Since the serial monitor was working fine with the modified code ...... I decided to move ahead with LabView, Below is the screen shot of Serial Monitor.

Image

Download Code & Board Files

Getting started with NI LabView

Before starting with NI LabVeiw its very important to understand its working environment..... as it not a traditional prrogramming language.... Its graphical programming langauge.... I was a bit familier with this environment so I directly jumped into making an interface for this week's assignment....... before doing that we need to understand that LabView does not interfaces directly with any other party hardwares such as Arduino, Raspberry Pi etc ....... but since its a modular programming language..... it is able to program and read data from external party hardwares through VISA Modules..... now I was not very much familier with the VISA ...... So before that I have to study the VISA Module.

Image Image

We have to follow a standard procedure to start a serial communication with the hardware we have connected on any COM Port .....

1. We have to select the port on to which the serial hardware is connected

2. Input the number of bytes which we are expecting would be comming

3. Type of data output

4. A control over the program i.e the stop button, this ensures that the program does not consumes all the CPU

5. A delay in the loop, this also ensures proper sync with the incomming data and makes sure that whole CPU is not consumed

6. After all this we need to open the VISA port

After following all the steps I decided to make first interface which would be showing which button was pressed either button 1 or button 2

The VI for the same is as shown below :

Image

After the VI here is the front panel, where all the data would be shown :

Image

Here is the working video of the front panel of the same :

After making one interface I got more intrested to try out some graphs ...... but for that I didn't have any board .... So I decided to use Arduino to transmit sensors data over the COM Port and read that with VISA Module of LabView.

For the sensor I had voice reciever module from Sparkfun ...... its very easy to use and interface with the arduino ....

Image

Here is the wiring schematic for the same :

1. Vcc ( Audio Board )----------> Vcc ( Arduino Board )

2. GND ( Audio Board )----------> GND ( Arduino Board )

3. Envelope ( Audio Board )----------> A0 ( Arduino Board )

4. Gate ( optional to connect ) ( Audio Board )----------> D1 ( Any digital Pin on Arduino Board )

5. Audio ( optional to connect ) ( Audio Board )----------> A1 ( Any analog pin on the arduino board, this is raw audio signal recieved by the module )

For this application the VI was as :

Image

I followed the same instructions as for the previous interface but for this I have to make an array to store the values which are comming over the COM...... this was to make a graph based on data points which are comming ........

Image

This was the front panel for the same

Here is the working Video

Download VI & Arduino Codes Download all files

Group work - Interface & application

This week's assignment was to compare as many tools as possible to make an interface.

For this week's assignment we used 3 tools
1. Processing
2. LabView
3. MIT App Inventor

Processing

Processing is an open-source computer programming language and integrated development environment (IDE) built for the electronic arts, new media art, and visual design communities with the purpose of teaching non-programmers the fundamentals of computer programming in a visual context. The Processing language builds on the Java language, but uses a simplified syntax and a graphics user interface.

After discussing with our instructor, we decided to use Processing. It’s very Arduino like. After going through a couple of tutorials & got the hang of it and within sometime we were able to design the GUI.

Image

Download Processing

Here is a simple tutorial on Processing which we followed : LINK

We wrote a program which has two buttons, an On and a OFF button to control and LED. The LED code is written in Arduino.Processing and the code in the Microcontroller communicate through serial communication.

Code
import controlP5.*; //import ControlP5 library
import processing.serial.*;

Serial port;

ControlP5 cp5; //create cp5 object
PFont font;

void setup(){

size(300, 500);    //window size, (width, height)

printArray(Serial.list());   //prints all available serial ports

port = new Serial(this, "COM12", 9600);

//lets add buton to empty window

cp5 = new ControlP5(this);
font = createFont("calibri light bold", 20);


cp5.addButton("On")     //"On" is the name of button
.setPosition(100, 50)  //x and y coordinates of upper left corner of button
.setSize(120, 120)      //(width, height)
.setFont(font)
;

cp5.addButton("Off")     //"off" is the name of button
.setPosition(100, 200)  //x and y coordinates of upper left corner of button
.setSize(120, 120)      //(width, height)
.setFont(font);

cp5.addButton("blink")     //"off" is the name of button
.setPosition(100, 350)  //x and y coordinates of upper left corner of button
.setSize(120, 120)      //(width, height)
.setFont(font);

}

void draw(){  //same as loop in arduino ide

background(250,250,250); // background color of window (r, g, b) or (0 to 255)

//lets give title to our window
fill(25,115,235);               //text color (r, g, b)

text("Namaskar", 110, 30);textSize(20);  // ("text", x coordinate, y coordinat)
}


//so when you press any button on the GUI, it sends perticular char over serial port

void On(){
port.write('c');
}

void Off(){
port.write('g');
}

void blink(){
port.write('b');
}
GUI

Image

week14

week13

MIT App Inventor

A fellow student had used App Inventor to make an android app. The interface seemed easy and the workflow too. After a week, we decided to make an app also. We wanted to control the LED from the APP via Bluetooth just like We did in processing. we started with Basic Videos from YouTube and in an hour we got the hang of it. App Inventor has been very easy to use, just pick and place components and your done. For the icons in the app, we found an amazing website with tons of icons to choose from - icons8.com

Here is the application Window

App Inventor Design Window with icons & layout.

App Inventor Blocks Window, were you connect certain buttons, images with one another and also command them to do something.

In my app, a person first clicks the Bluetooth icon which opens a list of Nearby Bluetooth device, After connecting with the required Bluetooth device, You can press the ON/OFF button to control the LED’s of Board.

Let's go invent tomorrow

Rather than worrying about what happened yesterday

~Steve Jobs

Contact Me

I am happy to talk you through any projects or run live demos to see how they look like.

Top