Otto DIY
This article details the hardware parts, software, and useful information needed to assemble and start up the Otto robot.
Links¶
-
OttoDIY:
-
OttoDIY+:
Components¶
OttoDIY¶
- Female-to-female pin cable
- ON/OFF button
- AAx4 battery holder
- Arduino Nano shield
- HC-SR04 ultrasonic sensor module
- SG90 servo: 4 units
- 5V buzzer
- Arduino Nano 328p
OttoDIY+¶
Assembly¶
The STLs for the printed parts are in the GitHub repository inside the 3D print directory.
For assembly, follow the PDF included at the root of the GitHub repository (at the time of writing this article it was version 07).
Calibration¶
Load the following program to find the trim settings needed to square the robot:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
By trial and error, identify the values of TRIM_RR, TRIM_RL, TRIM_YR, and TRIM_YL that make the four joints perfectly aligned. Once achieved, uncomment the line containing the Otto.saveTrimsOnEEPROM(); command and run it one more time so the values are stored in EEPROM. From then on, all sketches that use the Otto library and initialize that object through the init function with true as the fifth argument will load these calibration values from EEPROM and therefore will start with the robot properly aligned.
There are sketches in the repository that are not based on the Otto library but instead manage the servos directly. In these cases, trim management must also be done directly, since unfortunately the trim positions in EEPROM do not match the ones used by the Otto library, to avoid having to rewrite their values in EEPROM every time we switch from one type of sketch to another. For example, in the Otto_smooth_criminal sketch, which does not use the Otto library, the trims are read from EEPROM in reverse order. Therefore, it is better to disable that reading and write the trim values directly in the code. Like this:
1 2 3 4 5 6 | |
Programming¶
Among the various example sketches included in the repository, the most practical one to start doing custom programming for Otto is Otto_BASIC. The comments at the beginning describe the basic functions of the Otto library:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
In setup, a basic initialization of the Otto library is performed and a sound is emitted through the buzzer. Then in loop, a simple function has been programmed so Otto walks forward until it detects an obstacle at less than 15cm, then takes a few steps backward and turns.
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
It is useful to take advantage of the distance sensor functionality to trigger the Otto behavior we want to program. Otherwise, everything we program inside the loop function will run nonstop. So, for example, imitating the obstacleMode function, an example loop in which we make Otto advance a couple of steps when we place a hand in front of it, do a moonwalk to the right, take a small jump, and stop by executing the victory gesture would be:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |