Everything required for the workshop experience is provided on this page. This page is accessible from www.tinyurl.com/tirslkworkshop2021 for your convenience.
Participants in this workshop will get hands on experience building the TI-RSLK MAX robot platform, testing, customizing, and competing with it. It is a wheeled robotic vehicle using the TI SimpleLink MSP432 LaunchPad making it highly modular. Using Energia, TI's equivalent to simple Arduino-style scripting code, you'll come away with a full lab set up as well as teaching materials. This is a great low cost way to introduce the excitement of electronics and embedded systems in an accessible and fun way. Because the TI LaunchPad is open source and modular hardware, we can also add BoosterPack modules to augment our circuits. This workshop will focus on using the on board sensing that comes with the base TI-RSLK MAX kit. IR Reflectance, Bump Switches, and encoders.
The Arduino programming is for students with little or no programming experience and suitable for K-12 students or first year university students to explore and prototype with electronics. For advanced capabilities, students are encouraged to use Code Composer Studio and C programming to write firmware code for the TI-RSLK MAX system.
For more Robotics learning check out the TI-RSLK MAX, a comprehensive open source curriculum and hardware bundle that teaches the fundamentals of embedded systems through the application of mechatronics. TI-RSLK provides an advanced stepping stone to Robotic systems knowledge but still accessible for beginners with full lectures and lab activities.
Lab 0 - PreworkHave a computer and screwdriver ready. Chrome Browser is recommended for using some of the online elements of this workshop.
Before we begin, please ensure you:
1. Download and install the latest version of Arduino IDE (1.8.13). https://www.arduino.cc/en/software/
2. Add the URL http://s3.amazonaws.com/energiaUS/packages/package_energia_index.json to your File > Preferences > Additional Board Manager URLs. Also check the box for show line numbers if you like that and adjust your font size if you would like it bigger.
3. Go to Tools > Boards > Boards Manager and scroll to the bottom of the list with Energia MSP432 and install 5.29.1
Note: this step takes a few minutes, leave time for the install between 10-20 minutes.
4. After the install completes, You need to select the board and COM port in Arduino IDE. Go to Tool > Boards and now you should see the "Energia MSP432 Red Boards" > "Red LaunchPad MSP432P401R EMT" and make sure this is selected.
5. You also should select the correct COM port. This step can be done after you plug your LaunchPad to your computer over USB and you install your LaunchPad drivers (done in later step using RSLK debug tool GUI). Go to Tools > COM port to chose from available options. The LaunchPad populates two COM ports. MacOS users will see Port 001 and 004 populated, please use Port 1. Windows users can verify their COM port by going to Device Manager and finding the XDS110 UART.
6. Add the RSLK robot library that is downloadable at the bottom of this page in the Code section. Go to Sketch > Include Library > add .ZIP library. Select the file path of the downloaded zip library and click okay. It should say library added and you can check this by going to File > Examples > TI-Robot-Lib and see the example code provided in the library.
7. Examples should be loaded up and ready for when we start programming, but don't worry about running any code yet. Next you will want to assemble your robot and function test it with the debug tool.
Lab 1 - Build the TI-RSLK MAX robotHardware Required- TI-RSLK MAX kit
- 6x AA Batteries
- Small Phillips Head Screwdriver (optional)
In this lab we will put together our robot.
You also need a power source that we can equip to the robot to make it truly mobile. The TI-RSLK takes 6 standard AA batteries. It can also be fitted with rechargeable NiMH batteries if you prefer, but replaceable alkaline batteries will work well for individual use and last for a decent duration.
Follow these instructions to assemble your robot
Assembly Guide: http://www.ti.com/lit/pdf/SEKP164
TI-RSLK MAX is just a few components that come together quickly
1) Watch the assembly video and review the construction guide first before getting started: https://training.ti.com/ti-rslk-max-assembly-guide?cu=1137973
- a. Note the chassis board should be pre-installed, so even though the video covers it you won’t need to put that on
- b. Note the breadboard is not covered in the video, but you can use the picture below to see where they install. You don’t need to unstick the adhesive pad, just feed the screw through the adhesive to screw it into the standoffs. To secure the standoffs, you will need to remove the battery cover and attach the securing nuts to the designated locations on the inside of the battery compartment for the standoffs to screw into.
2) Verify the 5V jumper is removed on all the LaunchPads, they should be done at the factory but just verify as it will cause a catastrophic failure if not done so.
3) Make sure you seat the motor mounts all the way so it is flush with the chassis. If you don’t do this then you could very easily bend and break the retaining tabs, which would stop you from fully inserting the motor until those broken tabs are removed and could cause some stall issues later down the line
4) Breadboard standoffs placed at blue circles
5) Do a quick function check. Verify the bump switches are clicking, the power button is working while the ON/OFF switch is in the OFF position, the four large capacitors are in place on the chassis board and not damaged, there is no friction as you turn the wheels by hand.
6) Use the online debug tool right after assembly: www.ti.com/rslkdebugtool
- a. This lets you verify if everything is working correctly. It also will help you later on if you want to make sure your robot is not damaged.
- b. Use Chrome or Firefox browser and install the browser extension + TI Cloud Agent local driver. These are critical to getting the LaunchPad working so if they don't install correctly the GUI won't work. The TI Cloud Agent is also important to have installed for when we run the Arduino stuff later.
- c. If you have any problems with the dashboard (hardware not connected, etc) try to refresh the page and try again. If you completely can't get the GUI to work you can also try to download a local copy to try.
Windows: https://dev.ti.com/gallery/dl/1766484/RSLK_Debug/ver/2.0.1?platform=win
Mac OS: https://dev.ti.com/gallery/dl/1766484/RSLK_Debug/ver/2.0.1?platform=osx
Linux 64bit: https://dev.ti.com/gallery/dl/1766484/RSLK_Debug/ver/2.0.1?platform=linux64
- d. It will download the test firmware each time, so make sure LaunchPad is connected to PC via USB cable when page is loading
- e. The motors or light sensor won’t work until you confirm the power is on for the chassis board. Use the POWER push button on the chassis board, you should see Blue power LED to indicate it is on. The on/off switch can be confusing but it is best left in the OFF position. If you switch it ON it will work but won't be able to turn it off until you switch it OFF and push the POWER button.
- f. To turn it off, make sure the on/off switch is flipped to OFF and hit the power button, you should see the Blue LED go off
- g. If you notice your motors not working or you hear some grinding, make sure the magnet is not too tight and preventing the motor gears from moving. You can loosen the magnet on the motor shaft with you fingernail.
- h. If you notice anything wrong with the bump switches, make sure the connections were aligned properly. For any issues with the line sensor, make sure it is oriented correctly and all the connections are aligned.
Your robot is assembled and verified as functional. Hopefully it feels pretty stable and ready to roll.
Lab 2 - Arduino Programming IntroductionHardware Required- Assembled TI-RSLK MAX (with batteries installed and tested for function)
- Arduino IDE
- Robot Library for TI-RSLK MAX
Arduino IDE allows you to start rapid prototyping with the TI LaunchPad using Arduino style programming. This makes it really great at the beginning of a project to test out different community hardware solutions and integrate them into a custom application.
In this lab we are going to get our development environment set up. The first thing we can do is blink an LED to make sure we can program our microcontroller with our computer.
1. Open up the Arduino IDE.
2. First thing, make sure you select your board by going to Tools > Board and look for "LaunchPad with MSP432" on the menu if you have not already. If your LaunchPad board is not present, go to the Boards Manager and install your LaunchPad board package. MSP432 boards should be the last option in the list. Note: MSP432 EMT means Multitasking and has RTOS capability, but we don't need that right now.
3. If you properly installed your drivers, then you should see COM ports under Tools > Port. Select the port with UART capability if there are multiple options. You can verify the COM port in your computer's device manager.
Now we will run our code examples for the first time.
The first two examples in the library are the same code 01_Bump_Switch_Motor_Bare and 02_Bump_Switch_Motor_Simplified which will move the robot forward until the bump switch hits something. Very simple and can be skipped. The bare code uses direct calls to the library and simplified code uses functions defined in the library.
4. Go to File > Examples > Custom Robot Libraries > TI-Robot-Lib > 03_Bump_Switch_LED_Bare. Click on the upload button and when it completes you can hit the bump switches to test the different LEDs and verify new code can be flashed to the RSLK MAX.
5. Next, you can run the dancing robot examples. This will give you a fun start to the robot programming. Go to File > Examples > Custom Robot Libraries > TI-Robot-Lib > 05_Dancing_Robot_Simplified. After the program uploads, the green LED will blink indicating it is waiting for a button press. Press the S1 (left side) button or the S2 (right side) button to tell the robot to start the dance sequence. You can also try 06_Dancing_Robot_2_Simplified which is a slightly different movement.
Alternatively, open up a new sketch by going to File > New. Paste in the sample code below and run it.
#include "Energia.h"
#include "SimpleRSLK.h"
bool hit_obstacle = false;
void waitBtnPressed() {
while(digitalRead(LP_S2_PIN) == 1){
digitalWrite(LP_RGB_LED_GREEN_PIN, HIGH);
delay(500);
digitalWrite(LP_RGB_LED_GREEN_PIN, LOW);
delay(500);
}
}
void checkCollision() {
for(int x = 0;x<6;x++)
{
/* Check if bump switch was pressed
* Parameter:
* bump switch number -> 0-5
* Returns:
* true -> if specific switch was pressed
* false -> if specific switch was not pressed
*/
if(isBumpSwitchPressed(x) == true) {
hit_obstacle = true;
Serial.println("Collision detected");
disableMotor(BOTH_MOTORS);
break;
}
}
}
void setup() {
/* Set serial communication to 115200 baud rate for MSP432 */
Serial.begin(115200);
delay(500);
/* Run setup code */
setupRSLK();
/* Initialize LED pins as outputs */
pinMode(LED_FR_PIN, OUTPUT);
pinMode(LED_FL_PIN, OUTPUT);
pinMode(LED_BR_PIN, OUTPUT);
pinMode(LED_BL_PIN, OUTPUT);
pinMode(LP_RED_LED_PIN, OUTPUT);
pinMode(LP_RGB_LED_RED_PIN, OUTPUT);
pinMode(LP_RGB_LED_BLUE_PIN, OUTPUT);
pinMode(LP_RGB_LED_GREEN_PIN, OUTPUT);
/* Initialize LaunchPad buttons as inputs */
pinMode(LP_S1_PIN, INPUT_PULLUP);
pinMode(LP_S2_PIN, INPUT_PULLUP);
}
void loop() {
Serial.println("Waiting until left button is pushed");
/* Wait until button is pressed to start robot */
waitBtnPressed();
/* Wait two seconds before starting */
delay(2000);
digitalWrite(LP_RGB_LED_BLUE_PIN, HIGH);
/* Enables specified motor.
* Parameter:
* Motor your referencing -> LEFT_MOTOR RIGHT_MOTOR BOTH_MOTORS
*/
enableMotor(BOTH_MOTORS);
/* Set direction of motor rotation.
* Parameter:
* Motor your referencing -> LEFT_MOTOR RIGHT_MOTOR BOTH_MOTORS
* Direction -> MOTOR_DIR_FORWARD MOTOR_DIR_BACKWARD
*/
setMotorDirection(LEFT_MOTOR,MOTOR_DIR_FORWARD);
setMotorDirection(RIGHT_MOTOR,MOTOR_DIR_FORWARD);
/* Set speed of motor.
* Parameter:
* Motor your referencing -> LEFT_MOTOR RIGHT_MOTOR BOTH_MOTORS
* Speed -> 0 - 100
*/
setMotorSpeed(BOTH_MOTORS,10);
while(!hit_obstacle) {
/* Move robot in place */
/* Right turn in place */
setMotorDirection(LEFT_MOTOR, MOTOR_DIR_BACKWARD);
setMotorDirection(RIGHT_MOTOR, MOTOR_DIR_FORWARD);
delay(1000);
/* Left turn in place */
setMotorDirection(LEFT_MOTOR, MOTOR_DIR_FORWARD);
setMotorDirection(RIGHT_MOTOR, MOTOR_DIR_BACKWARD);
delay(1000);
/* 360 spin right */
setMotorDirection(LEFT_MOTOR, MOTOR_DIR_FORWARD);
setMotorDirection(RIGHT_MOTOR, MOTOR_DIR_BACKWARD);
setMotorSpeed(BOTH_MOTORS,50);
delay(800);
setMotorSpeed(BOTH_MOTORS,10);
/* 360 spin left */
setMotorDirection(LEFT_MOTOR, MOTOR_DIR_BACKWARD);
setMotorDirection(RIGHT_MOTOR, MOTOR_DIR_FORWARD);
setMotorSpeed(BOTH_MOTORS,50);
delay(800);
setMotorSpeed(BOTH_MOTORS,10);
/* Left turn in place */
setMotorDirection(LEFT_MOTOR, MOTOR_DIR_BACKWARD);
setMotorDirection(RIGHT_MOTOR, MOTOR_DIR_FORWARD);
delay(500);
/* Right turn in place */
setMotorDirection(LEFT_MOTOR, MOTOR_DIR_FORWARD);
setMotorDirection(RIGHT_MOTOR, MOTOR_DIR_BACKWARD);
delay(1000);
/* Left turn in place */
setMotorDirection(LEFT_MOTOR, MOTOR_DIR_BACKWARD);
setMotorDirection(RIGHT_MOTOR, MOTOR_DIR_FORWARD);
delay(1000);
/* 360 spin right */
setMotorDirection(LEFT_MOTOR, MOTOR_DIR_FORWARD);
setMotorDirection(RIGHT_MOTOR, MOTOR_DIR_BACKWARD);
setMotorSpeed(BOTH_MOTORS,50);
delay(800);
setMotorSpeed(BOTH_MOTORS,10);
/* 360 spin left */
setMotorDirection(LEFT_MOTOR, MOTOR_DIR_BACKWARD);
setMotorDirection(RIGHT_MOTOR, MOTOR_DIR_FORWARD);
setMotorSpeed(BOTH_MOTORS,50);
delay(800);
setMotorSpeed(BOTH_MOTORS,10);
}
}
This code let's your robot spin around in place to show the simple motor control we have. You will probably need to modify it as the surface the robot is on can effect it's turn speeds. Don't get too hung up on this part as we will add more layers of autonomy in the next lab. This just proves again that our motors do work and gives us a feel for the motor logic.
6. Some optional exercises can be done with the encoder and line following examples. Go to File > Examples > Custom Robot Libraries > TI-Robot-Lib > 04_Encoder_Simplified. This encoder example will show you values through the Serial Monitor, which is good for debugging.
If you want to try the line following, results will vary based on what kind of line you have available. You can create a high contrast line by drawing with sharpie marker on white paper or using electrical tape. You can also print a line track from online examples. The ability for the robot to follow the line will be variable based on teh conditions of the track.
Now we are ready to test the line following capability. Set up your black line on a white surface by printing out a track or making a tracking using black electrical tape. After you have a line set up, load in the line following example. Go to File > Examples > Custom Robot Libraries > TI-Robot-Lib > 07_Line_Following_Simplified. It first does a calibration on the line by going forward and back. Then you can start the line detection by clicking the button again. The robot will attempt to stay on the line. If you set the robot to a slower pace it may work better. Note: this example can be a little tricky depending on your line setup so feel free to skip ahead.
Troubleshooting
Code not uploading?
- Check for errors in Arduino debug window. The compiler will tell you what is happening. Errors are in red text.
- Sometimes your LaunchPad gets stuck or hung up on the previous code. Unplug your LaunchPad and plug it back in to perform a full reset. This is called a power on reset. Sometimes using the RESET button can work but taking away the power and letting the microcontroller fully reset is often best.
- If you have a failure to upload it could be your drivers are not properly installed. Arduino IDE will sometimes give the error “No unused FET Found” which means it can’t find a LaunchPad connected to your computer. Make sure you download the USB drivers for your operating system by running the TI Cloud Agent or installing the RSLK debug tool locally. Also make sure your USB cable is not power only. Use the one included in the box for best results.
- If you had no problem with the GUI or the first LED example, your Energia should be correctly set up. Restart your LaunchPad and restart Arduino IDE if you encounter any problems. Make sure to select the right serial port and board type under the Tools menu.
LED not lighting up?
- Make sure you properly uploaded the code and that you properly named your variables for the LED pins. There is very little chance that your LED is broken, but we can verify by blinking a different LED with the same code.
- Hit the reset button, sometimes this is needed for the LaunchPad to run the newly uploaded program.
- Assembled TI-RSLK MAX
Does it navigate?
We will go ahead and test our robot out now with some more sophisticated sample code. We can use the State Machine examples in the library. Go to File > Examples > Custom Robot Libraries > TI-Robot-Lib > 09_State_Machine_Simplified. Alternatively, Open up a new sketch by going to File > New. Paste in the sample code below and run it.
#include "Energia.h"
#include "SimpleRSLK.h"
/* Defines struct for state machine states */
typedef enum
{
START = 0,
WAIT,
GO,
GO2,
BUMPED1a,
BUMPED1b,
DRIVE,
STOP
} my_state_t;
/* Initialize state machine in START state */
my_state_t state = START;
/* Variable that will take the state machine to the STOP state */
bool done;
/* Initialize objects */
void setup() {
/* Set serial communication to 115200 baud rate for MSP432 */
Serial.begin(115200);
delay(500);
Serial.println("Initializing.....");
setupRSLK();
/* Initialize LED pins as outputs */
pinMode(LED_FR_PIN, OUTPUT);
pinMode(LED_FL_PIN, OUTPUT);
pinMode(LED_BR_PIN, OUTPUT);
pinMode(LED_BL_PIN, OUTPUT);
pinMode(LP_RED_LED_PIN, OUTPUT);
pinMode(LP_RGB_LED_RED_PIN, OUTPUT);
pinMode(LP_RGB_LED_BLUE_PIN, OUTPUT);
pinMode(LP_RGB_LED_GREEN_PIN, OUTPUT);
/* Initialize LaunchPad buttons as inputs */
pinMode(LP_S1_PIN, INPUT_PULLUP);
pinMode(LP_S2_PIN, INPUT_PULLUP);
Serial.println("Initializing System Complete.");
}
void loop() {
// Emergency stop switch S2
// Switch to state "STOP" if pressed
if (digitalRead(LP_S2_PIN) == 0) state = STOP;
//-----------------------------------
// Main State Machine
//-----------------------------------
switch (state) {
case START:
Serial.println("Enter START state");
state = WAIT;
break;
case WAIT:
Serial.println("Enter WAIT state");
digitalWrite(LP_RGB_LED_GREEN_PIN, HIGH);
delay(200);
digitalWrite(LP_RGB_LED_GREEN_PIN, LOW);
delay(200);
if (digitalRead(LP_S1_PIN) == 0) {
state = GO;
}
break;
case GO:
Serial.println("Enter GO state");
/* Start running the motors */
/* Enables specified motor.
* Parameter:
* Motor your referencing -> LEFT_MOTOR RIGHT_MOTOR BOTH_MOTORS
*/
enableMotor(BOTH_MOTORS);
setMotorDirection(BOTH_MOTORS, MOTOR_DIR_FORWARD);
setMotorSpeed(BOTH_MOTORS, 25);
state = GO2;
break;
case GO2:
Serial.println("Enter GO2 state");
/* Detect a bump and then switch to bump correction state */
for(int x = 0;x<6;x++)
{
if(isBumpSwitchPressed(x) == true) state = BUMPED1a;
}
/* Continue to rotate until done condition is met */
/* Certain distance traveled or other conditions can be set */
if (getEncoderLeftCnt() > 50000) {
done = 1;
}
if (done) state = STOP;
break;
case BUMPED1a:
Serial.println("Enter BUMPED1a state");
/* Stop the motors */
setMotorSpeed(BOTH_MOTORS,0);
/* Reverse the robot */
setMotorDirection(BOTH_MOTORS, MOTOR_DIR_BACKWARD);
setMotorSpeed(BOTH_MOTORS,25);
delay(500);
state = BUMPED1b;
break;
case BUMPED1b:
Serial.println("Enter BUMPED1b state");
/* Turn robot to avoid obstacle */
setMotorSpeed(LEFT_MOTOR,0);
setMotorSpeed(RIGHT_MOTOR,25);
delay(100);
state = DRIVE;
break;
case DRIVE:
Serial.println("Enter DRIVE state");
/* Put motors back to forward direction */
setMotorDirection(BOTH_MOTORS, MOTOR_DIR_FORWARD);
setMotorSpeed(BOTH_MOTORS, 25);
state = GO2;
break;
case STOP:
Serial.println("Enter STOP state");
Serial.println("Press Reset to begin again");
/* Stop all motors */
disableMotor(BOTH_MOTORS);
break;
}
delay(10);
}
This code will use a basic state machine to show the robot how to bump into walls and objects and avoid them. This is called dead reckoning navigation.
Try out some of the other library examples. You can see they are based on a file called SimpleRSLK.h. If you want to use these functions in your own code, or just know what it is doing, Go into your Arduino Libraries folder and you can view the library source files.
Hope you enjoy your experience with the TI-RSLK MAX!
ConclusionThe learning doesn't stop here. Move to deep dive into advanced topics with the TI-RSLK MAX by exploring the curriculum. Get a guided learning experience with Dr. Jonathan Valvano on embedded systems. View lecture videos and more in 20+ learning modules.
https://university.ti.com/en/faculty/ti-robotics-system-learning-kit/ti-rslk-max-edition-curriculum
The code examples for the TI-RSLK MAX curriculum can be downloaded here: https://www.ti.com/tool/TIRSLK-EVM-SW
You can learn how to set up Code Composer Studio with the code projects in Module 1. There is also programming with DriverLib. Here is an example of this style programming https://github.com/UCFInnovationLab/EGS_1006C_Fall19/tree/master/Lab9
You can also learn more about the topic of mechatronics from edX and apply your knowledge to any system. https://www.edx.org/course/mechatronics
There are also quite a few things that could be done with your MSP432 LaunchPad. Check out the examples available in the SimpleLink MSP432 SDK in the TI Resource Explorer and many references designs on ti.com. There are also many design projects on hackster.io featuring the TI-RSLK and MSP432.
TI Projects: https://www.hackster.io/texasinstruments/projects
TI Robotics Projects: https://www.hackster.io/texasinstruments/projects?category_id=106&sort=published
TI-RSLK Projects: https://www.hackster.io/texasinstruments/products/ti-robotics-system-learning-kit-ti-rslk?ref=project-f64be1&sort=updated
MSP432 LaunchPad Projects: https://www.hackster.io/texasinstruments/products/msp-exp432p401r-simplelink-msp432-launchpad?sort=updated
Apply to TIInterested in applying for TI internships and Full-time opportunities? Check out what's next at careers.ti.com. Be prepared for interview season at the beginning of each semester. Review your fundamentals from circuits and other classes. Apply online to as many opportunities as you can and visit TI at the career fairs at your school.
https://careers.ti.com/working-at-texas-instruments/
https://careers.ti.com/hiring-interview-process-2/
Comments