Class Attendance Bot
Overview
The project was to create a device that would replace the need to go to class. The final project was a non-autonomous tool that could be controlled by someone not present in the class.
A webcam on the device provides one way communication with a remote device to provide the ability to see and hear what the teacher is talking about and displaying at the front of class. A smartphone app provides remote clicker functionality, giving the user the ability to answer questions from outside of class. A speaker is also attached which provides the ability to declare its presence on command from the smartphone app, to appear as if something is present when their name is called in roll call.
Team Members
- Jung Hun Kim
- Jonathan Jones
- Brandon Smith
- Scott St. Martin
Functionality
To provide stable network communications (for Skype and controlling the mbed actions with a smartphone) a portable x86 box is required to connect to the mbed device. The remote user communicates with a server which the x86 box is constantly listening for change on. Any requests are then sent via serial communications from the x86 box to the mbed device. The x86 box also provides a platform for Skype since the mbed device can't run Skype.
In order to remotely control the clicker with the mbed, it was necessary to tear apart the clicker in order to probe the buttons on the device. A mechanical relay bank was used to accurately power the clicker without the need of an external power supply, thus minimizing the amount of another power supply.
Depending on the clicker interfacing with the mbed, a different wiring setup may be necessary and changes to the code may be needed to make sure everything works correctly.
Video Demo
Components Used
- mbed LPC1768
- x86 computer
- Smartphone
- USB Webcam
- Hacked Clicker
- Mechanical Relay Bank (for clicker)
- mbed Speaker
Wiring
Note that wiring will vary greatly depending on which clicker you use.
This should just be used as lose guidelines to get you started.
mbed | Clicker | Speaker | x86 Box | Web Cam |
p6 | Power | |||
p25 | Send | |||
p26 | A | |||
p27 | B | |||
p28 | C | |||
p29 | D | |||
p30 | E | |||
p17 | * | |||
p18 | + | |||
gnd | - | |||
USB Serial | USB Port | |||
USB Port | USB Connection |
- This was used to monitor the voltage levels of the clicker
Pictures
Snippets of Code
main.cpp
example of clicker code
// if clicker's voltage level has changed significantly... if ( abs(pwr_level_new - pwr_level) > 20000) { // settling time while ( abs(pwr_level_new - pwr_status.read_u16()) > 32 ) { // wait until the analog input settles to a steady state reading pwr_level_new = pwr_status.read_u16(); wait(0.1); } if (pwr_level_new < pwr_level) // device is shutting down { dev_power = OFF; } else if (pwr_level_new > pwr_level) // device is turning on { confirm_on(pwr_status); // wait for voltage levels to settle to steady value when powering up wait(POWER_UP_TIME); dev_power = ON; } // update the power level reading pwr_level = pwr_level_new; pc.printf(" Device power status updated. New status: %s\r\n", dev_power == ON ? "ON": "OFF"); }
Program.cs
example of communication with server
WebClient Client = new WebClient(); Client.DownloadFile("http://104.131.69.134/commands.txt", "commands.txt"); string[] commandsInit = File.ReadAllLines("commands.txt"); string oldLastCommand = commandsInit[commandsInit.Length - 1]; while (true) { Client.DownloadFile("http://104.131.69.134/commands.txt", "commands.txt"); string[] commands = File.ReadAllLines("commands.txt"); string newLastCommand = commands[commands.Length - 1]; if(newLastCommand == oldLastCommand){ System.Threading.Thread.Sleep(1000); continue; } else{ oldLastCommand = newLastCommand; string[] splitCommand = newLastCommand.Split(','); Console.WriteLine("\n========================= {0}", DateTime.Now.ToString("hh:mm:ss tt")); Console.WriteLine(splitCommand[1]); _serialPort.WriteLine(splitCommand[1]); try { string message = _serialPort.ReadLine(); Console.WriteLine(message); } catch (System.TimeoutException e) { Console.WriteLine(" mbed did not respond ({0}).", e.Message); } System.Threading.Thread.Sleep(500); } }
Program
mbed code:
Import libraryAttendance Bot 5000
Hacking into the iClicker2 for adding remote access abilities. http://www.amazon.com/I-Clicker-2-I-CLICKER/dp/1429280476
Note: we used the "Speaker.h" file found from this page:
http://developer.mbed.org/users/4180_1/notebook/using-a-speaker-for-audio-output/
x86 code:
https://github.com/jjones646/AttendanceBot5000
Please log in to post comments.