3 Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can detect if a switch is on or off. Digital Output: The interface device can change an electrical signal to on or off and therefore turn on motors, lights, etc.
4 Analog Input: The interface device can detect a continuously changing electrical voltage coming from sensors which may be responding to changing parameters such as light, sound, liquid levels in tanks, etc. The changing voltage levels are changed to digital numbers to be manipulated and stored in the computer. ( done by ADC) Analog Output: The interface device can take a series of stored digital numbers and change them into a varying electrical voltage. This voltage can be used to control an external device. (done by DAC)
6 The Simplest Circuit The simplest circuit consists of: A source of electrical currentA conducting pathA control element (Switch)Something that converts electrical energy to some other form of energy (called a load resistance)See Mims, pp 14,18-25
9 There are a number of electrical parameters (measurements) that are of importance. The 3 most basic are:Electric Potential Difference - measured in VoltsElectric Current - measured in AmperesResistance - measured in Ohms
10 Electric Potential Difference can be very loosely defined as the “electric pressure” which forces electric current through a conductorElectric Current is the flow of electric charge through a conductor in a unit of timeResistance is the opposition to the flow of current through the conductor
11 1/Rt = 1/R1 + 1/R2…(parallel) The relationship is expressed as Ohm’s LawV= I * RRt = R1 + R2…. (series)1/Rt = 1/R1 + 1/R2…(parallel)
19 Servos do not have a continuous supply of voltage given to them Servos do not have a continuous supply of voltage given to them. Instead, they are supplied with electricity using Pulse Width Modulation. What does this mean?? There are a series of pulses sent to the motor controller which judges how much you want the motor to turn and this causes the shaft to turn that amount.
20 Servo Motor ControlThe DC motor is connected to a set of gears which reduces speed and increases torque or the force of the turn.There is a control circuit which controls how much the motor turns.The position sensor is a variable resistor or potentiometer which is responsible for sensing the position of the motor.
21 Servo Motor ControlThe position of the motor is monitored by the potentiometer sensor. If the motor is not in the position as sent by the external servo controller, the internal control circuit causes the motor to turn until it is. When the motor is in the correct position, the sensor signals the control circuit to turn the motor off.The process of the sensor sending information to the control electronics which turns the motor which turns the sensor is called feedback or a closed loop control circuit.How does the potentiometer sensor know when the motor is in the correct position??
22 Servo Motor ControlEach position of the servo is referenced by an internal control circuit pulse. 0 degrees is 1ms, 90 degrees is 1.5 ms and 180 degrees is 2 ms. When the external pulse is issued by the controller, it is issued in milliseconds as well.The internal circuit compares the external pulse to the internal and starts turning the motor. As the motor turns, the internal pulse changes relative to the position. When the difference in the two pulses is zero, the motor will stop turning.The difference in pulses is called the error signal.If the incoming pulse is greater than the internal pulse, it turns in the clockwise. If it is smaller, it turns counter-clockwise.
23 Referencing the Phidgets Install the Phidget Library on the computerBefore you can use Phidget code in Visual Basic the library must be referencedOpen the Project menu and select References. Scroll down and select Phidget Library by clicking the check box.
24 Declaring the Phidgets In General...Declarations enter the following code:Dim WithEvents MyPhidgetName As PhidgetDeviceNote: MyPhidgetName is called an instance of the class of objects called PhidgetDevice You can use any name as long as it is not a Visual Basic reserved word.
25 Opening the Phidget Code the Form_Load procedure: Set MyPhidgetName = New PhidgetDeviceCall MyPhidgetName.Open(True, -1)Call MyPhidgetName.Open
26 Servo Motor Control Phidget Code Example Assuming the Phidget library is installed and referenced in this Visual Basic application.Declare a variable of PhidgetServo type:Dim WithEvents Servo As PhidgetServoWe then have to instantiate that servo instance when we load our form:Set Servo = New PhidgetServo Call Servo.Open(True, xxxx)The Servo instance now exists and has a set of member functions which can be accessed using dot notation. One of these member functions is calledMotorPosition( n ) and is accessed by placing the dot between the instance of Servo and the member function.Servo.MotorPosition (n)The (n) is an index which represents which of the motors we are controlling at any given time. The servo controller can control up to four motors. The first is powered by the +5 v supplied by the USB cable. The other three are powered by the power supply attached to the device. Each device is independent of the other and can be assigned a degree value between 0 and 180.