There are two main kinds of motors we’ll be using on our robot: DC motors and servo motors. Most of the motors we use will be DC motors because they usually offer more power than servo motors. Additionally, servo motors can generally only move in a single direction, which, of course makes them a poor choice for applications like driving the robot.
Servo motors, however, can be useful because we can program them to move to a specific angle. DC motors, on the other hand can only be programmed to be “on” or “off” at a specified voltage. To tackle this limitation, we can use encoders and potentiometers.
Encoders are placed by a motor’s shaft to measure changes in the shaft’s rotation. By measuring this, we can determine the exact distance and speed a motor moves. This allows us to give our robot commands like “move 1 foot forwards” or “move at 2 inches per second.”
How they work: Encoders most often work by shining light onto an installed disk (containing some transparent and some opaque areas) and measuring patterns in the reflected light. They can also work by measuring the spinning of a magnet installed on a motor’s shaft.
Potentiometers also measure changes in a shaft’s rotation. Unlike encoders, however, they contain their own spinning piece that’s attached directly to the shaft. It’s the spinning of this piece that is used to measure the spinning of the shaft.
While potentiometers are much simpler components than encoders, they often are limited to rotating around a set number of times. Therefore, they should not be used to measure drivetrain motor rotation.
Overall Wiring Layout
Above is a sample robot electronics board. Let’s walk through what each component is:
- roboRIO: This is the microcontroller (small computer) that we program. It consists of a bunch of ports that we can interact with to collect sensor data, control motors, read camera data, etc.
- The most important part of the roboRIO is its CAN port. All motors and pneumatic solenoids are connected in a chain using CAN wire (the thin green and yellow cables). From the roboRIO’s CAN port, we can send data to and receive data from anything along this CAN chain.
- Radio: This generates a Wi-Fi network for your robot that we use to control and program it. We can also connect our computer directly to the robot using an ethernet cable.
- Ethernet switch: The radio consists of only two ethernet ports, so we can use an ethernet switch to add more ports if needed.
- Raspberry Pi: A Raspberry Pi is just a small, affordable computer. We connect a USB webcam to the Raspberry Pi and program it to collect useful data from the webcam’s footage. This allows us to automatically align the robot with certain targets.
- USB webcam
- RSL (Robot Signal Light): FRC rules require an RSL to be connected to the roboRIO. It indicates the status of our robot to those monitoring matches.
- Battery: Everything is powered by a large 12 volt battery.
- PDP (Power Distribution Panel): This connects to the battery and distributes power to every electrical component of our robot. It contains multiple fuses to prevent electrical components from receiving too much power and burning out.
- Motor controllers: Each of the eight small black boxes on the board is a motor controller. The motor controllers attach to each motor and control the amount of power sent to them.
- A unique ID number is given to each motor controller, which we use to represent the motor controllers in our code. To keep track of these IDs, each motor controller was given a piece of tape containing its ID number.
- Motor power levels are sent to each motor controller through the attached CAN wire.
- VRM (Voltage Regulator Module): This connects to the PDP and distributes power to devices with lower voltage requirements, such as the radio and ethernet switch.
- PCM (Pneumatic Control Module): Each solenoid is connected to the PCM, which is connected to the CAN chain.