pitsco TETRIX PULSE Programming Manual

pitsco TETRIX PULSE Programming Manual

Robotics controller

Advertisement

TETRIX® PULSE™ Robotics Controller
Programming Guide
44301

Advertisement

Table of Contents
loading

Summary of Contents for pitsco TETRIX PULSE

  • Page 1 TETRIX® PULSE™ Robotics Controller Programming Guide 44301...
  • Page 2 No part of this product or related documentation may be reproduced in any form by any means without prior written authorization of Pitsco, Inc. All other product names mentioned herein might be the trademarks of their respective owners.
  • Page 3: Table Of Contents

    Getting Started Extension Activities ............................ 128-129 Careers Complete Listing ................................... 130 TETRIX PULSE Robotics Controller Technical Specifications ....................131 TETRIX PULSE Controller Sensor Port Pinout Diagrams ....................132-133 TETRIX PULSE Arduino Library Functions Chart ......................134-140 TETRIX PULSE Arduino Library Functions Cheat Sheet ......................141...
  • Page 4: Preface

    Preface This programming guide has been developed to provide students with positive experiences in robotics engineering and programming. With the assistance of this guide, students will learn to use the TETRIX® PRIME parts to construct different robots while learning about programming with the PULSE controller. After using this guide, students should be able to use the TETRIX PRIME parts to construct a robot of their own design.
  • Page 5: Tetrix® Pulse™ Robotics Controller Introduction

    Building with TETRIX PRIME! PULSE Controller Introduction Pitsco Education is pleased to bring you the TETRIX® PULSE™ Robotics Controller Programming Guide – an exciting and progressive series of activities that teaches the essentials of learning to program your TETRIX PRIME creations using the PULSE controller and the graphic-based TETRIX Ardublockly software.
  • Page 6: Pulse Controller Technology Overview

    Power Stop/Reset switch button Start button 2 quadrature encoder input ports Battery connection port Tip: For complete, detailed specifications, please refer to the TETRIX PULSE Robotics Controller Specifications located in the appendix on page 131. Getting Started...
  • Page 7 PULSE Controller Technology Overview Getting Started...
  • Page 8 Sensor: A device that detects surrounding environmental factors for the controller Ultrasonic Sensor: Enables a robot to measure distance to an object and respond to movement Line Finder Sensor: Enables a robot to follow a black line on a white background or vice versa Motor: A machine that produces motion or power for completing work...
  • Page 9: Pulse Setup

    PULSE Setup Attaching the Sensors: To connect a sensor to the PULSE, plug the end of the sensor wire into ports labeled D2-D4 for digital sensors, A1-A3 for analog sensors, or I2C for I2C components. Attaching the DC Motors: To connect a DC motor to the PULSE, plug the end of the DC motor wire into one of the two DC motor ports.
  • Page 10 Downloading and Uploading: The PULSE USB port is used for communication between PULSE and a Windows or Macintosh device. The port enables users to download and upload data from the computer to the PULSE controller. To upload a program to the PULSE, plug one end of the USB cable into the controller’s USB port and plug the other end into a USB port on your device.
  • Page 11: Software Overview

    • The TETRIX Ardublockly software is a special programming interface created a tutorial on programming by Pitsco for exclusive use with the PULSE controller. The TETRIX Ardublockly with the Arduino C-based software was developed using the Google interface called Blockly.
  • Page 12 Arduino calls it, a sketch. After you have successfully installed the Arduino Software (IDE), you must add the Arduino PULSE controller library. The PULSE controller library contains special programs written for the TETRIX PULSE controller. Teacher note: • Depending on your The PULSE library is distributed as a .zip file: TETRIX_PULSE.zip.
  • Page 13 You will be prompted to select the library you would like to add. Navigate to the location where you saved the TETRIX_PULSE.zip library file, select it, and open it (Figure 2). Figure 2 Return to the Sketch > Include Library menu. You should now see the library at the bottom of the drop-down menu.
  • Page 14 Configuring USB Communication PULSE and the Arduino Software (IDE) will communicate with each other through the computer’s USB port. Therefore, before we can begin programming, we first need to be sure that the PULSE controller is properly set up in the Arduino Software (IDE) for communication over the USB port.
  • Page 15 Next, without the PULSE connected, navigate to Tools > Port and check the current connections. If there are no current connections detected, the word Port will be grayed out. If there are connections detected, take note of the COM ports that are listed.
  • Page 16: Software Setup

    The new port that appears in this example is COM1. Select the new port item to tell the Arduino Software (IDE) to use this port for communications. Your port will Tip: Each PULSE unit will likely be different, and that is OK. When the communications port has been set up, use a different COM port communications with the PULSE controller have been enabled.
  • Page 17 TETRIX Ardublockly Software Setup Note: This software will not The TETRIX Ardublockly software is distributed as a .zip file: TETRIX_Ardublockly. work on a 32-bit Windows zip. There is a version for the Windows operating system and a version for the Mac machine.
  • Page 18 You will see the TETRIX Ardublockly icon show up on your desktop while it’s loading the software (Figure 8). Figure 8 When the software is loaded, you should see this screen (Figure 9). Figure 9 Navigate to Edit > Preferences (Figure 10). Figure 10 Getting Started...
  • Page 19 You will need to adjust the settings in the software. Make sure the compiler location links to where the Arduino Software (IDE) is located on your device (Figure 11). Click below Compiler Location. Figure 11 Choose your operating system folder (Figure 12). Figure 12 Getting Started...
  • Page 20 Find the Arduino program files. Select the Arduino application (Figure 13). Figure 13 Click below Sketch Folder. Choose which location the sketch folder will save to. You can save to your Documents folder or another location on your device (Figure 14). Figure 14 Getting Started...
  • Page 21 The Arduino board should be Uno (Figure 15). Figure 15 Adjust the COM port to whichever port the PULSE controller is associated with (Figure 16). Figure 16 When this step is complete, your PULSE controller is connected to the TETRIX Ardublockly software and coding can begin.
  • Page 22 TETRIX Ardublockly Introduction Software Basics: This is the main interface you will use when you open the software. On the far-left side is the tool palette. To hide the tool palette, click the eye icon on the top of the bar.
  • Page 23 PULSE Blocks: Control Initializes the PULSE Robotics Controller Immediately terminates the program Defines the Arduino setup() and loop() functions Sets the state of the PULSE red LED Sets the state of the PULSE yellow LED Sets the state of the PULSE green LED Reads the state of the PULSE Start button Reads the battery pack voltage Waits for a specific time in milliseconds...
  • Page 24 Motors Sets the power and direction of the DC motor; the power range is -100 to 100 Sets the power and direction of DC Motors 1 and 2 Inverts the rotational direction of the selected motor channel Time element Figure 19 Servos Sets the speed of the selected servo motor channel Sets the speeds of all six servo motor channels...
  • Page 25 Troubleshooting Tips: • Your sketch always has to start with the pulse Begin block. If you want to end a program, you can use the pulse End block or press the red Stop/Reset button on the controller. • If your sketch won’t load onto the PULSE controller, try disconnecting the USB cable and reconnecting it.
  • Page 26: Getting Started Activities

    Getting Started Activities Note: If you are already Now, it is time to get started with the activities. Each of the five getting started comfortable with coding in activities is designed to introduce you to the TETRIX Ardublockly software and how Arduino sketches and want it works with the PULSE and select basic hardware.
  • Page 27: Activity 1: Hello World

    Activity 1: Hello World! Introduction You will create a simple program, or sketch, that will blink the red LED on the PULSE controller. Think of the controller as if it’s winking at you! This activity is the equivalent of a Hello World! program, which is usually the intro activity for any new programmer.
  • Page 28 Background Tip: To see if the PULSE is Before you can upload the sketch to the PULSE, you need to make sure the PULSE detected by the computer, has power, is connected to the computer, and is detected by the computer. check the port as you did in the Configuring USB When the PULSE is connected as shown, turn on the PULSE with the on/off switch.
  • Page 29 Further Investigate Look at the right side of the program. You see text with different punctuation. This is called syntax, or text-based programming. Each block in the sketch is typically represented by one line of text. Lines of text within a sketch are also known as code, which is why programming is sometimes called coding.
  • Page 30 If there are no errors, the compiler will complete and indicate that it is done compiling, and you can upload your code. Click the Upload the Sketch button on Tip: To solve this the sketch and see if you were able to simulate a stoplight. extension activity, you can find a sample sketch Real-World Link...
  • Page 31: Activity 2: Moving Your Dc Motors

    Activity 2: Moving Your DC Motors Introduction For your second activity, you will add an element of motion. You will create a sketch that will rotate a DC motor. Parts Needed TETRIX® PULSE™ 6 V NiMH Battery 3-Foot Type A-B USB Controller 44268 Pack 40235 Cable 40967...
  • Page 32 Background The intent of this sketch is to spin a DC motor for five seconds and then stop. Then, Tip: What’s the difference the motor will spin in the opposite direction for five seconds. The motor will operate between a DC motor and a at half power.
  • Page 33 When the program is running, you will see a red light by the motor cord when the motor is going forward, or clockwise. Within the sketch, this motor direction is represented by a positive value (Figure 32). Figure 32 When the program is running, you will see a green light by the motor cord when the motor is going backward, or counterclockwise.
  • Page 34 Real-World Link You can find DC motors in many places. They are in elevators, trains, machinery, power tools, cars, and fans. They are often used to power different electronics. Careers: small-engine mechanic, mechanical engineer, machinery maintenance worker STEM Connections • Science Ĕ...
  • Page 35: Activity 3: Moving Your Servo Motors

    Activity 3: Moving Your Servo Motors Introduction In the third activity, you will create a sketch to rotate a servo motor. Servo motors allow movement to a set position regardless of the start position. The TETRIX servo motors have a limited range of motion from 0 to 180°. For example, you can tell a servo to go to position 45°...
  • Page 36 Background In this third sketch, you will spin a servo motor back and forth between two Tip: What’s the difference different positions at a set speed. The motor will operate at 25% speed. This between a DC motor and a behavior will continue until the Stop/Reset button is pressed.
  • Page 37 The two parameters of the pulse Set Servo Position block are servo channel and target position. In the example, pulse Set Servo Position means Servo 1 will rotate to the target position of 180°. It then changes position to 0° but continues at the same speed.
  • Page 38 Real-World Link You can find servo motors in R/C model cars for steering and R/C model airplanes for controlling flaps and rudders. Servos are used where precise movement is needed such as in the operation of robotic arms, grippers, and rotating camera mounts.
  • Page 39: Activity 4: Introduction To The Line Finder Sensor

    Activity 4: Introduction to the Line Finder Sensor Introduction For the fourth activity, you will use a line-finding sensor. In this example, you will connect a Line Finder Sensor to digital sensor port D2. You will create a sketch to read digital input from the Line Finder Sensor.
  • Page 40 Background For the fourth sketch, you will take a closer look at programming a sensor and using a logic block. You will use the Line Finder Sensor to determine whether a surface is light or dark. The if-do logic block does exactly what its name suggests. Everything contained within the loop will repeat consecutively until the sketch is ended with a command or the Stop/Reset button (Figure 38).
  • Page 41 Further Investigate This sketch introduces a program structure, new blocks, and a comparison statement. The program structure is an “if” statement, the reading of the sensor, and the comparison statement is “=” (equal to). The comparison statement “=” (equal to) defines a type of test. In this sketch, the input of the Line Finder Sensor will turn different LEDs on or off.
  • Page 42 Experiment with the Line Finder Sensor on different surfaces and different heights to see how the sensor reacts. Extension Activity With the example as a reference, try creating a new sketch to use your Line Finder Sensor. Remember what you learned from your previous activities and think of additional creative actions to perform based on the condition of the Line Finder Sensor.
  • Page 43: Activity 5: Introduction To The Ultrasonic Sensor

    Activity 5: Introduction to the Ultrasonic Sensor Introduction For the final getting started activity, you will finish up your exploration of sensors by creating a sketch using the Ultrasonic Sensor. In this activity, you will connect an Ultrasonic Sensor to digital sensor port D3 and display the distance to an object you place in front of it using the serial monitor window.
  • Page 44 Background For your fifth sketch, you will use the Ultrasonic Sensor, which sends out pulses that measure the distance from the sensor to the object. You will use the same logic block from the previous activity. Instead of measuring light, this sensor will measure distance. Depending on the distance of the object from the sensor, a red or yellow LED will light up on the PULSE controller.
  • Page 45 Further Investigate In this sketch, the input of the Ultrasonic Sensor will turn different LEDs on or off. If the variable in the if section of the loop block is true, then the blocks within the do section of the loop block are run. In this instance, if there isn’t an object closer than 10 cm to the Ultrasonic Sensor, the yellow LED on the PULSE controller will be lit (Figure 43).
  • Page 46 Real-World Link Modern vehicles are smart. They have backup cameras and assisted parallel parking and will even beep at you if an object is too close to the car. This is how an ultrasonic sensor works! Careers: car designer, sound engineering technician, sonar technician Arduino Source Code STEM Connections #include...
  • Page 47: Building And Coding The Pulse Codee Bot

    Building and Coding the PULSE Codee Bot This is what you have been waiting for. It is time to move to the next level. You have worked hard to learn the basics, and now it is time to apply them to an actual robot.
  • Page 48: Hardware Overview

    Programmable Robotics Set Note: In order to complete the build shown in this book, you must have the TETRIX PRIME Programmable Set. Building and Coding the PULSE CodeeBot...
  • Page 49 TETRIX PRIME 90-Degree Beam Bracket ....10 44268 TETRIX PULSE Robotics Controller with USB cable ...1 43055 Ultrasonic Sensor Pack .
  • Page 50 TETRIX PRIME Hardware Components Beams The beams are named by the number of small holes on one side of the beam. 1:1 scale Do not select beams by counting the larger holes (see right). To identify TETRIX PRIME Square Beams, count the small holes. The example above is a 4-hole square beam.
  • Page 51 Structural Elements 3-Way Beam Connector 40212 Tee Beam Connector 40213 90-Degree Beam Connector 40211 Beam End Connector 40214 Beam Extension Connector 40322 Beam Straight Connector 40215 Building and Coding the PULSE CodeeBot...
  • Page 52 Structural Elements 90-Degree Beam Bracket 40208 60-Degree Beam Bracket 40209 Tee Beam Bracket 40210 Quick Rivet Connector 40219 Quick Rivet Peg 40220 Wing Nut 40221 Thumbscrew 40323 TIP: These two parts, the straight block beam connector and the 90-degree cross Straight Block Beam Connector 40216 block connector, are very close in appearance and can be easily confused.
  • Page 53 Motion Elements Wheel with Tire 40222 80-Tooth Plastic Gear 40224 40-Tooth Plastic Gear 40223 Battery Mount Bracket 40236 8 mm x 6 mm Bronze Bushing 40227 D-Shaft Set Collar 40229 80 mm Steel Axle 40225 40 mm Steel Axle 40226 Socket Head Cap Screw 40516 Measure 80 mm and 40 mm steel axles here.
  • Page 54 Motion Elements HiTec HS322-HD Servo Motor 40538 TETRIX PRIME DC Motor 44298 Servo Mounting Bracket 40232 Shaft Servo Hub 40230 Gripper Kit 40234 Power, Tools, and Accessories Elements 4-in-1 Screwdriver 36404 2-in-1 Screwdriver 42991 Miniature Ball-Point Hex Driver 40341 Plastic 2 oz Cups 41769 Practice Golf Balls 14041 Building and Coding the PULSE CodeeBot...
  • Page 55 Power, Tools, and Accessories Elements 6 V NiMH Battery Pack 40235 5-Cell NiMH Battery Pack Charger 40378 Control Elements TETRIX PULSE Robotics Controller 44268 Ultrasonic Sensor Pack 43055 Line Finder Sensor Pack 43056 3-Foot Type A-B USB Cable 40967 Building and Coding the PULSE CodeeBot...
  • Page 56 Standard Servo Assembly You will need the HiTec HS322-HD Servo Motor with screw, the servo mounting bracket with screws, a shaft servo hub, and a socket head cap screw. You will also need the 4-in-1 screwdriver and the miniature ball-point hex driver. remove the white plastic servo horn attached to the servo.
  • Page 57 Step 1 Step 2 Step 3 Step 4 Before attaching the servo hub, you must make sure the servo is in the neutral position. To do this, connect both the servo and the battery to the receiver and turn on the power to the remote transmitter.
  • Page 58 Set Screw Applications Wheel with Tire 40222 TIP: 80-Tooth Plastic Gear 40224 Please keep in mind that if your parts already have socket head cap screws installed and the directions call for that operation, you can skip to the next step. 40-Tooth Plastic Gear 40223 TIP: Directions will show these types of...
  • Page 59 Gripper Assembly The gripper kit is included with the TETRIX PRIME Programmable Robotics Set but is shown here for reference. Right Gripper Gear Arm Self-Tapping Left Gripper Screw Gear Arm Gripper Pivot Arm Pivot Washer Gripper Plate Standard Servo Gripper Pincer Gripper Pivot Arm Step 1 Step 2...
  • Page 60 Step 3 Step 4 Servo Horn Screw Step 5 Step 6 Step 7 Step 8 Building and Coding the PULSE CodeeBot...
  • Page 61 Step 9 Step 10 Step 11 Step 12 Step 13 Step 14 Building and Coding the PULSE CodeeBot...
  • Page 62 Step 15 Step 16 Step 17 Step 18 Finished Assembly Building and Coding the PULSE CodeeBot...
  • Page 63 Construction Tips Connectors fit inside beams and come in 3-way, tee, 90-degree, end, extension, and straight beam block connector designs. Building and Coding the PULSE CodeeBot...
  • Page 64 Quick rivet connectors and pegs are a quick option for securing connectors. Press the rivet in place on the beam and use the peg to spread the rivet to secure the connection. Using rivets on two sides of the connection will make it more stable. Building and Coding the PULSE CodeeBot...
  • Page 65 Joints can be made more permanent by using a thumbscrew and wing nut to secure the beams and connectors. TIP: Wing nuts are placed in position first and thumbscrews are tightened into them. After wing nuts are placed and seated properly, they cannot be turned. TIP: Thumbscrews should be snug but not overtightened.
  • Page 66 Brackets can also be used to connect beams. Brackets are available for a tee connection, 60-degree connection, or 90-degree connection. Brackets should be used in pairs, with two brackets on opposite sides of a beam. Brackets are secured using quick rivets and pegs or thumbscrews and wing nuts. Building and Coding the PULSE CodeeBot...
  • Page 67 Beam end connectors, straight block beam connectors, and 90-degree cross block connectors are secured using a thumbscrew through the beam and into the connector. Building and Coding the PULSE CodeeBot...
  • Page 68 After the thumbscrew is used to secure the end of the connector, a quick rivet and peg or a thumbscrew and wing nut are used to secure the intersecting beam. Building and Coding the PULSE CodeeBot...
  • Page 69 Anytime an axle is used, it should be supported at two points. Place a bronze bushing on opposite sides of a beam and place the axle through the bushings. Secure the axle to a D-shaft set collar, wheel, gear, or hub. Building and Coding the PULSE CodeeBot...
  • Page 70 Line Finder Sensor Pack Assembly The screws in this pack will self-thread into the plastic mounts. The 4-in-1 screwdriver that comes as part of the TETRIX robotics sets can be used to install the screws. Take care not to overtighten the screws upon installation or the plastic mount might be damaged.
  • Page 71: Activity 6: Build The Pulse Codee Bot

    Activity 6: Build the PULSE Codee Bot Teacher Note: Other factors Introduction can affect building time, including matters such as set You need a robot. Because the focus of this guide is on working with PULSE and organization and whether the TETRIX Ardublockly software, you do not need a complicated robot.
  • Page 72 Step 1 Parts Needed TETRIX DC Motor 44298 6-Hole Square Beam 40203 with Servo Mounting Bracket 40232 (Assembly instructions on pages 54-55) 13-Hole Square Beam 40206 8 mm x 6 mm Bronze Bushing 40227 90-Degree Cross Block Connector 40217 40 mm Steel Axle 40226 Thumbscrew 40323 Tip: See page 48 for help with identifying beam elements.
  • Page 73 Step 1.0 Build two like this. Step 1.1 Building and Coding the PULSE CodeeBot...
  • Page 74 Step 1.2 Step 1.3 Building and Coding the PULSE CodeeBot...
  • Page 75 Step 1.4 Building and Coding the PULSE CodeeBot...
  • Page 76 Step 2 Parts Needed Beam End Connector 40214 4-Hole Square Beam 40201 Tee Beam Bracket 40210 Straight Block Beam Connector 40216 5-Hole Square Beam 40202 90-Degree Cross Block Connector 40217 15-Hole Square Beam 40207 40 mm Steel Axle 40226 Thumbscrew 40323 Beam Attachment Hub 40228 Wing Nut 40221 D-Shaft Set Collar 40229...
  • Page 77 Partial assembly should look like this. Step 2.0 Step 2.1 Building and Coding the PULSE CodeeBot...
  • Page 78 Step 2.2 Step 2.3 Building and Coding the PULSE CodeeBot...
  • Page 79 Step 2.4 Step 2.5 Building and Coding the PULSE CodeeBot...
  • Page 80 Step 2.6 Step 2.7 Building and Coding the PULSE CodeeBot...
  • Page 81 Step 2.8 Building and Coding the PULSE CodeeBot...
  • Page 82 Step 3 Parts Needed Thumbscrew 40323 Wheel with Tire 40222 TETRIX® PULSE™ Controller 44268 Partial assembly should look like this. Building and Coding the PULSE CodeeBot...
  • Page 83 Step 3.0 Step 3.1 Building and Coding the PULSE CodeeBot...
  • Page 84 Step 3.2 Building and Coding the PULSE CodeeBot...
  • Page 85 Step 3.3 Building and Coding the PULSE CodeeBot...
  • Page 86 Step 4 Parts Needed Socket Head Cap Screw 40516 6 V NiMH Battery Pack 40235 Line Finder Sensor Pack 43056 Ultrasonic Sensor Pack 43055 Partial assembly should look like this. Building and Coding the PULSE CodeeBot...
  • Page 87 Step 4.0 Step 4.1 Building and Coding the PULSE CodeeBot...
  • Page 88 Step 4.2 Building and Coding the PULSE CodeeBot...
  • Page 89 Finished assembly should look like this. Building and Coding the PULSE CodeeBot...
  • Page 90: Activity 7: Drive Forward

    Activity 7: Drive Forward Teacher Note: Other factors Introduction can affect building time, including matters such as set This is your first coding activity with the PULSE Codee Bot, so you’ll keep it simple. organization and whether In this activity, you will create a sketch to move the Codee Bot forward for three the builder has a partner.
  • Page 91 Execute the Code Before you can upload the sketch to the PULSE, remember to check your connections. Upload the sketch. The green LED will light up, indicating the code is ready to execute. When the LED comes on, disconnect the USB cable and set the Codee Bot on the floor.
  • Page 92 In this simple sketch, all these blocks work together so the robot can move forward for three seconds and then stop. Because you want the motors to always work together, the pulse Invert Motor block needs to be used only in the setup part of the loop block.
  • Page 93 Real-World Link Trains are machines that can go only forward or backward with the motors they use. The motors are powered by thrust in either a forward or backward direction. A train could never directly turn around a corner. That’s why all train tracks are curved instead of having 90-degree turns.
  • Page 94: Activity 8: Drive In A Circle

    Activity 8: Drive in a Circle Introduction For your eighth activity, you will apply your knowledge of motors to create a new behavior. While being able to move straight is important, you need to be able to expand on that and make turns. This activity will have your PULSE Codee Bot driving in circles by using different motor powers as the motors work in unison.
  • Page 95 Execute the Code Before you can upload the sketch to the PULSE, remember to check your connections. Upload the sketch. The green LED will light up, indicating the code Tip: The Codee Bot might is ready to execute. When this has occurred, disconnect the USB cable and set the struggle to overcome the Codee Bot on the floor.
  • Page 96 Block-Text Correlation void setup() { Arduino Source Code pulse.PulseBegin(); #include <PULSE.h> pulse.setMotorInvert(1,1); PULSE pulse; void loop() { pulse.setMotorPowers(100,50); void setup() { pulse.PulseBegin(); pulse.setMotorInvert(1,1); void loop() { Note: Motor 1 is turning at twice the power of Motor 2. pulse.setMotorPowers(100,50); Building and Coding the PULSE CodeeBot...
  • Page 97: Activity 9: Drive In A Square

    Activity 9: Drive in a Square Introduction Now, you will continue to build your navigational skills with the PULSE Codee Bot by giving your robot the ability to make 90-degree turns. The ability to make 90-degree turns will be used to make the Codee Bot drive in a square. Parts Needed Open the Program Let’s start by looking at the example sketch.
  • Page 98 Execute the Code Before you can upload the sketch to the PULSE, remember to check your connections. Upload the sketch. The green LED will light up, indicating the code Tip: Depending on the is ready to execute. When this has occurred, disconnect the USB cable and set the surface type, your bot might Codee Bot on the floor.
  • Page 99 Program Breakdown Tip: Adjust the timing of the turns if the robot doesn’t turn at right angles. For example, you can change the time from 1650 to 1300. The Drive forward charge of the battery can affect the turns. Brake Turn 1 Brake Drive forward...
  • Page 100 Extension Activity With the example as a reference, try creating a new sketch to move the Codee Bot in a square. Remember what you have learned from your previous activities and experiment with different parameters to make the square larger or smaller. Challenge yourself to create complex paths beyond a square.
  • Page 101 Block-Text Correlation void setup() { Arduino Source Code pulse.PulseBegin(); pulse.setMotorInvert(1,1); #include <PULSE.h> void loop() { PULSE pulse; pulse.setMotorPowers(50,50); void setup() { delay(3000); pulse.PulseBegin(); Note: The pulse.setMotorInvert(1,1); motors drive forward for 3 seconds. void loop() { pulse.setMotorPowers(50,50); delay(3000); pulse.setMotorPowers(0,0); delay(1000); pulse.setMotorPowers(50,-50); delay(1650);...
  • Page 102: Activity 10: Simplify The Square

    Activity 10: Simplify the Square Introduction Remember the square activity you did in Activity 9? For your next activity, you will use a more efficient way to code the same behavior. Parts Needed Open the Program Let’s start by looking at the example sketch. Open the sketch by selecting Examples >...
  • Page 103 Execute the Code Before you can upload the sketch to the PULSE, remember to check your connections. Upload the sketch. The green LED will light up, indicating the code Tip: Depending on the is ready to execute. When this has occurred, disconnect the USB cable and set the surface type, your bot might Codee Bot on the floor.
  • Page 104 Extension Activity With the example as a reference, try creating a new sketch to move the Codee Bot in a square using the repeat-do block and called functions. Or for an additional challenge, create complex paths beyond a square such as rectangles or hexagons. Remember what you have learned from your previous activities.
  • Page 105 Block-Text Correlation void setup() { pulse.PulseBegin(); pulse.setMotorInvert(1,1); void loop() { pulse.setMotorPowers(50,50); delay(3000); pulse.setMotorPowers(0,0); pulse.setMotorPowers(50,-50); delay(1650); for (int count = 0; count < 4; count++) { Arduino Source Code #include <PULSE.h> PULSE pulse; Note: This is the Note: This is the Note: The void setup() {...
  • Page 106: Activity 11: Drive To A Line And Stop

    Activity 11: Drive to a Line and Stop Introduction You will begin this activity by adding the Line Finder Sensor to a basic move forward behavior. This will enable the PULSE Codee Bot to stop based on the environment around it. In this activity, the Codee Bot will drive forward and stop at a line.
  • Page 107 Execute the Code Before you can upload the sketch to the PULSE, remember to check your connections. The Line Finder Sensor should be in D2. Upload the sketch. The green Tip: Depending on the LED will light up, indicating the code is ready to execute. When this has occurred, surface type, your bot might disconnect the USB cable and set the Codee Bot on the floor.
  • Page 108 The second part of the if-do block executes the while() loop block. A while() loop looks at a test condition in the block and will loop continually until the test condition set in the block becomes false. In this program, it will repeat what’s in the while() loop as long as the Line Finder Sensor reads a value of 1 (Figure 59).
  • Page 109 Block-Text Correlation void setup() { pulse.PulseBegin(); pulse.setMotorInvert(1,1); (pulse.readLineSensor(2) == 0) { pulse.setMotorPowers(35,35); (pulse.readLineSensor(2) == 1) { pulse.setMotorPowers(0,0); while (pulse.readLineSensor(2) == 1) { pulse.setRedLED(HIGH); delay(500); pulse.setRedLED(LOW); delay(500); Arduino Source Code #include <PULSE.h> PULSE pulse; void setup() { pulse.PulseBegin(); Note: This if() Note: This if() Note: This while() loop pulse.setMotorInvert(1,1);...
  • Page 110: Activity 12: Follow A Line

    Activity 12: Follow a Line Introduction For this activity, you can take what you learned in the previous activity and apply it in a slightly different way to create a new behavior. This will enable the PULSE Codee Bot to follow a line. Parts Needed Black line minimum of 2 inches wide Open the Program...
  • Page 111 Execute the Code Before you can upload the sketch to the PULSE, remember to check your connections. The Line Finder Sensor should be in D2. Upload the sketch. The green LED will light up, indicating the code is ready to execute. When this has occurred, disconnect the USB cable and set the Codee Bot on the white or reflective surface.
  • Page 112 Further Investigate This sketch uses two if-do blocks. Two actions will be executed within each if-do block. The first action of the if-do block deals with the motors. The if-do block tells the Codee Bot to turn by sending power to one motor and braking the other based on the condition of the Line Finder Sensor.
  • Page 113 Block-Text Correlation void setup() { pulse.PulseBegin(); pulse.setMotorInvert(1,1); (pulse.readLineSensor(2) == 1) { pulse.setMotorPowers(0,50); (pulse.readLineSensor(2) == 0) { pulse.setMotorPowers(50,0); Arduino Source Code Note: One wheel will turn and the other wheel will brake, #include <PULSE.h> depending on the readings from the Line Finder Sensor. PULSE pulse;...
  • Page 114: Activity 13: Drive Toward A Wall And Stop

    Activity 13: Drive Toward a Wall and Stop Introduction With this activity, you will continue to build on what you have learned and apply it to the Ultrasonic Sensor. This will enable the PULSE Codee Bot to drive toward a wall and stop a specified distance away.
  • Page 115 Execute the Code Before you can upload the sketch to the PULSE, remember to check your connections. The Ultrasonic Sensor should be in D3. Upload the sketch. The green LED will light up, indicating the code is ready to execute. When this has occurred, disconnect the USB cable and set the Codee Bot on the floor.
  • Page 116 Extension Activity With the example as a reference, try creating a new sketch to have the Codee Bot drive toward a wall or object and stop. Remember what you have learned from your previous activities. Challenge yourself by changing the direction, range, or speed. You can also test what size and shape of object the Ultrasonic Sensor is more likely to detect and at what range.
  • Page 117 Block-Text Correlation void setup() { pulse.PulseBegin(); pulse.setMotorInvert(1,1); (pulse.readSonicSensorCM(3) > 25) { pulse.setMotorPowers(50,50); else if (pulse.readSonicSensorCM(3) < 25) { pulse.setMotorPowers(0,0); Arduino Source Code Note: The bot will drive forward until it encounters an obstacle 25 cm away, and then it will brake. #include <PULSE.h>...
  • Page 118: Activity 14: Avoiding Obstacles

    Activity 14: Avoiding Obstacles Introduction For this activity, you are going to expand on the if-else block by adding actions. This will enable the PULSE Codee Bot to avoid obstacles in its path. Parts Needed Open the Program Let’s start by looking at the example sketch. Open the sketch by selecting Examples >...
  • Page 119 To begin, press the green Start button. Your robot will travel forward until it senses that it is within 25 cm of the object in its path. When an object is detected, the robot will stop, back up, make a right turn, and continue.
  • Page 120 Block-Text Correlation void setup() { pulse.PulseBegin(); pulse.setMotorInvert(1,1); (pulse.readSonicSensorCM(3) > 25) { Drive forward else Brake Go backward Brake Turn Arduino Source Code #include <PULSE.h> PULSE pulse; void setup() { pulse.PulseBegin(); pulse.setMotorInvert(1,1); void loop() { (pulse.readSonicSensorCM(3) > 25) { pulse.setMotorPowers(35,35); pulse.setRedLED(LOW); pulse.setGreenLED(HIGH);...
  • Page 121: Activity 15: Combining The Sensors

    Activity 15: Combining the Sensors Introduction This is a culmination of all the previous activities. The PULSE Codee Bot will follow a line while watching for obstacles. If an obstacle is detected, then the Codee Bot will stop, raise its beam arm, and wait for the obstacle to be moved before continuing. Parts Needed Open the Program Let’s start by looking at the example sketch.
  • Page 122 Execute the Code Before you can upload the sketch to the PULSE, remember to check your connections. The Line Finder Sensor will be in D2, and the Ultrasonic Sensor will be in D3. You will use the Line Finder Sensor for line following and the Ultrasonic Sensor for obstacle detection.
  • Page 123 Extension Activity With the example as a reference, try creating a new sketch to have the Codee Bot follow a black line and stop for obstacles. Remember what you learned from your previous activities. Challenge yourself to create a sketch in which the Codee Bot follows a line to an obstacle, goes around the obstacle, and continues following the line instead of waiting for the obstacle to be cleared.
  • Page 124 Block-Text Correlation Drive forward Go backward Brake Turn arm to 0 position Turn arm to 90 position Arduino Source Code #include <PULSE.h> PULSE pulse; void setup() { pulse.PulseBegin(); pulse.setMotorInvert(1,1); pulse.setServoSpeed(1,50); void loop() { (pulse.readLineSensor(2) == 1) { pulse.setMotorPowers(30,0); pulse.setRedLED(HIGH); else pulse.setMotorPowers(0,30);...
  • Page 125: Build, Code, Test, Learn

    For more on the Arduino Software (IDE) and programming tips and tricks: TETRIX PULSE is built on Arduino architecture and is thus usable with programming languages that support Arduino. This enables PULSE users to access the Arduino online community, which has produced a sea of support materials to get beginners coding quickly.
  • Page 126: Appendix

    Scope and Sequence The scope and sequence contains estimated timelines for each activity based on the students completing all sections. Students work at different paces, so the time that each activity could take will vary. The time estimate also includes the completion of all the extension activities.
  • Page 127: Standards Addressed

    Standards Addressed Common Core State Standards – English Language Arts/Literacy Grade 6 Grade 7 Grade 8 • SL.6.1 • SL.7.1 • SL.8.1 Ĕ SL.6.1.A Ĕ SL.7.1.A Ĕ SL.8.1.A Ĕ SL.6.1.B Ĕ SL.7.1.B Ĕ SL.8.1.B Ĕ SL.6.1.C Ĕ SL.7.1.C Ĕ SL.8.1.C Ĕ...
  • Page 128: Glossary

    Glossary abort: to stop a program or sketch from continuing to execute (on PULSE, press the red Stop/Reset button) Arduino Software (IDE): open-source software used to program Arduino-based hardware, such as PULSE autonomous: a robot whose actions occur by use of a microprocessor without human intervention beam: a square aluminum part with a set pattern of holes used as a structural building component behavior: the physical action(s) of a robot called function: an instruction set that is performed from within the main program or sketch...
  • Page 129 sensor: an electronic device used to detect light, sound, motion, or energy and relay the information to a processor servo: short for servo motor – a rotary actuator capable of providing precise control of angular position and speed; it consists of a motor coupled with a sensor for position feedback sketch: a set of instructions (a computer program) within the Arduino Software (IDE) platform standard servo: a servo that can rotate to a known angular position (typically 0°-180°) through internal sensor feedback statement: one line of code;...
  • Page 130: Getting Started Extension Activities

    Getting Started Extension Activities GS Activity 1 extension GS Activity 2 extension GS Activity 3 extension Appendix...
  • Page 131 GS Activity 4 extension GS Activity 5 extension Appendix...
  • Page 132: Careers Complete Listing

    Careers Complete Listing • air traffic controller • materials development engineer • automotive software engineer • materials engineer • biomedical engineer • measurement lab technician • car designer • mechanical drafter • CNC programmer • mechanical engineer • digital sculptor •...
  • Page 133: Tetrix Pulse Robotics Controller Technical Specifications

    TETRIX PULSE Robotics Controller Technical Specifications Microcontroller: ATmega328P with Arduino Optiboot bootloader installed Memory: 32 KB flash programmable memory (ATmega328P) Power: 6 volts DC using TETRIX PRIME 6 V NiMH Battery Pack 2 three-position header pins; H-bridge PWM controlled; DC motor ports:...
  • Page 134: Tetrix Pulse Controller Sensor Port Pinout Diagrams

    TETRIX PULSE Controller Sensor Port Pinout Diagrams PULSE Sensor Ports The PULSE controller uses Arduino UNO-compatible pin assignments. The sensors that are supported in the PULSE Arduino Library are set up automatically using the library functions. Support for different types of sensors will be added as they become available. However, the ports are all directly accessible using Arduino coding functions if you wish to code with additional sensors not yet supported in the PULSE library.
  • Page 135 Table 5: Digital Sensor Port (D2) Function Arduino Software (IDE) pin assignment ( ) Note: Digital sensor Pin 1 Ground ports D2-D4 can Pin 2 +5 volts, 100 mA also be configured as software- Pin 3 Digital input/output Digital I/O (9) implemented serial Pin 4 Digital input/output Digital I/O (2)
  • Page 136: Tetrix Pulse Arduino Library Functions Chart

    TETRIX PULSE Arduino Library Functions Chart Description   Function Coding Example PULSE Begin PulseBegin(); PulseBegin(); Is called in the Arduino code setup() Reset and initialize PULSE controller. loop. Initializes the PULSE controller. Data Type: None PULSE End PulseEnd(); PulseEnd(); When called, immediately terminates...
  • Page 137 Description   Function Coding Example Set DC Motor Speed setMotorSpeed(motor#, speed); setMotorSpeed(1, 360); Uses velocity PID control to set the Spin Motor 1 clockwise at a constant constant speed of a TETRIX DC Motor Data Type: speed of 360 DPS. setMotorSpeed(1, -360); with a TETRIX motor encoder installed.
  • Page 138 Description   Function Coding Example Set Motor Degrees setMotorDegrees(speed1, degrees1, setMotorDegrees(180, 360, 180, 360); Implements velocity and positional PID speed2, degrees2); Spin Motor 1 and Motor 2 at a constant control to set the constant speeds and speed of 180 DPS until each motor the degree target holding positions Data Type: encoder degree count equals 360.
  • Page 139 Description   Function Coding Example Read Encoder Count readEncoderCount(enc#); readEncoderCount(1); Reads the encoder count value. The Read the current count value of encoder PULSE controller uses encoder pulse Data Type: 1 (ENC 1 port). readEncoderCount(2); data to implement PID control of a enc# = integer TETRIX DC Motor connected to the Read the current count value of encoder...
  • Page 140 Description   Function Coding Example Read Line Sensor Output readLineSensor(port#); readLineSensor(2); Reads the digital output of the Line Read the digital value of a Line Finder Finder Sensor connected to a PULSE Data Type: Sensor on digital sensor port D2. sensor port. The value read is “0” when port# = integer Note: The Line Finder Sensor can be reflected light is received (detecting...
  • Page 141 Description   Function Coding Example Set Speed of a Servo Motor setServoSpeed(servo#, speed); setServoSpeed(1, 25); Sets the speed of a servo motor Set the speed of servo channel 1 to 25%. connected to a PULSE servo port 1-6. Data Type: setServoSpeed(2, 50); The speed parameter can be 0 to 100%.
  • Page 142 Description   Function Coding Example Read a Servo Position readServoPosition(servo#); readServoPosition(1); Reads the most recent commanded Read the most recent commanded position of a servo motor connected Data Type: position of Servo 1. readServoPosition(2); to PULSE servo ports 1-6. The value servo# = integer returned will be 0-180.
  • Page 143: Tetrix Pulse Arduino Library Functions Cheat Sheet

    TETRIX PULSE Arduino Library Functions Cheat Sheet Below is a reference of each function statement in the TETRIX PULSE Robotics Controller Arduino Library. PulseBegin(); PulseEnd(); setRedLED(HIGH/LOW); setYellowLED(HIGH/LOW); setGreenLED(HIGH/LOW); setMotorPower(motor#, power); setMotorPowers(power1, power2); setMotorSpeed(motor#, speed); setMotorSpeeds(speed1, speed2); setMotorTarget(motor#, speed, target); setMotorTargets(speed1, target1, speed2, target2);...
  • Page 144: Notes

    Notes...
  • Page 146 TETRIX® PULSE™ Robotics Controller Programming Guide Call Toll-Free Visit Us Online at 800•835•0686 TETRIXrobotics.com...

This manual is also suitable for:

Tetrix prime

Table of Contents