Presentation is loading. Please wait.

Presentation is loading. Please wait.

Center Grove High School Greenwood Indiana

Similar presentations


Presentation on theme: "Center Grove High School Greenwood Indiana"— Presentation transcript:

1 Center Grove High School Greenwood Indiana
Sensors 4 FRC Robots By Hugh Meyer Red Alert Robotics FRC Team 1741 Center Grove High School Greenwood Indiana October 5, 2013 Good morning! My name is Hugh Meyer. I am a mentor on team 1741 from the south side of Indianapolis Indiana. I work with the electronics and programming team. Today we will be talking about sensors for FRC robots.

2 Why Do We Need Sensors? Protect robot from self destruction
Protect robot from driver destruction Provide closed loop control Sense position Feedback for autonomous mode Limit range of motion Confirmation system is functioning properly Gives electrical team something to do To start out I would like to answer the question Why do we need sensors?

3 Mechanical Limit Switches
Lever or roller actuated Several sizes available VR7 is popular, easy to work with, inexpensive, supplied in kit of parts Simple to wire – connect red and black wires to NC and NO connections, connect white signal wire to the COM connection Orient the lever so it wipes across the cam – Avoid having the switch become your mechanical limit Mechanical switches are simple and easy to use. Just mount them to your mechanisms, wire them up and you are ready to go. It is important to orient the lever so it wipes across the cam. Be careful that you do not mount your switch in a way that it becomes a mechanical stop. You want the switch oriented so that if the mechanism, for whatever reason doesn’t stop, it will not damage the switch. In the photo you can see the cam lead in. Motion is parallel to the switch lever. If motion was perpendicular then the switch could easily be damaged.

4 Mechanical Limit Switches
Signal is on/off or true/false or 1/0 Connected to digital I/O on the Digital Side Car Software reads a one or zero Switch connections will be labeled The signal from a mechanical limit switch is simple. It is on or off. We call this a digital signal since it can be represented as a one or zero to the software.

5 Mechanical Limit Switches
Common Normally Closed Normally Open Common terminal is the output NO and NC would be ground and + 5 volts Most limit switches will be marked, but not always this clearly. Often it will just be labeled NO or NC. The common terminal toggles between the normally open and normally closed as the switch is activated.

6 Magnetic Reed Switches
High reliability – Reed contacts are sealed in a small glass cylinder Easy to wire – Connect one terminal to the black wire and the other to the white wire Used on Pneumatic cylinders, but the cylinder must be ordered with the magnetic ring option Magnet is the element in motion to be sensed by the reed switch Magnetic reed switches are the next step from mechanical switches. These offer the advantage of no mechanical contact, which gives higher reliability. This is very effective for use on air cylinders. You must order the cylinder with a magnet inside it for this to work.

7 Fixed Pressure Switch Used to control air compressor
Switch closes when pressure is below a predefined low limit value and opens when pressure is above a high limit value Simple to wire – Black and white wire connect to the switch A fixed pressure switch is used to control air pressure. This is plumbed to the high pressure side. It will connect to an input on the digital side car. The action is simple. When the pressure is below a predefined low limit the switch opens. When pressure is above a high limit the switch will open. The ones we use come preset to the correct value.

8 Pressure Transmitter Provides an analog or digital signal indicating the exact pressure Analog wiring is simplest – Black and red wires supply power to sensor and the white connects to the analog input Digital device will connect to a SPI, I2C, or serial port A pressure transmitter is more sophisticated in that it will read the actual pressure. These devices can connect to an analog input or digital input depending on the device type. The one in the photo is an analog device since it outputs 0-10 volts DC. This will allow a readout on the driver station to indicate the pressure in the system. This also could be logged for later review.

9 Push Buttons Momentary contact
Suggest connecting all three wires – Black and red to NC & NO contacts and white wire to the COM contact Available in many different sizes, shapes, color, and styles Driver station ultimate control Push buttons are great for driver station control input. These are normally momentary contact devices, but can be a toggle function. Wire this just like mechanical limit switches.

10 Toggle Switches Generally not momentary action – switch stays at position when released Available in many different contact arrangements FRC usage can generally use the simple SPDT (single pole double throw) Center off is available if appropriate Toggle switches are best for toggle, or on off functions or as selectors.

11 Quadrature Encoders Measures speed, distance, and position
Signal can return to the cRIO or Jaguar, or both Requires two digital inputs if you want directional information and highest resolution Signals are 90 degrees out of phase Quadrature encoders can be used to measure speed, distance and position. These can be wired back to either the cRIO, a Jaguar, or both, depending on your application. If you want directional information then you will connect two signal from this device. The output is a square wave and the two signals should be 90 degrees out of phase.

12 Quadrature Encoders Different sizes available Several styles available
Kit of parts encoders must be installed carefully Encoder disk must be correct distance from optical element Need oscilloscope to verify correct operation This chart shows the waveform. You see the signal A leading edge is followed latter by the signal B leading edge. This relationship is very important for the encoder to work properly. The only way to know if this is right is with an oscilloscope. The device must be installed properly. The disk must be set the correct distance from the sensor. Run out and end play of the shaft must be minimal. Another important point to know is that there are different sensor based for different line count wheels. You can not simply change the wheel for a different line count. The sensor base must be correctly paired with the wheel. If not, then the 90 degree phase relationship will not be maintained and you wont get good data.

13 Quadrature Encoders Available in different resolutions
The line count specifies the resolution Higher count gives the I and D components of PID faster information for better response Lower count is more tolerant of alignment errors Several functions in WPILib are available depending if you want speed or distance Incremental device – If you want absolute position then you need to home the system, or always start from a known position These encoders are available in different resolutions. The line count specifies the resolution. For FRC usage we like to use either 360, 250, or 100 line units. The kit of parts supplied this year were 250 lines If the axle is moving slow and we want high resolution we will use the 360 units. If it is fast, like a shooter wheel we will use the 100 count wheels. For medium speed shafts like the drive train we will use the 250 count wheels. The higher count units will give the I and D components of PID faster information for better response. Lower count units will be more tolerant of alignment and shaft run out issues. There are several functions in the WPI library for reading these depending if you want speed or position. This is an incremental device, meaning any count is relative to some starting position….so if you need absolute position, which we usually do, you must have a homing system, or always start from a know position. We tend to prefer the homing sequence since that is more automatic.

14 Potentiometer Absolute Encoder
Always know where you are Standard pot supports up to 270 degrees of rotation Multi-turn pots can support more than one rotation Home switch and sequence not required Analog voltage output is proportional to position Black and red wires go to outer connections on pot Signal comes from the wiper terminal Potentiometers are good for absolute position control. No homing sequence needed. You will get an analog voltage out of the device. To wire this sensor you just connect the 5 volts across the resistor element and the wiper is the output signal. Single turn pots would be good for about 270 degrees of motion. There are multi-turn pots that will give more range. Range of motion must be limited by end of travel switched, or the pots will be damages if the system tries to move beyond the range of the device.

15 Absolute Magnetic Shaft Encoder
Similar to a single turn pot, but allows full 360 degree rotation with no stops Available with an analog or a pulse width modulated digital output Output signal is proportional to the absolute shaft position Different bearing configurations are offered Can be used as operator control as well as sensor on robot Connected to analog bumper on analog I/O module Absolute magnetic shaft encoders are similar to single turn pots, but allows a full 360 degrees of rotation. Output signal can be different formats, analog or digital depending on the device. Different bearing options are available which is good if your motion is fast. These can also be used for operator control input devices on a driver station.

16 Rotary Magnetic Encoder
No mechanical contact Accurate alignment is important Data sheet is on KOP webpage Several IO options Rotary magnet encoders have no mechanical contact. This makes a very reliable sensor and can also support fast rotating shafts. Alignment is important as the gap requirements are fairly tight for these types of sensors.

17 Linear Motion Magnetic Encoder
No mechanical contact Accurate alignment is important Data sheet is on KOP webpage Several IO options Quad outputs Magnetic encoders are also available in a linear version. These devices are supplied in the KOP and the data sheet is on the KOP web page.

18 Linear Motion Optical Encoder
High precision Any length encoder strip Quad output US Digital Resolution of sensor and strip must match Includes index mark for home position Optical linear motion encoders are also available. These can have very high precision. Like the rotary encoders the resolution of the sensor on the strip must match resolution of the detector. You will get a quadrature output of two signals 90 degrees out of phase. These also include an index mark to help in the homing sequence if you need absolute position.

19 Gear Tooth Encoder Alignment not critical
Works with steel chain sprockets or gears Pulse width modulated output WPI Library has a function to read these type of sensors Gear tooth sensors are magnetic based devices. These sense the change in a flux field around the sensor. Some of these will give directional information and some just output a single pulse without direction encoding. We have used these for position control and speed. Not particularly precise, but often times good enough for FRC usage. WPI library has good support for both types of these sensors.

20 Ultrasonic Distance Sensor
Measures distance to a target Two styles of sensors available – Dual element and single element Available with analog or digital outputs Digital output would be the preferred method Good for localization for autonomous mode Sensitively spec is used for scaling voltage data to feet or inches Get that information from the data sheet If you want to know a distance to a target, ultrasonic sensors are a good choice. Two major styles. Single and double transducer. Single device sends and receives the sound from the same device. Dual devices send with one device and receive with the other. The outputs can be analog or digital depending on the device. There will be a sensitively spec that is used for scaling the voltage data to feet or inches. To apply that is usually simply multiplying the scaling factor times the voltage. This will give you distance in inches.

21 Gyro - Inertial Turn Rate Sensor
Measures the rate of turn Can be used for heading data for autonomous drive mode Can be used to create a field oriented style drive scheme Can be used to create a target oriented style drive scheme If oriented properly can be a tilt sensor, although the accelerometer can do that naturally with the Z axis data Gyros also known as Inertial turn rate sensors will measure the rate your robot is turning. This data can be integrated to give a heading angle. This can be used to drive in autonomous mode and can also be used to create a field or target oriented style drive scheme. If oriented properly can be used as a tilt sensor.

22 Inertial Accelerometer Sensor
Measures rate of change in motion and the direction of gravity Three axis sensor – X, Y, Z Z axis measures direction of gravity and can be used as a tilt sensor X axis, if oriented properly, will measure forward and backward motion Y axis, if oriented properly, will measure sideways motion An accelerometer sensor measures the rate of change in motion. Since gravity is acceleration it can also be used to measure the direction of gravity. These are three axis sensors with a X, Y, and Z axis. Typically they are oriented such that the Z axis sees gravity. X axis will measure forward and backward and the Y axis will measure sideways motion.

23 Inertial Sensor Should be mounted on a mass that is suspended in foam
This acts as a low pass filter and will significantly reduce high frequency noise Accelerometer output is available in digital or analog outputs Analog outputs require one analog input for each axis Digital outputs require four digital I/O connections on the digital side car Use the SPI interface software functions to get the data Use the digital outputs – This prevents the bias from becoming an issue The KOP sensor is actually quit good. For best results it should be mounted on a mass that is suspended in foam. This will act as a low pass filter and will reduce the high frequency noise in the data coming from this sensor. The accelerometer output is available in digital or analog format. I would always select the digital option if you can. Using the SPI interface consumes four digital I/O pins on the digital side car. Using the digital outputs reduces bias errors.

24 Inertial Sensor Rate gyro output is available as an analog output
Connect this output to the analog bumper input Use shielded wire for a clean signal System must measure the bias when the sensor is initialized System must be absolutely stationary when the system is measuring the bias If your gyro is drifting it is likely because the system was in motion during the initialization period The turn rate gyro has an analog outputs. Wire the signal to the analog bumper input. Using shielded wire will help keep the signal clean. An important point is that the system will measure and calculate the bias when the sensor is initialized. The robot must be absolutely stationary when the system is measuring the bias. If your gyro is drifting then it is likely because the robot was in motion during the initialization period.

25 Inertial Sensor If you have a onboard air compressor it should not run during the gyro bias measurement time Sensitivity must be passed to the gyro class when it is initialized Sensitively is found on the data sheet for the device Accelerometer sensitivity will be on the order of 300 mV/g Gyro sensitivity will be on the order of 7 mV/degrees/s Read the data sheet provided by FIRST and the data sheet from the manufacturer The FPGA in the cRIO does the integration for you to get an angle Be sure your onboard compressor is not running when the bias measurement is running. Any movement during the initialization time will render the data useless. Different sensors have different sensitivities, so there is a spec called sensitivity that must be passed to the gyro class when it is initialized. This allows the software to convert the sensor units to engineering units. This number will be on the data sheet. For FRC these numbers for the accelerometer will be on the order of 300 mV/g and for the Gyro it will be on the order of 7 mV/degrees/s.

26 Inertial Sensors More Information
Kevin Watson has some good information about these types of sensors He has some well commented code if you really want to get into the details The FPGA in the cRIO really does the hard work integrating the gyro rate data to get an angle For more information on inertial sensors I would suggest you look at Kevin Watson's code. He has some well documented code and you can get into the fine details if you want. Look at his webpage kevin.org. Fortunately for us the FPGA in the cRIO does all of the work for us. Use the functions in WPI Lib for dealing with these devices.

27 Optical Transmitted Beam
Consists of two elements – a transmitter and a receiver A signal is output when the light beam is blocked Alignment is important Simple packaging is readily available off the shelf Power must be supplied to both the TX and RX Optical transmitted beam have two devices. One sends out light and the other receives light. Interrupting the light beam generates the signal. These require power.

28 Optical Transmitted Beam
Use a regulated power output. Most require 24 volts which you can get using the solenoid bumper wired to the 24 volt supply Detected object must be large enough for the sensor to see Use a regulated power supply or they could drop out causing a false signal. The rules allow us to connect the solenoid bumper to the 24 volt supply and use that to power sensors. The size of the object must break the beam.

29 Optical Retro Reflective
Uses a retro reflective target Only one device Target can be a flag in motion Target can be stationary and have an opaque flag block the light – The flag must not be reflective, or it will be detected Retro reflective sensors have the transmitter and receiver in one package. These devices emit a light beam and expect a target that will bounce the light back. When the beam is interrupted a signal is generate. The flag must not be reflective?

30 Optical Vane Transmitted Beam
One piece housing in a U shape – also called slot sensor Available in several different sizes Will detect presence of any opaque object that is inserted into the U Very effective for home sensors when used with incremental encoders No mechanical contact for high reliability Simple to actuate Does not require precise alignment or mounting Optical vane transmitted beam sensors are one piece devices formed into a U shape. These are also called “slot” sensors. We seem to be using these more and more. They are very simple to use and effective. These make great home position and end of travel sensors.

31 LED & Photo Transistor Roll your own for a fraction of the cost
Flexible designing package since you make your own LED (LTE-4208) and Photo transistor (LTR-3208E) must be a matched pair IR light is best because that will reduce the effect of ambient light Works over a wide distance range If you are on a budget you can “roll your own” sensors for a fraction of the cost. The LED and photo transistor must be matched with regard to the light output type. Mostly these are of the infrared type, but others are available. The IR are preferred because they will minimize ambient light interference. They can be set up for different distances based on how you bias them.

32 LED & Photo Transistor Requires resistors in the circuit to work properly LED needs a current limiting resistor in series with it to drop the 5 volts down to 1.2~1.6 volts Size this resistor to draw 15 ~ 30 milliamps Check the spec sheet for the target current A good range will be 180 ~ 221 ohms if using a 5 volt power supply, I used 221 ohms for this device You can calculate the value or measure it if you have an ammeter The next 2 photos show a sensor we made to detect the state of a locking plunger. The red wire going into the top of the white block and the black wire at the bottom is where the sensors were mounted. The hole in the sensor is the area where the plunger penetrates causing the light path to be blocked. These do require some circuitry to work. You will need to insert a series resistor in line with the LED transmitter. Look at the data sheet for the LED to see what the target current should be. Generally around mills is good. If you are using 5 volts then a good value to start with would be ohms.

33 LED & Photo Transistor Photo transistor needs a pull up or down resistor depending on the wiring scheme you select A good range will be 2k ~ 4k ohm, I used 3.16k for this device Resistor can be above the transistor or below it Above you get a high when the light beam is blocked Below you get a low when the light beam is blocked The photo transistor needs a pull up or down resistor depending on the wire scheme you select. A good start for this resistor is 2k – 4k ohm.

34 LED & Photo Transistor R = 221 ohms RL = 3.16k ohms
This circuit shows the LED limited by R. The receiver is the transistor with a pull down RL. This will make the output signal go high when the light beam is not interrupted. When the beam is broken the signal will go low. If you wired this with the resistor at the top, in the path to VCC then the signal would be inverted. Either way is fine, just use what makes sense in your application.

35 Current Sensor Measures current flowing to a motor
Indicates if the motor is running within load specifications Helps prevent “magic smoke” from exiting the motor Hal effect sensors can measure DC current IC based sensors can be inserted into the circuit Jaguar speed controllers have current measuring ability built right in – you just need to ask it Measuring current can be a challenge. There are several ways to do this. The sensor shown in the photo is wired in series with your load. It has a current path though the device with a calibrated Hal effect sensor that measures the current. These will go poof if overloaded. One of the best features of the Jaguar speed controller is it’s built in ability to measure the current and return that value to the software.

36 Test Rig Always measure motor current when building proto types
12” piece of 10 AWG wire makes a good shunt resistor 1 milli-volt equals 1 amp current flow Another way to measure current is to use a 12” long piece of 10 gauge wire. With a milli-volt meter across this as a shut resistor you will get 1 milli-volt for one amp of current flow. We built a test rig we use when building proto types to verify that the current flow of the motor is within range. This photo shows a motor running drawing 3 amps. When I first started on the team… for prototypes they would just hook the motor to the battery directly for testing. If it moved like they wanted they called it good. No one understood why systems didn’t work when controlled by the speed controller. Of course the reason was because the current from a direct connection was much higher than what a speed controller can supply. After we introduced this test rig all of those problems went away. Measure current will also expose developing mechanical issues. One year we had an elevator that was problematic. It started to slow down. Of course everyone was blaming the programmers. We were logging current, so we just showed everyone the mechanism was drawing over 50 amps when it had been drawing about 23 amps. The issue was quickly found to be a mechanical binding issue.

37 Cameras Two types provided over the years from the kit of parts
Axis M1011 Axis 206 Any others are legal if they are IP based Library provided by FIRST is very advance Several teams got vision to work for them Can be connected directly to the cRIO or radio Vision processing can be done on cRIO or driver station Cameras Cameras are a fun sensor to use. FIRST has provided several different ones over the years. The vision library provide by WPILib is very advanced. Many teams are having success with this. These can be connected directly to the cRIO or wired through the radio. Processing can be done on the cRIO or driver station.

38 Tools Needed Oscilloscope is very helpful Voltmeter Ammeter
Soldering Equipment Connectors Shielded wire When working with sensors there are some tool you need. An oscilloscope is very helpful. For encoders it is really an essential tool. If you don’t have one try to get one. Many companies have old ones they don’t mind giving away, check with a sponsor. Another source is ham fest held in the summer. Of course eBay is another good option. Other equipment includes a volt meter, ammeter, soldering equipment, assortment of connectors and shielded wire.

39 Software You Need to Write
Code that will read the sensor Code that will log the data from the sensor First thing you should do is hook up sensors you plan to use and start reading data Don’t wait Connect sensors and start reading data as soon as possible!! For every sensor you need software. You need code to read and log the data from the sensor. One of the first things you should do is hook it up and start reading data. Make sure you know how to read a sensor.

40 Log The Data Log the data to a file on the cRIO
Send the data to the driver station and log to a file on the DS Add external device that logs to a memory card Logomatic by Spark Fun Electronics Logging data is incredibly helpful. If you are not logging data then you are really blind to what is going on. There are several ways to do this. You can log the data to a file on the cRIO. You can send the data to the driver station and log it there, or you can add an external device and log the data to a memory card. This photo shows a device available from Spark Fun Electronics that will log to a memory card. We have been logging to a file on the cRIO. This seems to work well and is easy to implement.

41 This graph shows data that we logged from our shooter testing done in The purple line is the wheel RPM. You can see it is steady state around 1300 RPM. When a ball is launched the RPM goes down to around 1000 RPM. The current to the motor goes up to over 70 amps. When the ball is clear of the wheel you see a critically damped response as the PID loop maintains the speed at 1300 RPM.

42 Sensor Guidelines It always needs a sensor
If a mechanism has limited travel then it needs an end of travel (EOT) limit sensor on both ends! Start reading data from sensors as soon as you can so you will learn what is required and the type of data Design your sensors into the system. Add on after thought mounting schemes tend to be unreliable

43 Kit of Parts Sensors Use the resources provided by FIRST at the kit of parts website They have data sheets and instructions specific to our application

44 Suppliers AndyMark - http://www.andymark.com/Default.asp
US Digital - Digikey - Mouser Electronics - Newark Electronics - Allied Electronics - Rockwell Automation - Automation Direct - Spark Fun Electronics - Parallax Inc. - MaxBotix - Suzo Happ - Penny+Giles - State Electronics -

45 Questions Hugh Meyer hmeyer@redalert1741.org 317 786-9214
Webpage:


Download ppt "Center Grove High School Greenwood Indiana"

Similar presentations


Ads by Google