26
Sensing and Control

Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

Embed Size (px)

Citation preview

Page 1: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

Sensing and Control

Page 2: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

Digital or Analog

Digital or Analog

Page 3: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

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.

Page 4: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

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)

Page 5: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can
Page 6: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

The Simplest Circuit

The simplest circuit consists of: – A source of electrical current– A conducting path– A control element (Switch)– Something that converts electrical energy to

some other form of energy (called a load resistance)

– See Mims, pp 14,18-25

Page 7: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can
Page 8: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can
Page 9: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

There are a number of electrical parameters (measurements) that are of importance. The 3 most basic are:– Electric Potential Difference - measured in

Volts– Electric Current - measured in Amperes– Resistance - measured in Ohms

Page 10: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

Electric Potential Difference can be very loosely defined as the “electric pressure” which forces electric current through a conductor

Electric Current is the flow of electric charge through a conductor in a unit of time

Resistance is the opposition to the flow of current through the conductor

Page 11: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

The relationship is expressed as Ohm’s Law

V= I * R

Rt = R1 + R2…. (series)1/Rt = 1/R1 + 1/R2…(parallel)

Page 12: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

Pulse Width Modulation

Page 13: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

DC motors are often run at a constant speed.

Other uses require variable speed.

One of the most efficient methods of DC motor speed control is called Pulse Width Modulation

Page 14: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

• Pulses are simply on/off voltages.

• The length of time the voltage in on is the pulse width.

Page 15: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can
Page 16: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

• Cycle: a single pulse

• Period: Time to complete one cycle

• Duty Cycle: time on/length of cycle

• Frequency: number of cycles per second

Page 17: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

PhidgetLVMotor Controller

• Two independent low-voltage terminal blocks

• Uses PWM for motor control• 65 pulse steps (Code allows -100 to 100)• Frequency: 2.5KHz

• Lamp – Brightness• DC Motor - Torque

Page 18: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

Servo Motors

Page 19: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

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.

Page 20: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

Servo Motor Control

The 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.

Page 21: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

Servo Motor Control

The 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??

Page 22: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

Servo Motor Control

Each 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.

Page 23: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

Referencing the Phidgets

• Install the Phidget Library on the computer

• Before you can use Phidget code in Visual Basic the library must be referenced

Open the Project menu and select References.  Scroll down and select Phidget Library by clicking the check box.

Page 24: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

Declaring the Phidgets

In General...Declarations enter the following code:

Dim WithEvents MyPhidgetName As PhidgetDevice

Note: 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.

Page 25: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

Opening the Phidget

Code the Form_Load procedure:

Set MyPhidgetName = New PhidgetDevice

Call MyPhidgetName.Open(True, -1)

Call MyPhidgetName.Open

Page 26: Sensing and Control. Digital or Analog Digital Input: The interface device can detect a simple change in an electrical voltage level. That is, it can

Servo Motor Control Phidget Code ExampleAssuming the Phidget library is installed and referenced in this Visual Basic application.

Declare a variable of PhidgetServo type:

Dim WithEvents Servo As PhidgetServo

We 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 called

MotorPosition( 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.