garage door open program

Our group had to write a program for a garage door. we are working as a team. Our team had to write the car approachaway part with the instructions below. After everyone is done we had to combine all our classes in a main function. I was wandering if any of you could look at it and help our group.....


Group: CarApproachAway

- Create a class/ object GarageIn1 that inherits from class Component
o class CarApproachAway _Sensor : public Component
- Implement the following methods:
o CarApproachAway ()
o displayResistors()
o RetrieveState(Component GarOpenSys, String Name)
o SetMyState(Component GarOpenSys, String myName, myState)
o Execute()
o getCarPosition()
o setCarState()

The Controler (CTRL) gets a 9V input and the motor gets a 12V input. All sensors shown above are wired to the controller that in turns feeds them a 5V input. The CRTL receives a signal from each sensor when a car (motion) is detected (GarageIn1, GarageIn2, CarApproachAway), and when the tip of the garage door is detected (GarageDoorDown, GarageDoorUp). The motor simply checks a flag at the CTRL level to determine whether to roll the garage door up, down, or to stop. Each sensor may also interrogate the CTRL to determine the state of any other component.

Let’s say we used the Arduino One micro controller (CTRL) CTRL, and PIR motion sensors. The Arduino board provides 5V dc to all sensors via the onboard regulated power supply.
PIR or Passive Infrared is a common method of motion detection that measure changes in heat to signal the change. The basic model is that they take IR (heat) images on 2 sensors at different times, when they differ, they know something has changed. The basic diagram of a sensor is provided below, where VIR is the signal when motion is detected. For this project, the R is the equivalent resistor for the accompanying resistor assembly. R1 = 34.5, R2 = 25, R3 = 2.5 , R4 = 15, R5 = 5, R6 = 5. This circuit, R, is activated whenever motion is detected.

One must first compute the total resistance (RT) that the voltage source sees to compute the total current going through the circuit. Then use the current divider technique to compute the current through each of the resistors. Finally, the voltage of each resistor may also be computed.

The circuit designer can set the total resistance by a judicious selection of a few resistors.
However, the circuit designer must be aware of the risks when using resistors in a circuit.
Resistors are designed to disrupt the flow of charges through it. Heat is dissipated from the friction caused by the movement of these charges. Too much heat will cause the resistor to fail.
The formula for computing the power (in Watts) dissipated by the resistor is P = V2 /R where V is the applied voltage (in Volts) across the resistor and R is the resistor's resistance (in Ohms).

Resistor manufacturers rate resistors based on their nominal resistance, percent tolerance, and maximum dissipated power. The resistors nominal resistance (or the resistance value indicated/ provided) and tolerance is used to determine its minimum and maximum resistance. That is, the manufacturer will guarantee that resistor’s resistance will always fall within the range defined by the minimum (RMIN) and maximum (RMAX) resistances:
RMIN = RNOM x (1 – Tol)
RMAX = RNOM x (1 + Tol)
Where Tol is the percent tolerance. The circuit designer should use resistors in accordance to its recommended ratings.

The motor is simulated by a stepper motor. A basic circuit for the stepper motor is provided below where S1 defines the direction of rotation of the motor, the STEP pin expects a pulsed signal to drive the motor. One may implement such component by putting together the elements indicated.

Topic archived. No new replies allowed.