Archive for March, 2009
Mouse Pad documentation second part (a few weeks after the piece is done)
Here is the second part of the documentation. It shows you the up and down of the project. We have photos of h bridges, dc motors relays and mouse hacking. We learn a lot about serial communication, dc motors, relays, and the most important how to work in group.
Below is the code we finally use:
// Analog Sensors
int analogOne = 0; // Left moving Sensor
int analogTwo = 1; // Up moving Sensor
int analogThree = 2; // Right moving Sensor
int analogFour = 3; // Down moving Sensor
// Digital sensors
int digitalOne = 12; // Left Mouse Click
int digitalTwo = 13; // Right Mouse Click
int relay1Pin = 2; // Relay for left click
int relay2Pin = 7; // Relay for right click
int leftClick = 0; //variable for the left click
int rightClick = 0; //variable for the right click
// For motor # 1
int motor1Pin = 10; // H-bridge leg 1 (pin 2, 1A)
int motor2Pin = 11; // H-bridge leg 2 (pin 7, 2A)
// For motor # 2
int motor3Pin = 5; // H-bridge leg 3? (pin ??, 1A)
int motor4Pin = 6; // H-bridge leg 4? (pin ??, 2A)
// Pin “9”
int enablePin = 9; // H-bridge enable pin
int enablePin2 = 8; // H-bridge enable pin2
int sensorValue = 0; // reading from the sensor
void setup() {
Serial.begin(9600);
pinMode(digitalOne, INPUT);
pinMode(digitalTwo, INPUT);
pinMode(relay1Pin, OUTPUT);
pinMode(relay2Pin, OUTPUT);
pinMode(motor1Pin, OUTPUT);
pinMode(motor2Pin, OUTPUT);
pinMode(motor3Pin, OUTPUT);
pinMode(motor4Pin, OUTPUT);
pinMode(enablePin, OUTPUT);
digitalWrite(enablePin, HIGH);
pinMode(enablePin2, OUTPUT);
digitalWrite(enablePin2, HIGH);
}
void loop() {
if (analogRead(analogOne) > 100) {
//turn left
analogWrite(motor1Pin, 0); // set leg 1 of the H-bridge low
analogWrite(motor2Pin, 96); // set leg 2 of the H-bridge high
}
else {
//turn right
if (analogRead(analogThree) > 100) {
analogWrite(motor1Pin, 96); // set leg 1 of the H-bridge low
analogWrite(motor2Pin, 0); // set leg 2 of the H-bridge high
}
else {
// dont move left or right
analogWrite(motor1Pin, 0); // set leg 1 of the H-bridge low
analogWrite(motor2Pin, 0); // set leg 2 of the H-bridge low
}
}
if (analogRead(analogTwo) > 100) {
// Go up
analogWrite(motor3Pin, 0); // set leg 3 of the H-bridge low
analogWrite(motor4Pin, 96); // set leg 4 of the H-bridge high
}
else {
// Go down
if (analogRead(analogFour) > 100) {
analogWrite(motor3Pin, 96); // set leg 3 of the H-bridge high
analogWrite(motor4Pin, 0); // set leg 4 of the H-bridge low
}
else {
// Dont go up or down
analogWrite(motor3Pin, 0); // set leg 3 of the H-bridge low
analogWrite(motor4Pin, 0); // set leg 4 of the H-bridge low
}
}
// Mouse Clicks
leftClick = digitalRead(digitalOne);
if (leftClick > 0) {
digitalWrite(relay1Pin, HIGH); // Turn on relay 1
}
else {
digitalWrite(relay1Pin, LOW); // Turn off relay 1
}
rightClick = digitalRead(digitalTwo);
if (rightClick > 0) {
digitalWrite(relay2Pin, HIGH); // Turn on relay 2
}
else {
digitalWrite(relay2Pin, LOW); // Turn off relay 2
}
// Print the values to serial for monitoring
sensorValue = analogRead(analogOne);
Serial.print(sensorValue, DEC);
Serial.print(“,”);
sensorValue = analogRead(analogTwo);
Serial.print(sensorValue, DEC);
Serial.print(“,”);
sensorValue = analogRead(analogThree);
Serial.print(sensorValue, DEC);
Serial.print(“,”);
sensorValue = analogRead(analogFour);
Serial.print(sensorValue, DEC);
Serial.print(“,”);
sensorValue = digitalRead(digitalOne);
Serial.print(sensorValue, DEC);
Serial.print(“,”);
sensorValue = digitalRead(digitalTwo);
Serial.println(sensorValue, DEC);
}
Also Gordie made the second version of the housing of the mouse. This made the mouse pad more reliable. Below is the video
Our mousepad is working Hurray!!!!
Midterm 1st step and serial communication 2 week 6
We start working in our midterm idea we would like to create an interface for the computer. Our first idea it was to replace the keyboard in order to release the stress that we put in our wrist when we work in the computer. This piece was inspire by people who suffer of Carpal Tunnel Syndrome. Because we only have two weeks to complete this project we decide it to only imitate the mouse. Our final approach it was quite different that we thought. I will explain more soon.
The good news is that the serial communication lab that we have to do for this week was very helpfull to test all the sensors and understand visually the movement of the cursor using processing.
Bellow is step by step in our process. Ufff a lot hours of work 🙂
This is the photo documentation of the mat prototype:







This is all the 6 sensors working, 4 work as analogs and two digital. We look very happy
This is the documentation of the serial communication in processing
As I say before we took another different approach. We ore going to hack a mouse. The rotary tracks of the mouse inside are going to be connected to a dc motor and they will move them from one direction. We are going to have two of them. Bellow is Gordie working on it and the best part is working
Bellow is the call an response hand shake method, Gordie and Emily are the stars of this video

