Creating your own T-Bot Controller
MIT App Inventor
What you need to know before building your T-Bot app.
Communication with the T-Bot is handled as strings sent over Bluetooth. Strings you can send are of the form:
STX200200ZETX
where STX is a control character meaning ‘Start of Text’. In python this is invoked with chr(0X02) in App Inventor you can use the convert number block with the base 10 to hex option selected acting on “2” as a string. Similarly, for ETX the 2 is replaced with 3.
The numbers after the STX are made up of two three digit numbers ranging from 100 to 300 with 100 being the maximum in the negative direction and 300 being the maximum in the positive direction. The first number controls the turning speed of the T-Bot while the second controls the forward and reverse speed.
The letter before ETX is used to adjust parameters such as PID gains and trim. Z is used to pad out the string when no tuning characters are required.
| Letter | Fiels | Increment |
|---|---|---|
| A | KPS | -0.01 |
| B | KPS | 0.01 |
| C | KP | -0.01 |
| D | KP | 0.01 |
| E | Trim | -0.01 |
| F | Trim | 0.01 |
| T | Auto Trim | - |
Incoming strings will be of the form:
STX1.43,2.34,0.01,90.35ETX
This is all you need to know about the T-Bot before building your App. Of course, the T-Bot is fully programmable so you can change this if you choose.
Building your App
If this is your first time using App Inventor, you should follow this link.
There are two main steps to building your application.
The Designer Window
The Designer Window allows you to build the visual layout of your application. This is very straight forward for the T-Bot controller. We include a few simple images such as a background, a joystick image and some simple icons. These are all included in the aia file you can find here.
You will have to include the following non-visible components too: Activity Starter, Bluetooth Client, Clock, Notifier, and TinyDB.
The Blocks window
The objects created in the designer will have certain properties and methods which can be associated with them. This can be done in the Blocks window.
Have a look at the blocks page when you have imported the aia file.
Create an App Inventor account here. You can find the .aia file here which can be imported in to App Inventor. The blocks will look like this: