We haven't added a photo or video of the finished project yet. Meanwhile, here is the wiring: every wire on the pin the instructions use.
The battery's “+” only goes through the removable link. The servo plugs into the receiver's CH3; the Arduino doesn't drive it.D2 is the board's digital pin 2, GND is ground. Red wires are power, black ground, the other colours signals (on a real servo the ground wire is often brown). In the steps, what a step adds is in colour and what is already connected in grey.
Your First Combat Robot: a Radio-Controlled Lifter
A small antweight-style combat robot: a FlySky transmitter, two N20 motors, a servo-driven lifter and a LiPo with a removable link. Wiring, code, the transmitter's failsafe and the safety rules for Robo Battle.
Written by the RoboHub team. A question? Write to us.
Variations
Choose a variation and the parts list updates.
Instructions
1
The rules and the weight class
Combat robots fight in weight classes. The most popular for beginners is the antweight: up to 150 g under UK rules and up to 1 lb (454 g) under US rules. Next comes the beetleweight: up to 1.5 kg under UK rules and 3 lb (1.36 kg) under US rules. This guide builds a small robot with wheels, radio control and a servo-driven lifter. Depending on the chassis it comes out at about 150–250 g, so weigh every part.
Before Robo Battle or any other event, read the organiser's rules: weight, size, the weapons allowed and the safety requirements are all written there.
2
The chassis and the weapon
Make the chassis from a 3D print (PETG or TPU are better than the more brittle PLA), HDPE or polycarbonate: these materials don't shatter when hit. The three common weapon types:
Wedge: an angled front plate that gets under the opponent. The simplest and the safest.
Lifter: an arm on a servo that lifts the opponent and tips it over. This guide builds this one: a wedge and a lifter together.
Spinner: a fast-spinning disc or bar. The most dangerous: it needs a brushless motor, an ESC, a weapon lock and experience, so we don't recommend it for a first robot.
Fix the lifter arm to the MG90S's horn and mount the servo so that hits land on the chassis, not on the servo's gears.
3
The drive
Fix the two N20 motors with their mounts to the sides of the chassis and push the wheels onto the shafts. The wheels should stand slightly taller than the chassis, so the robot can still drive when it's flipped. Solder wires onto the motors and cover them with heat-shrink: wires get torn off in fights. Solder the header pins onto the Nano and the TB6612 too.
4
Power and the removable link
The removable link switches the whole robot off, and most events require one. Mount an XT30 female connector on the chassis where you can reach it. The battery's “+” goes to one of its contacts, and from the other contact a wire runs to the TB6612's VM and the converter's IN+. The link itself is an XT30 male plug with its two pins joined by a short, thick wire: plug it in and the robot is on, pull it out and it's off.
The battery's “−” goes to the TB6612's GND and the converter's IN−. Solder an XT30 male connector onto the robot for the battery. Check every polarity twice: a LiPo connected the wrong way round burns the electronics in a second.
Removable link (XT30)IN→ → 2S LiPo+
TB6612FNG driverVM→ → Removable link (XT30)OUT
5 V converterIN+→ → Removable link (XT30)OUT
TB6612FNG driverGND→ → 2S LiPo−
5 V converterIN−→ → 2S LiPo−
5
The 5 V rail
The converter turns the battery's 7.4–8.4 V into a steady 5 V. Connect OUT+ to the Nano's 5V pin, the TB6612's VCC and the receiver's “+”, and OUT− to the Nano's GND and the receiver's “−”. The Nano's VIN isn't used here: its small regulator could not take the servo's current.
5 V converterOUT+→ → Arduino Nano5V
TB6612FNG driverVCC→ → 5 V converterOUT+
FS-iA6B receiver+→ → 5 V converterOUT+
5 V converterOUT−→ → Arduino NanoGND
FS-iA6B receiver−→ → 5 V converterOUT−
6
Motors and driver
The left motor goes to the TB6612's AO1 and AO2, the right one to BO1 and BO2. Control: PWMA → D5, AIN1 → D7, AIN2 → D8, PWMB → D6, BIN1 → D4, BIN2 → D12, STBY → D9. D2 and D3 stay free for the receiver: they are the Nano's two external interrupt pins.
TB6612FNG driverAO1→ → Left motor1
TB6612FNG driverAO2→ → Left motor2
TB6612FNG driverBO1→ → Right motor1
TB6612FNG driverBO2→ → Right motor2
TB6612FNG driverPWMA→ → Arduino NanoD5
TB6612FNG driverAIN1→ → Arduino NanoD7
TB6612FNG driverAIN2→ → Arduino NanoD8
TB6612FNG driverPWMB→ → Arduino NanoD6
TB6612FNG driverBIN1→ → Arduino NanoD4
TB6612FNG driverBIN2→ → Arduino NanoD12
TB6612FNG driverSTBY→ → Arduino NanoD9
7
The receiver and the weapon servo
Each channel on the FS-iA6B has three pins: signal, “+” and “−” (check the label on the receiver). Connect CH1's signal to D2 and CH2's signal to D3. Plug the MG90S's lead straight into CH3 (the orange wire is the signal): the left stick moves the lifter and the Arduino stays out of it. Route the receiver's antennas inside the chassis, away from metal: metal blocks the signal.
FS-iA6B receiverCH1→ → Arduino NanoD2
FS-iA6B receiverCH2→ → Arduino NanoD3
FS-iA6B receiverCH3→ → MG90S lifter servoSIG
FS-iA6B receiver+→ → MG90S lifter servo+
FS-iA6B receiver−→ → MG90S lifter servo−
8
The pin table
Every connection from the steps above, in one table. Key: LINK is the removable link's XT30 socket (1 and 2 are its contacts), BUCK the 5 V converter, RX the receiver, S a signal pin, and M-L and M-R the left and right motors. CH1 steers, CH2 drives forwards and backwards, and PWMA and PWMB set the motors' speed. "-" means the pin isn't used.
Check each wire with a multimeter before the first power-up.
An FS-i6X and its FS-iA6B usually come already bound. If not, put the bind jumper on the receiver's B/VCC pins, power the receiver and switch the transmitter on while holding its BIND button.
The failsafe is essential: without it the receiver holds the last positions when the signal is lost, and the robot keeps going. On the transmitter open Functions setup → Failsafe. Set CH1 and CH2 with the stick in the middle and CH3 with the lifter down: switch each to On and hold CANCEL to save. If a stick works the wrong way, reverse its channel under Functions setup → Reverse.
10
Upload the code
Keep the removable link out while uploading: the Nano runs from USB and the motors can't move. Choose “Arduino Nano” as the board and “ATmega328P” as the processor (“Old Bootloader” if the upload fails). The code only switches the motors on while the transmitter's signal is there and both sticks have been centred, and switches them off when the signal is lost.
Arduino C++
// Beginner combat robot (antweight style):// FlySky FS-iA6B receiver -> Arduino Nano -> TB6612FNG -> two N20 motors.// Right stick (Mode 2, as the FS-i6X ships): CH1 left/right steers, CH2 up/down drives.// The weapon servo plugs straight into the receiver's CH3 (left stick); the Arduino only drives the wheels.// Safety: the motors stay off until both sticks are centred, and stop when the signal is lost.constint CH1_PIN = 2; // receiver CH1 signal (an interrupt pin)constint CH2_PIN = 3; // receiver CH2 signal (an interrupt pin)// TB6612FNG motor driverconstint PWMA = 5; // left motor speed (PWM)constint AIN1 = 7;
constint AIN2 = 8;
constint PWMB = 6; // right motor speed (PWM)constint BIN1 = 4;
constint BIN2 = 12;
constint STBY = 9; // LOW = both motors offconstint LED = 13; // on = armedconstint DEADBAND = 40; // microseconds around the centre (1500) that count as "stick released"constint MAX_PWM = 200; // 6 V motors on a 2S pack (7.4-8.4 V): keep the average near 6 Vconstunsignedlong SIGNAL_TIMEOUT_MS = 100; // no pulse for this long = stop// Written by the interrupts, read in loop()
volatile unsignedlong rise1 = 0, rise2 = 0;
volatile unsignedint width1 = 1500, width2 = 1500; // pulse widths in microseconds
volatile unsignedlong seen1 = 0, seen2 = 0; // millis() of the last good pulsebool armed = false;
void onCh1() {
if (digitalRead(CH1_PIN) == HIGH) {
rise1 = micros();
} else {
unsignedlong w = micros() - rise1;
if (w >= 900 && w <= 2100) { // ignore anything that is not a servo pulse
width1 = w;
seen1 = millis();
}
}
}
void onCh2() {
if (digitalRead(CH2_PIN) == HIGH) {
rise2 = micros();
} else {
unsignedlong w = micros() - rise2;
if (w >= 900 && w <= 2100) {
width2 = w;
seen2 = millis();
}
}
}
// Both motors at once, -255..255 each (negative = backwards)void drive(int left, int right) {
left = constrain(left, -MAX_PWM, MAX_PWM);
right = constrain(right, -MAX_PWM, MAX_PWM);
digitalWrite(AIN1, left > 0 ? HIGH : LOW);
digitalWrite(AIN2, left < 0 ? HIGH : LOW);
digitalWrite(BIN1, right > 0 ? HIGH : LOW);
digitalWrite(BIN2, right < 0 ? HIGH : LOW);
analogWrite(PWMA, abs(left));
analogWrite(PWMB, abs(right));
}
// Stick position from -255 to 255; 0 inside the dead bandint stick(unsignedint width) {
int offset = (int)width - 1500;
if (abs(offset) < DEADBAND) return 0;
return constrain(map(offset, -500, 500, -255, 255), -255, 255);
}
void setup() {
pinMode(STBY, OUTPUT);
digitalWrite(STBY, LOW); // motors off from the first moment
pinMode(PWMA, OUTPUT);
pinMode(AIN1, OUTPUT);
pinMode(AIN2, OUTPUT);
pinMode(PWMB, OUTPUT);
pinMode(BIN1, OUTPUT);
pinMode(BIN2, OUTPUT);
pinMode(LED, OUTPUT);
pinMode(CH1_PIN, INPUT);
pinMode(CH2_PIN, INPUT);
attachInterrupt(digitalPinToInterrupt(CH1_PIN), onCh1, CHANGE);
attachInterrupt(digitalPinToInterrupt(CH2_PIN), onCh2, CHANGE);
}
void loop() {
// Copy what the interrupts wrote, with interrupts paused so nothing changes halfway
noInterrupts();
unsignedint w1 = width1, w2 = width2;
unsignedlong s1 = seen1, s2 = seen2;
interrupts();
unsignedlong now = millis();
bool signalOk = s1 != 0 && s2 != 0 && now - s1 < SIGNAL_TIMEOUT_MS && now - s2 < SIGNAL_TIMEOUT_MS;
int turn = stick(w1);
int throttle = stick(w2);
if (!signalOk) {
armed = false; // no radio: stop and disarm
} elseif (!armed && turn == 0 && throttle == 0) {
armed = true; // arm only with both sticks centred
}
if (!armed) {
drive(0, 0);
digitalWrite(STBY, LOW);
digitalWrite(LED, LOW);
return;
}
digitalWrite(STBY, HIGH);
digitalWrite(LED, HIGH);
drive(throttle + turn, throttle - turn); // arcade mixing: stick right = left wheel faster
}
11
The first test
Put the robot wheels-up (on a box, for example). Always switch the transmitter on first and then plug the link in; to switch off, do the opposite: link out first, then the transmitter. Centre both sticks: the Nano's LED lights and the robot is ready. Push the right stick forward: both wheels should turn forwards. If one turns backwards, swap its two wires. Try the lifter with the left stick.
Finally switch the transmitter off while the wheels are turning: they must stop and the lifter must drop. Repeat this test before every fight.
12
If something doesn't work
The LED doesn't light: is the transmitter on and bound? Are the signal wires on the right pins (CH1 → D2, CH2 → D3)? Has a stick's trim moved so far that the centre is no longer 1500?
The robot steers the opposite way to the stick: reverse CH1 on the transmitter (Reverse).
The robot creeps with the sticks released: raise DEADBAND (up to 60, say) or re-centre the trim on the transmitter.
The Nano restarts during a fight: the battery is flat or a wire is loose. A capacitor across the converter's output (220 µF, for example) helps.
The servo buzzes and gets hot: the arm is pushing against something at its end position. Reduce CH3's end points (End points) on the transmitter.
13
LiPo: charging and storage
Charge the LiPo only with a balance charger (an IMAX B6AC, for example), in LiPo BALANCE mode, with the right cell count (2S) and at 1C: 0.4–0.5 A for a 450 mAh battery. Never leave it charging unattended, and keep it on a non-flammable surface or in a LiPo fire-safe bag.
After a fight, wait until the battery cools down before charging it. Don't let a cell drop below 3.3 V: check the cell voltages with the checker. If the battery won't be used for a few days, bring it to about 3.8 V per cell with the charger's STORAGE mode. Never use a swollen, dented or overheated LiPo.
14
The arena and match day
Carry the robot to and from the arena with the link out. Plug the link in only inside the closed arena, when the referee says so, and take your hands away at once. Switch the transmitter on only when it's your turn, and don't use anyone else's channel unless the organiser says otherwise.
Wear safety glasses when testing and repairing. At most events the robot goes through a technical check: weight, the link, the failsafe and sharp edges. Read the rules in advance so your robot doesn't fail the check.
A small autonomous robot for the mini-sumo class (10 × 10 cm, up to 500 g): it waits 5 seconds after the start, finds the opponent with an ultrasonic sensor and pushes it out of the ring, while sensors underneath watch the white edge so it never drives out itself.
Five infrared sensors measure how far the robot has drifted off the line, and a PID controller corrects the motors smoothly and fast. Built for competitions: the track, the sensor bar, the code and how to tune it.
The FS-iA6B receiver passes every channel of the transmitter to the Arduino over a single wire (i-BUS). That way the transmitter can drive servos, lights or your own robot.