SE3910
Week 7, Monday 11pm

This is an old version of this course, from Spring 2015. A newer version is available here.

This assignment is a team assignment. Please work in teams of two unless approved by the instructor.

Equipment Needed

  • Your beaglebone black
    • 5 V power supply (with LCD + sound card both drawing extra current, a good idea to use all the time in this lab.)
  • SE3910 Kit (Checkout from Tech Support)
    • USB audio I/O ports (for bone)
    • USB hub (for bone)
    • USB Oscilloscope (Digilent Analog Discovery)
    • Beaglebone Breadboard Cape
    • (optional) Beaglebone Breakout Board
    • Logitech webcam
  • A few 2 or 2.2 KΩ resistors (Checkout from me if not in kit)
  • (optional) NMap especially zenmap
  • Two network cables, or more if you want to share

Some VM and Linux Tips

VM

Use right-control to excape from the virtual machine.

To open terminal: Applications->Accessories->Terminal

From the browser, to copy the path, press Ctrl-L. The graphical folder crumbline (can't find online definition for this word -- do you have one?) will turn into a simple text editor.

ipconfig/ifconfig

Linux equivalent of ipconfig: /sbin/ifconfig, or, if the path is set up right, ifconfig. (I hear that ifconfig, if it works, may not give as complete results as /sbin/ifconfig. I haven't confirmed this yet.)

On windows with cygwin, ipconfig | grep "IPv4" gives a summary of IP addresses.

On linux, use /sbin/ifconfig | grep 'inet addr' to get the same effect.

With a single cable, an alternative configuration (that doesn't require the "share connection" setting) is to manually set all your devices IP addresses. The bone's IP address can be configured using something like ifconfig eth0 192.168.1.100 netmask 255.255.255.0, and your computer's address using the Windows GUI (e.g. to 192.168.1.101). You will also need to set your virtual machine's IP address — this is possible to do with the GUI (e.g. to 192.168.1.102).

For a single cable, another alternative is to set up your wireless network to share with your wired network. Then Windows will act as a mini-DHCP server (or will pass through some information so that the Beaglebone can reach DHCP on the larger network). In the file /vim/etc/interfaces, uncomment the two lines auto eth0 and iface eth0 inet dhcp. Save the file, and run the commands ifdown eth0 and ifup eth0 until ifup succeeds in obtaining an IP address. (Sometimes the first attempt, sometimes much more than this.)

Prelab

There was no opportunity for prelabbing this week. However, if you happen to see this before lab, installing the VM upgrades is a long-running task that would be nice to get out of the way in advance.

Introduction

In class, we have talked about constructing a user interface using QT. In this lab, you are going to put this skillset to work to construct a simple application using QT. The application will be a talking clock with customizable photo display.

Lab Objectives

VM Upgrades (can be done with just VM on network)

This lab involves a few significant changes to your virtual machine environment. Newer libraries have been created which require us to install new version of several software packages. Ideally, you should do this on a wired connection, as there are significant downloads to be made.

On your Virtual Machine, issue the following commands in order.

sudo apt-get update
sudo apt-get install qtcreator
sudo apt-get install xfce4 xfce4-goodies slim
sudo shutdown now

The first will install the QT creator library on your machine. While this command is going on, you will need to hit q at one point as a page of textual information will be shown and hit N to not make changes form the default settings. The second will update the GUI environment. The third will shutdown your machine for a reboot. The first time you log into the new GUI, it will give you a choice. Choose "Use default config", NOT the "One empty panel".

After the reboot, you may discover you can no longer manually connect/disconnect within the VM. This is a known bug with some versions of Debian. The bug site lists a work-around (logging in as root) that has worked for the students who have tried it.

Once the machine is rebooted, issue the command

sudo apt-get install qt4-dev-tools

to install the qmake tools on your virtual machine.

Library Installation on your Beaglebone

You will need about 200MB of extra space on your Beaglebone to install the libraries needed for this lab. If your Beaglebone is Revision C, all is well. To check how much extra space is available on your beaglebone, use the df -h command.

Your Beaglebone also needs to have one library installed for it to work properly. You can do this in lab when you are connected to the network. Issue the command

sudo apt-get update
sudo apt-get install qt4-dev-tools

to install the QT toolchain on your Beaglebone.

Later on in lab, we are going to work with the soundcard. To install the soundcard, issue the following commands in order to install the sound libraries on your Beaglebone.

wget http://http.us.debian.org/debian/pool/non-free/s/svox/libttspico-data_1.0+git20130326-3_all.deb
wget http://ftp.us.debian.org/debian/pool/non-free/s/svox/libttspico0_1.0+git20130326-3_armhf.deb
wget http://ftp.us.debian.org/debian/pool/non-free/s/svox/libttspico-utils_1.0+git20130326-3_armhf.deb

sudo dpkg -i libttspico-data_1.0+git20130326-3_all.deb 
sudo dpkg -i libttspico0_1.0+git20130326-3_armhf.deb 
sudo dpkg -i libttspico-utils_1.0+git20130326-3_armhf.deb

sudo apt-get install mplayer

With this completed, the following commands will generate a wave file with the text Testing 1 2 3 and will play it through the soundcard.

pico2wave -w test.wav "Testing 1 2 3"
ls -l test.wav
mplayer -ao alsa:device=hw=1 test.wav

The final command may need to be changes based on how your soundcard ends up being setup. Dr. Schilling used mplayer -ao alsa:device=hw=5 test.wav. The command aplay -l (with a lower-case L) may help to find the right hardware number. (More details on superuser) For example, when I ran it it produced something like ...

**** List of PLAYBACK Hardware Devices ****
card 1:
   

I believe the card number corresponds to the nuber you put after hw= in the mplayer command. This stack overflow question may have more info.

Building your basic applications

In the slides, I mentioned using .hpp instead of .h as an extension. Don't do this for the QT examples here. It might not work with the default configuration file provided. Just use the .h and .cpp extensions and filenames provided by the examples.

Once you have the QT Creator installed, you are to build your first application, a simple clock. Launch QT Creator through Applications Menu->Development->QT Creator. In your vm shared folder (e.g. /media/sf_vmshare/), create a qt folder, and within it a Lab6DigitalClock folder (e.g. /media/sf_vmshare/qt/Lab6DigitalClock). In the Lab6DigitalClock folder, create each example file from the Digital Clock Example and copy the contents from the webpage into the file. Open the .pro file with the File->Open File or Project menu/dialog. Accept the default import settings. Run the project by clicking on the green arrows. You should see the clock running within your VM something like this:

To install the qt application on your beaglebone, copy the folder Lab6DigitalClock to the /home/debian/Desktop folder on the Beaglebone. On the Beaglebone, in the folder /home/debian/Desktop/Lab6DigitalClock, execute the commands qmake and make. Once the make completes, through the LCD, find the executable (digitalclock, shown as a blue diamond), and double-click it. You should see the clock run on the Beaglebone.

Once you have completed this, compile and run the Simple Image Viewer example in the same way. This will walk you through constructing a simple QT image viewer. Again, verify that the code runs on your virtual box machine and then try running it on your Beaglebone.

Review the various source files you used to get the programs working, and the information on the pages they came from.

The Main event

Once you have gone through these two tutorials, combine the widgets which are created in the first and second tutorials together with a pushbutton to create the application shown below. If the user clicks on the speak the time button, the application should make a system call to speak the message : "The current time is now 12:15:45. Beep" Make sure this program works on your Beaglebone.

You do NOT need to capture images from the camera in this lab... maybe next week!

Deliverables / Submission

If you have any questions, consult your instructor.

Hints

Here are a few websites you might want to look at if you are stuck:

Acknowledgement: This lab originally developed by Dr. Schilling.

Due: Week 7, Monday, 11pm

Submission Instructions for Dr. Yoder

Submission due 11pm, Monday of Week 7