Advanced Energy Vehicle (AEV) Lab 04: AEV External Sensors AEV Project Objective (Problem Definition) INITIAL CONCEPTS (Brainstorming) EXPERIMENTAL RESEARCH (Programming) (System Analysis) PT 1 PT 2 PT 3 PT 4 FINAL DESIGN Present AEV Design Learning Objectives Become familiar with an external sensor which provides feedback to the Arduino about the vehicles position Become familiar with troubleshooting techniques Program the function calls in controlling the AEV using an external sensor Feedback control The sensor that will be focus of today’s lab is the Reflective Sensor which records wheel rotation information The importance of this external sensor is to provide real-time information to the Arduino for autonomous vehicle operation When a program uses real-time information from sensors, it is known as feedback control Image: from Arduino Website Reflective Sensors The sensor will produce a low voltage due to the reflectance of the aluminum tape and produce a high voltage due to the dark color of the wheel 1 Mark This voltage change is called a “mark.” For one full wheel revolution, a sensor will have 4 voltage changes or 4 marks. Our system uses two wheel sensors so the combined sensors will record eight marks per wheel rotation. 1 Mark 1 Mark 1 Mark Mounting the Sensor The sensors must be mounted to have an unobstructed view through the holes in the support arm. Use hardware plus tie wraps to secure them in place. Verify that the holes on the wheel side of the supporting arm are counter sunk. See your Instructor if holes are not counter sunk. The closer the sensor is to the wheel, the better voltage reading the sensor will usually have. Optimum Too Far Away Verifying the Sensors To make sure the sensors are on correctly Run the “reflectanceSensorTest();” following the procedure in the lab manual. Make sure to set to set the serial monitor to 115200 Baud This should be done every lab because sensors have been known to fail. Connecting the sensors to the Arduino Take careful consideration where the reflective sensor is attached to on the Arduino. Read the AEV Lab Manual for proper orientation and pin locations Important Note: Make sure the connections are installed with the white wire facing the Arduino mini-USB connection. Programming with the Sensors goToRelativePosition(M); • One Argument; M = number of marks • Example: motorSpeed(4,27); goToRelativePosition(44); Sets all motors to 27% full power Continues the last command for 44 wheel marks from the current position Each wheel has 8 marks and the wheel has a circumference of 3.902 inches Therefore: (44 marks)*(3.902/8) inches = 21.46 inches traveled Programming with the Sensors goToAbsolutePosition(M); • Example: motorSpeed(2,30); goToAbsolutePosition(500); Continues the last command until the AEV accumulates 500 total wheel marks from the starting position. Each wheel has 8 marks and the wheel has a circumference of 3.902 inches Therefore: (500marks)/(3.902/8) inches = 243.76 inches traveled from AEV starting position Difference Between goToAbsolutePosition and goToRelativePosition 0 Inches 40 Inches 80 Inches We We want want to to go go ANOTHER 40 inches40 (aka inches 82 marks) (aka 82 what marks) codewhat do we code do want? we want? motorSpeed(4,20); motorSpeed(4,20); goToAbsolutePosition(164); goToAbsolutePosition(82); OR ORgoToRelativePosition(82); goToRelativePosition(82); Note: This sequence assumes that the AEV stops at exactly the 40 inch distance and does not coast. Repeating the Relative option may result in over-shooting the 80 inch position since second Relative command will be referenced to the coast point. Repeated use of only the Relative command may cause errors. Programming to use the sensors The Lab Guidelines document gives programming instructions for this week’s lab. Program your AEV, using the appropriate program, test on your desktop track, and then run your AEV on the classroom track. Follow AEV classroom track safety procedures! Wheel count sensor testing • Since your programming will depend on the sensors working correctly, it is vital that you confirm the sensors are working properly at the beginning of each lab. • Use the reflectance test program used in this lab each week to confirm proper operation of the sensors. • There is also a test jig at the front of the Lab which can be used to test the sensors. • NOTE that three typical problems and their solutions are shown on the following slides. Wheel count sensor problems Wheel count sensor problems Wheel count sensor problems