Assignments
EE402 Assignment 1 2019/20
Hi all, ASSIGNMENT 1 Your first assignment in 2019/20 is to write a section of code that demonstrates the following aspects of OOP in C++:
There are 20 points to address and there is 10% available for the assignment, so 0.5% per point is the outline marking scheme. If you address 14 out of 20 points clearly and correctly then you should receive 7/10 (or 70% on Loop). Please note, I would recommend that you hard code the input of data, i.e., don't set up a menu system and do not read values in from the user using cin. It is not necessary for this assignment and would lengthen the amount of work involved considerably. As for the topic; that is up to you, but please keep it simple. If one of the points does not fit into your application, just add it anyway for demonstration, i.e., the application does not have to make perfect practical sense. The rules are that:
REPORT STRUCTURE (IMPORTANT!) There should be a brief introduction at the start of your report that explains your application idea and LISTS CLEARLY one numbered paragraph for each of the points listed above (in the same order as numbered) and explains where in your code they have been implemented. In your code comment the sections where you show the points above, detailing the point that you have addressed. This is for the sole purpose of making it easier for the tutor to correct -- but without this your assignment will not be marked. Submit your assignment electronically as a SINGLE Google Docs generated document (not live link share!), Word Document, raw text document or PDF. This document should *only* have the following text sections:
ASSIGNMENT SUBMISSION Due for Monday the 4th of November 2019 by midnight. You should submit the assignments via Moodle at the address: https://loop.dcu.ie/mod/assign/view.php?id=1153223 Once again, use the main discussion forum here: https://loop.dcu.ie/mod/forum/view.php?id=1153218 if you have any questions on the assignment. Do not paste your code! Paste in a similar example if you need to clarify a point. If you know the answer to someone else's question please feel free to respond. One final important issue - Please note that by the electronic submission of your first assignment I am assuming that you are familiar with the academic rules for assignments. The assignment should be 100% your own work. If any unreferenced work is used from any other source (including colleagues, the Internet or past students) it will be a serious matter and referable to the disciplinary board. Please note that all assignment work can be the subject of an interview process. See: http://www.dcu.ie/info/regulations/plagiarism.shtml All assignments for this module will be uploaded to plagiarism detection software where the content will be analysed and compared to other assignment from this year and previous years. I take this matter very seriously as a few years ago several students were referred to the disciplinary committee resulting from plagiarism in this module – In one case a student was expelled from the University due to the severity of the plagiarism and the fact that at fourth/fifth year level, he should have known better. If after you receive your mark you are concerned that there is an error with the correction, please contact the module tutor that corrected your assignment. If the tutor checks it and if you are still unhappy please contact me directly and I will discuss the issue with you and the tutor directly. If I have failed to address any aspect of this assignment then please post to the forum. Enjoy, Derek. |
Assignment 2 - 2019/20
IntroductionIn this assignment you are going to develop a Java client/server application that sends and receives temperature data to/from a PC and an embedded Linux device such as the BeagleBone Black (BBB) or Raspberry Pi (RPi). This assignment requires a fair amount of configuration before you begin the assignment. Please send questions on problems that you are having to the mailing list on the module Loop page. The assignment is worth 15% of your overall mark in the module and therefore represents a significant body of work. The assignment begins with steps to set up your BBB/RPi to access the Internet, to flash the user LEDs using C, to install Java and finally to flash the user LEDs using Java. Good luck! Derek. Background Setup and Configuration (BBB and RPi)Follow the steps in this guide to place the BeagleBone Black (BBB) or Raspberry Pi (RPi) on the Internet so that you can clone the repository of source code on the Github site. Please note that access to the Internet from your board is useful, but it is not vital -- you can transfer files from your PC to the boards if necessary. BeagleBone Steps (See below for RPi steps)BeagleBone Only Step 1. BeagleBone Network Configuration and Source CodeFor the BBB, please read: Please note that for Windows 10 you will have to download the BeagleBone drivers from: http://beagleboard.org/getting-started If you have completed this guide successfully, you should be able to perform the following tasks: root@beaglebone:~# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_req=1 ttl=50 time=14.0 ms 64 bytes from 8.8.8.8: icmp_req=2 ttl=50 time=13.8 ms ...
root@beaglebone:~# ping www.google.com PING www.google.com (173.194.45.144) 56(84) bytes of data. 64 bytes from www.google.com (173.194.45.144): icmp_req=1 ttl=51 time=58.2 ms 64 bytes from www.google.com (173.194.45.144): icmp_req=2 ttl=51 time=58.2 ms ... NOTE: If you are using Internet-over-USB often on the BBB then you can edit your ~/.profile file using nano and add the following lines to the bottom of the file: /sbin/route add default gw 192.168.7.1 /usr/sbin/ntpdate -b -s -u ie.pool.ntp.org Next, you should clone the EE402 source code repository, as follows: root@beaglebone:~# cd ~/ root@beaglebone:~# git clone https://github.com/derekmolloy/ee402.git Cloning into 'ee402'... remote: Counting objects: 276, done. remote: Total 276 (delta 0), reused 0 (delta 0) Receiving objects: 100% (276/276), 726.80 KiB | 248 KiB/s, done. Resolving deltas: 100% (96/96), done.
root@beaglebone:~# cd ee402/
root@beaglebone:~/ee402# ls LEDcpp LICENSE notes_examples testcpp tmp36 LEDjava README.md scripts testjava ... BeagleBone Only Step 2. Using the BeagleBone User LEDsFollow the guide at: https://sites.google.com/site/derekmolloyee402/home/embedded-linux/flashing-the-leds-using-c You can access the code for this guide in the ee402 repository directory as follows: root@beaglebone:~# cd ~/ee402 root@beaglebone:~/ee402# cd LEDcpp/ root@beaglebone:~/ee402/LEDcpp# ls -al total 32 drwxr-xr-x 2 root root 4096 Nov 17 15:58 . drwxr-xr-x 10 root root 4096 Nov 17 15:59 .. -rwxr-xr-x 1 root root 124 Nov 17 15:58 build -rwxr-xr-x 1 root root 13955 Nov 17 15:58 makeLED -rw-r--r-- 1 root root 1834 Nov 17 15:58 makeLED.cpp root@beaglebone:~/ee402/LEDcpp# ./build EE402 - Building the Test LED program on the Beaglebone Black Finished root@beaglebone:~/ee402/LEDcpp# ./makeLED flash Starting the LED flash program The LED Path is: /sys/class/leds/beaglebone:green:usr0 Finished the LED flash program root@beaglebone:~/ee402/LEDcpp# ./makeLED off Starting the LED flash program The LED Path is: /sys/class/leds/beaglebone:green:usr0 Finished the LED flash program There is a Java version of this code in ~/ee402/LEDjava but leave it alone for the moment. Please note that to control the RPi LEDs use the path /sys/class/leds/ and then the name of the led that you wish to control. BeagleBone Only Step 3. Installing Java on the BeagleBonehttps://sites.google.com/site/derekmolloyee402/home/embedded-linux/flashing-the-leds-using-java Use the same steps in this video and download the Java SE 8 version for Linux ARM 32 Hard Float ABI, which is available at the link: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html Transfer the downloaded gz file to the BBB using the steps in the video to install Java 7 and the steps below this describe the settings required for Java 8. Figure 1 illustrates my FTP screen for the latest version of Java and the commands I used to transfer the file to the BBB using psftp. The installation of PuTTY that is described in the video is the reason that I have a psftp command. Now, test that the version of Java is working correctly: root@beaglebone:/usr/java# ls ejdk1.8.0_06 root@beaglebone:/usr/java# cd ejdk1.8.0_06/ root@beaglebone:/usr/java/ejdk1.8.0_06# cd linux_arm_vfp_hflt/ root@beaglebone:/usr/java/ejdk1.8.0_06/linux_arm_vfp_hflt# cd jre/bin root@beaglebone:/usr/java/ejdk1.8.0_06/linux_arm_vfp_hflt/jre/bin# ls java keytool pack200 rmid servertool unpack200 jjs orbd policytool rmiregistry tnameserv root@beaglebone:/usr/java/ejdk1.8.0_06/linux_arm_vfp_hflt/jre/bin# ./java -version java version "1.8.0_06" Java(TM) SE Embedded Runtime Environment (build 1.8.0_06-b23) Java HotSpot(TM) Embedded Client VM (build 25.6-b23, mixed mode) Next, you need to add two environment variables so that the JRE can be found in your PATH and so that the JRE will be able to find the location of its installation files, JAVA_HOME, which contains the runtime libraries (note: you can use the Tab key to auto-complete): root@beaglebone:# export PATH=$PATH:/usr/java/ejdk1.8.0_06/linux_arm_vfp_hflt/jre/bin root@beaglebone:# export JAVA_HOME=/usr/java/ejdk1.8.0_06/linux_arm_vfp_hflt/jre root@beaglebone:/usr/java# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/java/ejdk1.8.0_06/linux_arm_vfp_hflt/jre/bin root@beaglebone:/usr/java# echo $JAVA_HOME /usr/java/ejdk1.8.0_06/linux_arm_vfp_hflt/jre
Now, Java works from any point on your BBB using these environment variables. Add the lines: export PATH=$PATH:/usr/java/ejdk1.8.0_06/linux_arm_vfp_hflt/jre/bin export JAVA_HOME=/usr/java/ejdk1.8.0_06/linux_arm_vfp_hflt/jre to your ~/.profile file by using nano. My ~/.profile file now looks like this (The source command allows you to reload the profile without having to log out and back in again): root@beaglebone:~# cd ~/ root@beaglebone:~# nano .profile root@beaglebone:~# more .profile # ~/.profile: executed by Bourne-compatible login shells. if [ "$BASH" ]; then if [ -f ~/.bashrc ]; then . ~/.bashrc fi fi mesg n export PATH=$PATH:/usr/java/ejdk1.8.0_06/linux_arm_vfp_hflt/jre/bin export JAVA_HOME=/usr/java/ejdk1.8.0_06/linux_arm_vfp_hflt/jre /sbin/route add default gw 192.168.7.1 /usr/sbin/ntpdate -b -s -u ie.pool.ntp.org
root@beaglebone:~# source ~/.profile SIOCADDRT: File exists root@beaglebone:~# java -version java version "1.8.0_06" Java(TM) SE Embedded Runtime Environment (build 1.8.0_06-b23) Java HotSpot(TM) Embedded Client VM (build 25.6-b23, mixed mode) BeagleBone Only Step 5. Testing the Java LED code on the BBBIf everything is working correctly, the Java LED example should now work from the code repository using the following steps (Please adapt the path for the RPi code): root@beaglebone:~# cd ~/ee402/ root@beaglebone:~/ee402# cd LEDjava root@beaglebone:~/ee402/LEDjava# ls README bin src root@beaglebone:~/ee402/LEDjava# cd bin root@beaglebone:~/ee402/LEDjava/bin# cd ee402/ root@beaglebone:~/ee402/LEDjava/bin/ee402# ls BasicLEDExample.class root@beaglebone:~/ee402/LEDjava/bin/ee402# cd .. root@beaglebone:~/ee402/LEDjava/bin# java ee402.BasicLEDExample On root@beaglebone:~/ee402/LEDjava/bin# java ee402.BasicLEDExample Off Raspberry Pi StepsRPi Only Step 1: Network Configuration and Source CodeYou need a network patch cable in order to complete these steps and one of the following configurations:
Please note that if everything goes wrong, you can connect the RPi to a monitor and keyboard and boot it as a regular PC. You can then change the network settings using the GUI tools. In the second case you need to share your wireless network adapter. Use START->Network and Sharing Center->Change Adapter Settings->Right-Click your Wi-Fi adapter -> Properties then click on the Sharing tab and check the two boxes "Allow other network users to connect..." and "Allow other network users to control...". Reboot the RPi. At this point you should be able to:
pi@raspberrypi: $ cd ~/ pi@raspberrypi: $ git clone https://github.com/derekmolloy/ee402.git Cloning into 'ee402'... remote: Counting objects: 276, done. remote: Total 276 (delta 0), reused 0 (delta 0) Receiving objects: 100% (276/276), 726.80 KiB | 248 KiB/s, done. Resolving deltas: 100% (96/96), done.
pi@raspberrypi: $ cd ee402/
pi@raspberrypi: /ee402$ ls LEDcpp LICENSE notes_examples testcpp tmp36 LEDjava README.md scripts testjava ...
RPi Only Step 2. Using the User LEDYou can access the code for this guide in the ee402 repository directory to see how the same thing is achieved on the BeagleBone (as above). Everything is the same except that the path is different. The path is /sys/class/leds/led0. RPi Only Step 3. Installing JavaJava is installed on the default Raspbian image as standard. Equipment for the Assignment.No external sensors or wiring required. You can use the CPU temperature as the sensor input for this assignment. On the RPi the CPU temperature of the board is available at the location: /sys/class/thermal/thermal_zone0/temp For example, to measure the CPU temperature you can read the value as follows:
On the BeagleBone the CPU temperature is available at: /sys/class/hwmon/hwmon0/device/temp1_input If this file entry is not available on your BeagleBone (this will happen if you have installed the latest image) then please use the CPU utilization instead of the CPU temperature for your assignment. You can do this by reading the first line of the file /proc/stat, which will look something like: root@beaglebone:/sys# more /proc/stat cpu 3270 0 2974 46877 268 0 68 0 0 0 ... You do have to do a small amount of coding to get the CPU utilization:
So, in my example above, the cpu utilization is: 12.31% (i.e., 100 x (1 - (46877 / (3270 + 2974 + 46877 + 268 + 68)))) The Embedded Linux Client/Server Temperature Graphing Service In this assignment you should build a temperature sensor client/server application, where the embedded SBC reads the CPU core temperature from a file system entry and sends the data to a desktop computer client, which displays the data in a graphical form. The PC Temperature Graphical ClientIn this application the desktop PC is the graphical temperature client. It connects to the server port on the BBB/RPi boards. The server application executes on the BBB/RPi (as below) and it will provide temperature data (or CPU utilization data) to the client on the PC. The client will then display the data in a full-featured Graphical User Interface (GUI). The PC Temperature client should have the following features:
Remember that the server can connect to multiple clients at the same time so design your client/server appropriately. For example,
The RPi/BBB Embedded Linux Temperature Server In this application the server application should run on the embedded device (Beaglebone/RPi etc.) The server should have the following features:
Code Provided!I have provided you with template code and it MUST BE USED AS THE BASIS OF YOUR SOLUTION. Do *not* use RMI or any other Java Messaging Protocols, only use the template code provided for network communication. This code is available on the web page: Marking You will receive marks for implementing the features above. You will gain marks for making the server threaded, using Swing, for sending suitable messaging objects and for a working solution. You will gain marks for novel/extra features as outlined in the specification. The assignment is worth 15% of your final result. The marks will be broken down into Design, Implementation/Coding and Documentation:
Submission Instructions
Submit the assignment to: https://loop.dcu.ie/mod/assign/view.php?id=1153224 I will discuss the assignment in more detail over the next few weeks. But please start working through the Java notes, particularly in relation to the user interfaces sections. Yes, it likely sounds difficult but you will get through it. I will be giving out additional hints and tips on how to complete this assignment during the coming lectures. Good luck! Derek. |