Path Finder ******************* .. image:: Images/PathFinder.JPG :align: center Description ============ This vehicle is designed to follow a specific colored path and measure the distance of the flat surface it is traveling. It is built to run on Raspberry Pi board, based on the Coder-Maker prototype : a combination of technology and scientific concepts. Learning Objectives =================== - Conversion of angular to linear motion - Relate wheel circumference and radius of a moving device to the distance traveled. - Design and make an application based on the engineering design process - Replicate the wiring connection and the Python code used on the Raspberry Pi - Relate science concepts to real-life applications Materials Needed ================ - Raspberry Pi with micro SD card with Raspbian - Breadboard & Jumper Wires - 2x Gear motors - 2x Wheels - L293d (H-bridge) - Wheel Encoder - MCP3008 (ADC) - Analog Grayscale Sensor - Glue gun - Rectangular Plexiglas Board - 6V battery - 5V Power supply Setup and Functionality ======================= This application consists on controlling the wheels (aka gear motors) based on the grayscale sensor output, which detects black and white. According to the algorithm used, it outputs a result very close to zero when it detects white, and a larger output when it detects black. It is coded such that the machine will follow a white path: when it detects a black one, it will stop, and check left then right for a white path. Meanwhile, it is measuring the distance traveled using a wheel encoder attached to one of the gear motors. The H-bridge L293D is used to control the rotational direction of the gear motors. The MCP3008 is used as an ADC to read the analog signal from the grayscale sensor and convert it to a digital signal for the Raspberry Pi to read. Circuitry and Electronics: =========================== All the electronics used are to be connected as shown in the picture below: .. image:: Circuits/PathFinder.png :align: center Programming =========== This application is coded using Python : .. literalinclude:: Code/PathFinder.py Science Concepts and Skills =========================== The distance travelled by the vehicle is determined by the data collected by the wheel encoder, which is actually measuring the number of revolutions per minute of the rotating wheels. The total distance travelled by the vehicle can be determined in 2 ways: *Way 1, Tech-based:* The distance travelled can be calculated through the code above based on the diameter of the wheel of the encoder. It can also be calculated using the formula: :: v = r × v_a × 0.10472 Where: v is the linear velocity in m/s r is the radius of anemometer revolving piece v_a is the angular velocity (circular), in rpm (rotations per minute) `Read more`_. .. _Read more: http://physics.tutorvista.com/motion/linear-velocity.html *Way 2, Mechanical-based:* Students can measure the circumference of the wheel and put a mark on it. They will count the number of rotations of the wheel for a certain distance and multiply it with the circumference. This will give them the total distance travelled. They can also find the circumference of the wheel by using the formula: :: D = 2*π*r Where D is the circumference of the wheel in cm or m R is the radius of the wheel in cm or m (The unit of r determines the unit of D. If r in cm, then D is in cm.) **Flex your brain!** How can you improve this device by adding safety options that will prevent it from hitting obstacles?