Following the posts on servos and distance sensors, I thought I’d talk about the other peripherals we’re adding to Tigerbot.
A screen is an under-rated part of a PiWars robot. Its really handy not to have to cart a laptop around with you between events and have a way to check that the robot is in the mode you think it is (ask me how we know!). We found this little 128×64 pixel screen on ebay based on the SSD1306. And Adafruit has a lovely tutorial on how to use it.
It can be controlled over either I2C or SPI (just set the pattern of resistors on the back). With this, you can write your code to have a menu of “modes” (one for each event) switch between them using buttons on your controller and display the mode the robot thinks you’re in on the screen. No more laptop on the day!
- Another handy peripheral is an IMU. This is a combination Gyro, Accelerometer, Barometer and Thermometer all in one. Of most interest to us is the Gyro. This is a rate gyro – it tells you how fast the rate of rotation is changing (and NOT the absolute rate of rotation). This is a 3-axis device – it tells you about rotation around the X, Y, Z axes. To use it you generally have to calibrate it first – with the robot still and stationary, you take readings from each of the gyros for a while and record the output. These are your zero readings. All future readings from the gyro need to subtract the zero readings. The zero reading can vary with battery voltage and temperature, so be sure to re-calibrate it just before you use it! Now you can turn the rate into absolute rotation by taking lots of readings and integrating them.What use is a gyro? There are a couple of obvious events that could use a gyro:
- Straight line speed test
- here you’re trying to keep the robot pointed in the same direction all the way to the end
- Minimal maze
- for checking that your turns are exactly 90 degrees (if you’re using wheel rotations for this, how do you know if the wheel has slipped on the surface?)