Showing posts with label Construction. Show all posts
Showing posts with label Construction. Show all posts

Wednesday, March 30, 2011

code

 Servo Motor Control= code used to test if the motor worked and try to get the motor
spin in the way i wanted it to  
int servoPin = 2;     // Control pin for servo motor
 int minPulse = 500;   // Minimum servo position
 int maxPulse = 2500;  // Maximum servo position
 int pulse = 0;        // Amount to pulse the servo

 long lastPulse = 0;    // the time in milliseconds of the last pulse
 int refreshTime = 20; // the time needed in between pulses

 int analogValue = 0;  // the value returned from the analog sensor
 int analogPin = 0;    // the analog pin that the sensor's on

 void setup() {
  pinMode(servoPin, OUTPUT);  // Set servo pin as an output pin
  pulse = minPulse;           // Set the motor position value to the minimum
  Serial.begin(9600);
 }

 void loop() {
  analogValue = analogRead(analogPin); 
pulse = map(analogValue,0,1023,minPulse,maxPulse);   
// pulse the servo again if rhe refresh time (20 ms) have passed:
  if (millis() - lastPulse >= refreshTime) {
    digitalWrite(servoPin, HIGH);   // Turn the motor on
    delayMicroseconds(pulse);       // Length of the pulse sets the motor position
    digitalWrite(servoPin, LOW);    // Turn the motor off
    lastPulse = millis();           // save the time of the last pulse
  }
 }
led and relays= simple code that tells the microcomputer to send a change in current that turns on and off the different leds and relays    
;    // pin that the sensor is attached to
const int ledPin = 7;       // pin that the LED is attached to
void setup() {
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(3, INPUT);
}
 
void loop() {
    digitalWrite(ledPin, HIGH);
    delay(10000);
    digitalWrite(ledPin,LOW);
   delay(10000);
  }
Coin Sensor= code that used to test the coin sensor and a light attached to it
int inputPin = 3;    // pin that the sensor is attached to
int ledPin = 7;       // pin that the LED is attached to
int val = 0; // variable for reading the pin status
int prevState = 0;
void setup() {
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(inputPin, INPUT);
}
 
void loop() {
prevState = val;
val = digitalRead(inputPin); // read input value
if (val != prevState) {
if (val == HIGH) { // check if the input is HIGH
digitalWrite(ledPin, HIGH);
delay(10000);
} else {
digitalWrite(ledPin, LOW);
}
}
}
Tilt sensor=  code to test tilt sensor with an led attached to it
const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);    
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);    
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {    
    // turn LED on:    
    digitalWrite(ledPin, HIGH);
  }
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}

Construction 3

The Plug attached to the box with the valve plugged into it

The Wiring of the relays to the pump

The valve system

Pipes where the fluids travel to the valves

Pipe where the fluid leaves the valve

Wires for the valve and the power supply

The relay circuit with the power supply

Close up of the circut

The micro-controller

The power supply

The dispenser area

The tanks in the machine

The Coin Sensor

The motor to start the process

The tilt switch

One led at the end of the track

The first connection

The second connection

Wednesday, January 19, 2011

Construction 2

This is another view giving us a better view of the fuses attached to the power supply. The fuses are another line of defense for when the power supply goes out of whack. They will blow out if you start to get shocked by the power supply.
 This is me soldering a relay to a wire so I can connect it to the relay circuit that I am building. A relay is an automatic electronic switch that turns on and of the power of larger power sources.   
This is me during the construction of the relay circuit using different resistors. The two resisters on the screen are 1k ohm resister and a 10k ohm resister.  
This is the electrical schematic for the relay circuit that I'm using to construct the relay circuit. I created this drawing in the electrical program eagle. This program is used to make proto-boards which are the silicon chips in things like a vcr.
This is my second relay that I soldered. the difference between this relay and my other relay is that this one is single thrust double pole. 
This is my first relay. This relay is single thrust single pole. This relay is made to handle bigger power sources like a juicer or a high power light source.
 This is one of my electronic valves. To control these valves I am using the relay because the micro-controller is two weak to control the valve.
This is one of my tanks that I am using to store the drinking water before the user decides to drink the lemonade out of the cup. The whole in the bottom attaches to the black cylinder attached to the valve.
This is me working on my relay circuits. You can see the static control band on the ground near the left corner of the picture.

Sunday, January 16, 2011

Construction


 This is my work station and the where all of the electrical part of my project gets done. Many of the parts on this bench are crucial to the final construction of this project. for example without the variable temperature Soldering iron i would not be able to complete the final project. 
This is the PowerStation for the project. More than half of the different parts retrieve its power from this part of the machine. It supplies current at twelve volts, negative twelve volts, five volts, negative five volts, and three point three volts. The red light on the top tells if it is on and the green light on the bottom tells if the plugs are on.
This is the back of the power supply which cools the entire power supply. You can see one of the power switches and fan. You can also see the plug which has an adapter which plugs right into the wall.

This is the Gfi plug which is possibly the most important part to the project. The reason that it is so important is because it prevents any one from getting electotued when using the machine. The second reason it is important is because it stops part from destroying themselves by cutting the electric current.





This is the wiring of the power supply with the different wires going to the different voltage outputs. The wires also attach to the lights in the front and the switches that control the machine.
This is the inside of the power supply. When looking in the first thing you see is the large metal plate the sits in the center of the screen. This is a heat sink that prevents the object from overheating. This combined with the fan prevents the machine from ever overheating. This is one of the most dangerous parts of the project because the capacitors can kill you. They can hold a charge for over 24 hours with put being plugged in so that makes them very dangerous.
This is a picture of the transformer. It is there to supply power to the electronic water valves. It converts the power from the gfi into power for the valves. This part is also very dangerous because one touch from the wires and next thing you know you will be be flat on your back unconscious or dead.