Basic Arduino Rover using NXTMindstorms Motors

Basic Arduino Rover using NXTMindstorms Motors

thingiverse

As a result of this activity, students should develop an understanding of: i. design concepts ii. teamwork needed in the design process iii. impact of technology in manufacturing iv. Students will explore design, construction, teamwork, and mechanical movement. v. Arduino Basics Print Settings Printer Brand: MakerBot Printer: MakerBot Replicator 2 Rafts: Yes Supports: No Resolution: Standard Infill: 10% How I Designed This The 3D printed parts were designed in Tinkercad. Lesson Plan Project: Basic Arduino Rover using NXT Mindstorms Motors a. Duration: 5 - 60 minute periods b. Preparation: To prepare for this lesson you will need the following supplies: Parts: • 2 X Lego NXT motors • 2 X NXT connector wires • 1 X motor breakout • 1 X HC-SR04 sensor • 1 X Arduino (I used a UNO) • 1 X Breakout proto board • 1 X Pan/Tilt kit with servo (You will only use the Pan function) • Jumper wires • Power breakout board (Used for the motor breakout, you could plug a 9V battery directly into the motor breakout) • Power for the Uno and the motor breakout. I am using two 9V batteries. • 3D printed chasis • Remixed Thingiverse Tank Treads c. Overview & Background: This project uses a pair of Lego NXT motors that are controlled via Arduino. This forms the basis of a robot that wanders around and avoids obstacles? d. Objectives: Through this lesson, students will: Learn Basic Arduino Programming Learn design concepts. Learn teamwork. Learn problem solving techniques. Learn about simple machines. e. Audiences: ages 10-18. f. Subjects: Robotics, Design Technology, Physical Science g. Skills Learned (Standards): National Science Education Standards Grades 5-8 (ages 10 – 14) CONTENT STANDARD B: Physical Science: As a result of their activities, all students should develop an understanding of Motions and forces, Transfer of energy National Science Education Standards Grades 9-12 (ages 14 – 18) CONTENT STANDARD B: Physical Science: As a result of their activities, all students should develop understanding of Motions and forces, Interactions of energy and matter CONTENT STANDARD E: Science and Technology: As a result of activities, all students should develop Abilities of technological design, Understandings about science and technology h. Lesson/Activity: Step 1 - Motors: The first task that needed to be done was to see how the Lego NXT motor worked. The nice thing is, Lego actually provides schematics of the NXT products! The schematics show the following for the motor connector: PIN Color Name 1 White MA0 2 Black MA1 3 Red GND 4 Green 4.3V (from NXT Control Unit) 5 Yellow Tach01 (rotary Encoder) 6 Blue Tach02 (rotary encoder) Note: We will only be using Pin 1 and Pin 2 for this project. This 9V Lego motor is pretty sophisticated as it has a rotational rotary encoder with 1 degree of resolution and is connected to the Yellow and Blue wires. I will keep this in mind for a future project! Also, for this project I will only be using pins 1 and 2 (white and black wires) connected to Adafruit motor breakout board using 5V. To connect the motor to the motor breakout you will need the Lego wire connectors. They have a special RJ12 connector with the tab being offset. Since I didn't have any of the connectors and I am too lazy to order any I just cut the end off of one side, stripped the wires back and tinned the stranded wire. You can also buy NXT motor breakout boards and connectors. Check out mindsensors.com. Step 2 - HC-SR04: Sonar is used to determine the distance of an obstacle. According to the datasheet it has a range of 2cm to 400cm and has a effectual angle of 15 degrees. To get a distance, the Trig of the sensor gets a pulse of at least 10uS which transmits a 8 cycle 40kHz ultrasonic burst then waits for the response. When the sensor detects the ultrasonic burst on the receiver, the SR04 Echo pin will go high and delay for a time which is proportional to the distance. So to get the distance we measure the width of the Echo pin. And in the code you will see that we get a distance in centimeters by taking the width * .035 / 2. The method to do all of this is pretty simple as you can see in the readSensor function of the code. Connect the sensor as follows: • VCC --> Breadboard 5V rail (Red) • Trig --> Pin 4 (Yellow) on Arduino • Echo --> Pin 7 (Green) on Arduino • GND --> Breadboard GND rail (Black) Mount sensor to the pan/tilt mechanism and mount the pan/tilt to you chassis. I mounted the sensor upside down on the pan/tilt kit so it was easier to connect the wires. Step 3 - Motor Breakout: I am utilizing the Adafruit DC/Stepper Motor driver. it utilizes the TB6612 driver IC. This IC can control two DC motors or 1 stepper motor and supply up to 1.2A. Connect the sensor as follows: • VCC --> Breadboard 5V rail • GND --> Breadboard GND rail • PWMA --> Pin 3 on Arduino • AIN1 --> Pin 8 on Arduino • AIN2 --> Pin 9 on Arduino • PWMB --> Pin 5 on Arduino • BIN1 --> Pin 11 on Arduino • BIN2 --> Pin 12 on Arduino • Motor A --> NXT Lego motor A (white and black wire) • Motor B --> NXT Lego motor B (white and black wire) • Vmotor --> Connected to power breakout board, 5V pins Step 4 - Servo: I am using a inexpensive micro servo that came with the pan/tilt kit. Connect the pan servo as follows: • VCC (Red) --> Breadboard 5V rail • GND (Brown) --> Breadboard GND rail • Control Orange) --> Pin 6 Note: Servo is shown removed from the pan/tilt mechanism for clarity. Step 5 - Code: Upload the code to the Arduino. The code sets up the sensors and motors then starts using the sensor to detect obstacles. If an obstacle is detected the sensor scans right and left to determine which direction has more room and turns the robot in that direction. There are a few variables that you can modify to help make the robot detect and avoid obstacles better. checkDist - This is the distance used before the robot scans left and right. If the distance is less than or equal to this variable, start scanning. rightAngle - This is the right position the servo will set once a obstacle is detected. leftAngle - This is the left position the servo will set once a obstacle is detected. centerAngle - This is center point the servo will set after scanning left and right. mtrSpeed - Regular forward speed turnSpeed - used to turn the robot by making one motor turn faster than the other. Other turning options are to just stop one of the motors. I used this method to keep the robot moving forward but feel free to experiment. Note: Serial.print commands are used to troubleshoot the sensor but printing out the distance to the serial monitor. Step 6 - All Connected: Use 2 9V batteries to power the UNO and the motors. • 9V battery 1 --> Uno • 9V battery 2 --> 5V power breakout Note: Only one servo is connected (Pan servo) Final Thoughts Here are some ideas for modifications: • Make use of the motor encoders • Use both the pan and tilt • Bluetooth or WiFi enable the robot i. References: TryEngineering (www.tryengineering.org) Design Your Own Robot (www.mos.org/robot/robot.html) FIRST Robotics Competition (www.usfirst.org) Robot Books (www.robotbooks.com) j. Rubric & Assessment: These reflective questions will help assess student understanding: i. What was one thing you liked about your design? What is its main weakness? ii. What is one thing you would change about your design based on your experience? iii. Are there algebraic and physical principles that can be applied to this activity? iv. How would you modify the instructions to create a better experience for the participants?

Download Model from thingiverse

With this file you will be able to print Basic Arduino Rover using NXTMindstorms Motors with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Basic Arduino Rover using NXTMindstorms Motors.