Don't wanna be here? Send us removal request.
Text
Project 2 (Elephant and Mouse) Physical Computing
THE PITCH
The story of a cheerful mouse giving a puppet show
Elephant -
-Will be the head
-Moving trunk and ears
-Hat on its head covering up the mouse
Mouse -
-On the head of the elephant
-Moving arms so it can bow when it is reviled
-Looks as if it is controlling the elephant
Interactivity-
Motion sensor in front to see when a kid is in front of it. This activates the trunk to take off the hat, using an electromagnet, showing the mouse controlling the elephant Then the elephant puts the hat back on
THE PLAN -
We decided to split this project up into multiple
The elephant ears would be Jesse
the trunk would be Tim
the hat was Alex
and Jesse also had the mouses arms
TESTING
To get our servos running we found https://github.com/ArminJo/ServoEasing
this helped us a lot in the whole process. we started with the trunk and ears as they were very similar.
youtube
We also started to look at the mouse and how the arms could move. we found that rubber bands in arms was the best way to go. With the servos attached to the handles.
With a little over a week to go we finalized our plan of action
Wednesday night - basic wiring, testing motor movement outside of elephant shell. Complete build of Elephant shell.
Thursday from 6-9 add pieces of motors to elephant. attach trunk to elephant
friday 2pm-6pm. attaching the hat, ears, mouse.
Saturday - wiring. Testing movements inside elephant shell. Action button integration
Sunday - cosmetic refining. Final button placement. Troubleshoot/safety day (should the unexpected occur)
Monday - paint
Tuesday - Troubleshoot and finalize
Wednesday - Troubleshoot and finalize
Thursday - Troubleshoot and finalize
Friday - Load In
This worked really well for us as we were able to stay on scheduled.
CODE and WIRES -
For the programming, there where three major revisions of the code. The first was more of an experiment to see if the plan we had for the structure of the program would work the way we wanted it to. There was no major goal to get things fully working at this point, this was more of a proof of concept to show that we was moving in the right direction.
After finding that the initial plan was way over complicating things, we moved on to the second revision, this one much more closely resembled the final, but we found that there was an issue with using the servos how we wanted to. The issue being that we didn't quite understand how arduino sends out data to servos, so all of the servos were receiving what was essentially noise.
For the third and final revision, we had moved control of the servos to a library Tim found that was built to do exactly what we were trying to do, and then some. In this revision, the only thing that wasn't working perfectly was the hat movement, although we feel like the different attempts at getting it to function didn't constitute a major revision change, being as the core of the program stayed the same, or rather, because we didn't change the system for controlling the hat, only the logic.
The hat should have been one of the simplest parts of this project, and while in all reality it was, we were, as with much of this project, over complicating it for a very small amount of gain that would likely have gone unnoticed in the final product regardless. In the end, we decided to slightly reduce the requirements for what we wanted the hat to do, which ended up making the code much simpler to conceptualize, and allowed me to get to a working, show ready, state. All in all, we felt like we accomplished a vast majority of what we set out to do with this project, and feel like we delivered a solid product overall
Final code -
#include "ServoEasing.h"
//output pins int pinEarL = 2; int pinEarR = 3; int pinLeverL = 4; int pinLeverR = 5; int pinHat1 = 6; int pinHat2 = 7; int pinTrunk1 = 8; int pinTrunk2 = 9;
//input pins int pinButton = 12; bool button = false;
//data vars int hatPos = 0; int hatTimer = 0; long oldTime = 0; bool moveUp = false; bool moveDown = false; int hatMax = 300; //in frames, at 60, how long to let hat rise int hatDur = 900; //in frames, at 60, how long to keep hat up
ServoEasing servoEarL; ServoEasing servoEarR; ServoEasing servoLeverL; ServoEasing servoLeverR; ServoEasing servoTrunk1; ServoEasing servoTrunk2;
bool servoDir[] = {false, false, false, false, false, false};
void setup() { // put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Attaching Servos via ServoEasing"); servoEarL.attach(pinEarL); servoEarR.attach(pinEarR); servoLeverL.attach(pinLeverL); servoLeverR.attach(pinLeverR); servoTrunk1.attach(pinTrunk1); servoTrunk2.attach(pinTrunk2);
servoEarL.write(120); servoEarR.write(60); servoLeverL.write(90); servoLeverR.write(90); servoTrunk1.write(90); servoTrunk2.write(90);
pinMode(pinHat1, OUTPUT); pinMode(pinHat2, OUTPUT); pinMode(pinButton, INPUT);
//let everything move to start pos //moveHatUp(); //delay(3000); hatPos = 0; moveHatDown(); delay(4000); moveHatNone();
}
void loop() { // put your main code here, to run repeatedly:
//update hat //check button was hit button = digitalRead(pinButton);
if (millis() - oldTime > 1000 / 60) { oldTime = millis(); //Serial.println(button);
if(button){ Serial.println(hatPos); if(hatPos<80&&!moveDown){ moveHatUp(); moveUp = true; moveDown = false; } else{ moveUp = false; moveDown = true; moveHatDown(); } }
if(moveUp){ hatPos++; Serial.println("MOVING UP"); } if(moveDown){ hatPos--; Serial.println("MOVING down"); }
if(hatPos>80 || hatPos<= 0){ moveHatNone(); moveUp = moveDown = false; }
button = false; } /* //check button was pressed if (button){ hatTimer = 0; moveUp = (hatPos <= hatMax); } //check if it needs to down if(hatPos >= hatMax && hatTimer <= hatDur ){ moveUp = false; hatTimer++; } //move it up if (moveUp) { hatPos++; moveHatUp(); } else if(hatTimer >= hatDur && hatPos>=0){ //else move check that it needs to mvoe down hatPos--; moveHatDown(); } else //else don't move the hat moveHatNone();
//reset button check button = false; }
//this bit should actually work as intended //so that it doesn't go up as soon as the arudino activates starts if (hatMax - hatTimer < 0) { //check that hat doesn't move too far up moveHatUp(); } else if (hatDur + hatMax - hatTimer < 0 && hatDur + hatMax * 2 - hatTimer > -10) { //check that hat hasn't moved to far down moveHatDown(); } else moveHatNone();//so that actuator doesn't explode, 10 extra mills to make sure it goes all the way down is fine */ //moveHatUp(); //end hat movement
//All the servo movement
if (!servoEarL.isMoving()) { servoEarL.startEaseTo(servoDir[0] ? 115 : 135, random(10, 20)); servoDir[0] = !servoDir[0]; }
if (!servoLeverL.isMoving()) { servoLeverL.startEaseTo(servoDir[2] ? 80 : 95, random(10, 15)); servoDir[2] = !servoDir[2]; }
if (!servoEarR.isMoving()) { servoEarR.startEaseTo(servoDir[1] ? 80 : 60, random(10, 20)); servoDir[1] = !servoDir[1]; }
if (!servoLeverR.isMoving()) { servoLeverR.startEaseTo(servoDir[3] ? 100 : 85, random(10, 15)); servoDir[3] = !servoDir[3]; } //end ear and lever movement
if (!servoTrunk1.isMoving()) { servoTrunk1.startEaseTo(servoDir[3] ? 110 : 80, random(2, 10)); servoDir[4] = !servoDir[4]; }
if (!servoTrunk2.isMoving()) { servoTrunk1.startEaseTo(servoDir[3] ? 110 : 80, random(2, 10)); servoDir[5] = !servoDir[5]; }
}
void moveHatUp() { digitalWrite(pinHat1, HIGH); digitalWrite(pinHat2, LOW); }
void moveHatDown() { digitalWrite(pinHat1, LOW); digitalWrite(pinHat2, HIGH); }
//set both to low for safty :) void moveHatNone() { digitalWrite(pinHat1, LOW); digitalWrite(pinHat2, LOW); }
Final product-
With a lot of hard work we are very happy with the outcome.
There are things that we would have done differently but overall we think this was a success. The story behind the object is what really drove this home for many people and they loved the hidden mouse.
0 notes
Text
Project 1 (Automatic Creamer and Sugar Dispenser)
STEP 1 (Research and Development)
This product will be able to dispense powder creamer and sugar into a coffee cup. The main draw in this product will be to allow the user to select the amount of creamer and sugar that they want.
Target audience First and foremost this product is for me. It will also have the functionality for other using in the form of allowing them to select their optimal amount of sugar or creamer.
Understanding the problems 01 In the morning I do not function well until I have my coffee. I need to make sure I do not need to think before I have my first cup. 02 I commonly over pour the amount of sugar or creamer into my cup as I tend to rush this step. 03 Due to not being fully awake I tend to make a small mess when pouring out the sugar.
Design Concept
Overall layout of the Dispenser The goal is the have an intuitive design with an ergonomic layout.
Prototype 1:
For the first prototype I decided to only focus on sugar. I also found that the Archimedes screw would be very expensive and not meet the requirements of the project. For these reasons I decided to go with a flip funnel mechanism.
I also wrote a very simple code for this that utilized seconds for how long the flip stopper would be open so that you can have the perfect amount of sugar.
CODE :
#include <Servo.h>;
Servo myservo1; //Servo myservo2; //for when creamer device is added
int pos1 = 0; //int pos2 = 0; // for creamer servo
int buttonPin = 2; int buttonState = 0;
void setup() { Serial.begin(9600); myservo1.attach(9); //myservo2.attach(11); //activating pin 11 for creamer servo
pinMode(buttonPin , INPUT); }
void loop() { buttonState = digitalRead(buttonPin); Serial.println(buttonState);
if (buttonState == HIGH){
myservo1.write(10);
delay(1000);
myservo1.write(170);
delay(1000); }
}
youtube
0 notes
Text
Tilt-Switch
A tilt-switch is part of the the tilt sensor family. A tilt sensor is a device that can detect the tilting of an object. Inside most tilt sensor you will find a metallic ball that will travel between the two pins of the device (from one end to another) that turns a signal from on to off and viceversa if the sensor reaches a certain angle.
Bellow is a simple way to ad a tilt switch into a circuit.
As you can see when the tilt switch is tilted to the right angle the current is allowed to travel to the red LED and turns it on.
They are small, inexpensive, low-power and easy to use. If used properly, they will not wear out. Their simplicity makes them popular for toys, gadgets and appliances. Sometimes they are referred to as "mercury switches" or "rolling ball sensors".
Tilt switches are pretty hardy, you can easily solder to them, clip the leads, plug them into breadboards, use alligator clips, etc. The only care you should take is to avoid bending the leads too much as they may break off.
Bellow is how you would set up a arduino to read switch state.
1 note
·
View note