Giter VIP home page Giter VIP logo

attentionmeter's Introduction

AttentionMeter

This is the course project for UofM COMP4720, Fall 2011

Authors

  • Kyle Kaufmann
  • Brian Turchyn

Requirements:

  • Netbeans
  • SunSpot SDK

To install:

  • Load project into NetBeans
  • Connect SunSpot
  • Right-click on project and select Build “Project + Deploy To SunSPOT”

Project Information

The software is designed to collect a value between 0 and 8 via the button controls (which should represent the attention level of the user). Every 5 seconds, the SPOT broadcasts its current value on port 42.

Data is collected from other broadcasted SPOTs. This value is stored in the AttentionHistory class, which houses a Vector of AttentionLevel objects, along with a number of utility methods related to that data (including average calculation, checking if the value is already there, etc).

Data is sent as a series of three writes to a datagram, sending off the device ID, attention level, and timestamp (in order). This information is re-sent every 5 seconds, acting as both a value update and a keep-alive packet.

When data is received, it is assembled into an AttentionLevel object (upon confirming that the data is valid), which is simply a Java class that acts as a data object, neatly grouping the three pieces of information we need to store: device ID, attention level, and the transmission date from the perspective of the original sender. The data is checked to see if it has already been received before by looking in the AttentionHistory instance. If it has been received, the data is ignored. If it has not, the data is inserted into AttentionHistory if no existing value for that SPOT ID has been received, or if the SPOT already has a value in the history, that value has been updated. Whenever the AttentionHistory is updated, a new average is calculated and stored.

The AttentionHistory class is a wrapper around a Vector object, used for storing a history of previously sent attention levels. Included in the class is a thread that wakes up on a regular basis, and cleans the Vector of any objects that are older than 20 seconds. Based on what was agreed upon, we working under the assumption that the user is no longer transmitting after 20 seconds, and they should no longer be factored into the average. The average is calculated simply by summing up the values of all the stored values and dividing by the number of entries in the AttentionHistory instance. Since no device can have more than one entry, we can safely use this number. The result is cached elsewhere for the LED updates, and the value is updated when a change to the history occurs (insert, update, delete)

The LEDs flash approximately every 4.5 seconds for 0.5 seconds to show the current average of all the collected values. The display will then go back to the value of the SPOT itself.

When shook across the Y axis (top-to-bottom), the SPOT will begin the ‘stress test’ action, which will saturate the network with 100 packets with random IDs and the value that is currently on the SPOT. Two white flashes denote the start of this, and another two denote the end of this (not including the hard-coded 5 second cooldown to avoid abuse). This was implemented to properly test out how the software would handle extremely large numbers of clients connected to the network without actually having access to 100+ SPOTs.

attentionmeter's People

Contributors

b-turchyn avatar kylekaufmann avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.