Lab:Discrete and Continuous Sensing

From CS294-84 Spring 2013
Jump to: navigation, search


  • In this lab, you'll build a device that can emulate a mouse. The device should move your laptop's cursor on screen and send click events.
  • You'll test your device's performance using a Fitts' Law test.
  • Work in pairs.

Key Concepts: discrete and continuous input, mouse emulation, gathering experimental data


If your soldering skills are rusty, you must complete safety+technique training by our lab manager Mark Oehlberg. Always wear safety glasses when soldering.


Design the Device

  • Materials: Use any of the free materials in the prototyping cart. This can be a really rough prototype. You can also laser cut a case (e.g., with your box generator), but this level of detail is not necessary.
  • Hardware: We passed out Teensy 2.0 microcontrollers which have a built-in USB HID mode to appear as a mouse.
  • Constraints: We'd like you to design a device that a user can hold and operate in one hand, without the need of a support surface (table).
  • Sensors: Limit yourself to: discrete switches (e.g., tactile switches), force sensitive resistors, accelerometers, and flex sensors. The FSRs and flex sensors have to be connected with a voltage divider. The accelerometer outputs an analog voltage directly. You must use a continuous sensor (i.e., no direction keys). Don't just threshold the sensor into three regions either.
  • You need at least 1D continuous movement + click, but really should support 2D.

Mouse Emulation

There are two main ways to emulate mouse input:

  1. Send serial data to the PC, and there, control the system cursor through a system library, e.g., through java.awt.Robot in Java, or PyMouse in Python, or the Cursor class in .NET, etc.
  2. Use a microcontroller that can appear as a USB HID device to your laptop. The Teensy2.0 board with ATmega32u4 we have in stock supports this; Boarduino/Arduino UNO/etc. do not.


  • Run Bjoern's simple Fitts' law experiment - either in the browser, or download the Processing source code and run locally. Do this twice - once with your device, once with a mouse or your laptop's track pad. Graph the result: Create a scatterplot with ID on the x axis, time on the y axis. If Fitts' law holds, we expect this data to fit a linear regression line. This regression line will have the form y=a+bx or T=a+b*log(D/S+1).

Write Up


Your lab writeup is due on Friday Feb 8 by 5pm.

Turn in instructions

Create a Wiki Page for this assignment

Begin by creating a new wiki page for this assignment.

Edit your user page (click on your name in the top left) to add a link to a new wiki page for this assignment. The wiki syntax should look like this:

[[Lab2-LastName1LastName2|Lab 2]]

Replace LastName with your names. Look at my user page for an example. Then click on the link and enter the information about your assignment.

Write up your project on this wiki

On the Lab2-LastName1LastName2 page you just created, add the following content:

  • Include images (How to include images). At a minimum:
    • Sketch of how your device works
    • Photo of the assembled device
    • Images of the scatterplots of mouse and device test data
  • Submit your code - instructions soon
  • Written Reflection: how your device performed, and what (if anything) you learned from this assignment

One you are finished editing the page, add a link to it at the bottom of the page with your full name as the link text. The wiki syntax will look like this: *[[Lab2-LastName1LastName2|FirstName LastName1 and FirstName LastName2]]. Hit the edit button for the last section to see how I created the link for my name.

Turn in your code using the Class Revision Control System

We're still working to get the Class Revision Control System up and running. Check back soon for more information on how to check in your code.

Links to Finished Assignments

Add your submission below this line.