Skip to content

RoboBoard X4

Programming

This section contains RoboBoard X4 functionality documentation and usage examples.
An objective API is available to control the board - X4.<feature>.<function>().
X4 - main board group containing all the features.
<feature> - features that are supported by X4 (listed below).
<function> - functionality that is available for each feature.

For more information click on specific feature:

  • | Board info - General board information like version and battery status.
  • | MEMS - Accelerometer and Gyroscope.
  • | GPIO - General purpose input output pins. Similar like Arduino boards.
  • | Config - RoboBoard X4 settings.
  • | Button - Programmable button.
  • | Led - Status LED.
  • 🚥 | RGB - Bright color LEDs.
  • | DC - DC motor to spin wheels.
  • | Servo - Servo motor for positioning or steering.
  • | Module - Connected TotemBUS modules information.
  • :fontawesome-solid-mobile-alt: | Function - Events sent from mobile Totem App.

Feature details

It's our latest control board containing powerful processor and motor drivers. Just plug in battery, motors and everything will work without any soldering or customization. Look bellow for a brief list of available functionality.

Processor:
• ESP32 module (ESP32-D0WD)
• Dual-core 240Mhz (Xtensa® LX6)
• 520KB SRAM (328KB usable)
• 8MB flash

Connectivity:
• Wi-Fi (up to 150 Mbps)
Bluetooth (BLE)
• Totem BUS
• USB port

Extensions:
• Totem BUS (attach Totem modules)
• Qwiic® (over 100 third-party modules available)
• 4 programmable GPIO pins

On-board features:
• 3 Servo channels (5 Volts)
• 4 DC channels (11.1 Volts, 1 Amp each)
• 4 GPIO channels
• 4 bright RGB LED
• MEMS sensor (gyroscope and accelerometer)
• Programmable button
• Reset button
• Status LED
• On/off switch
DC & battery input, integrated charger

Power:
DC adapter: 30W, 15V, 2A, 5.5/2.0mm center-positive connector
• Battery: 3S Li-Ion 11.1V 2200mAh, JST-VH connector

Dimensions:
• 7x5x1.4 cm (L x W x H)

X4 Board image front

X4 Board image back

X4 Board image front
Revision v1.0 is not sold anymore.

X4 Board image front
Revision v1.0 is not sold anymore.

ESP32 240Mhz processor

Board is powered by dual-core 240Mhz ESP32 processor with 8MB of flash. It's very popular among Arduino community and has built-in WiFi and Bluetooth technologies. This allows to communicate with a smartphone wirelessly and run user code inside. Not only that - it can connect to the Internet to unlock unlimited possibilities. You can find many example code and tutorials for this MCU.

3 Servo channels

5 Volt servo motor channels marked with letter A, B, C. Can be controlled individually.
Most servo motors can turn it's arm 180 degrees. 0° - center, 90° - left, -90° - right. Pulse duration is 500μs-2500μs (can be modified with setPulseMinMax()). It corresponds with percentage of turn: 0% - center, 100% - left, -100% - right. X4 functions accepts percentage (pos()), angle (0°-180°) (angle()) and microsecond (pulse()) parameters.
Servo angle visualization:
Servo arm angles

X4.servoA.pos(100); // Set channel A to 90° angle
X4.servoB.pos(0);   // Set channel B to 0° angle
X4.servoC.pos(-50); // Set channel C to -45° angle

4 DC channels

11.1 Volt DC motor channels marked with letter A, B, C, D. Can be controlled individually.
Allows to control motor spin direction, power (speed) and braking. Some more features like modifying frequency and playing tones are available. X4 passes current from connected battery and controls output voltage with PWM. The higher the voltage, the faster motor will spin. Maximum voltage may vary depending on battery state of charge (8.4V-12.6V).
Power values corresponds with percentage:
0% - (no power, 0.0V)
100% - (full power forward, 11.1V)
-100% - (full power backward, -11.1V)

X4.motorA.power(100); // Set channel A to spin forward (11.1V)
X4.motorB.power(0);   // Set channel B to power off (0.0V)
X4.motorC.power(-100); // Set channel C to spin backward (-11.1V)
X4.motorD.power(-25);  // Set channel D to spin backward (-2.78V)

4 GPIO channels

4 integrated GPIO pins are available to hook up simple IO or communications (UART, I2C, SPI, ...). It can be used for custom implementations, modules and other creative things. Using standard Arduino programming they can be accessed same as with TotemDuino.
Connector pinout: VCC - 3.3V source. GND - ground. A, B, C, D - GPIO pins.
For more information read X4 GPIO section.

Module X4 GPIO

X4.gpioA.digitalWrite(HIGH); // Set Pin A to 3.3V
X4.gpioA.digitalWrite(LOW);  // Set Pin A to 0V (GND)
int state = X4.gpioA.digitalRead(); // Read Pin A state.
// state == HIGH - connected to VCC, state == LOW - connected to GND
Serial.println(state == HIGH ? "HIGH" : "LOW");

Values from 0 to 20. 50hz modulation.

X4.gpioA.analogWrite(20); // Set Pin A to 3.30V
X4.gpioA.analogWrite(10); // Set Pin A to 1.65V
X4.gpioA.analogWrite(0);  // Set Pin A to 0.0V

Measure potentiometer position connected to pin C. Wiring:
Potentiometer connection

int value = X4.gpioC.analogRead(); // Read value of potentiometer
Serial.println(value); // Print value

🚥 4 RGB LED

Back side of the board contains individually controllable RGB LED. Each one can be set to particular color and brightness. Also supports fade animations.

Module X4 RGB led

X4.rgbA.color(0, 255, 0); // Set LED A to GREEN color.
X4.rgbB.color(255, 255, 0); // Set LED B to YELLOW color (RED+GREEN).
X4.rgbC.color(255, 255, 0); // Set LED B to YELLOW color (RED+GREEN).
X4.rgbD.color(0, 0, 255); // Set LED D to BLUE color

Totem BUS

Totem BUS connectors allows to expand X4 functionality by attaching Totem modules and control them using Arduino code. Each module is identified by it's number in a white square. For reference of each module check Modules information.
Modules can be connected in any order and daisy-chained. Connector provides power and communication.

Module11 module; // Define connected module
void setup() {
  // Call function to change distance sensor RGB color to green
  module.rgb.color(0, 255, 0);
}

Qwiic

Qwiic is a connection system introduced by SparkFun. It uses standard JST connector across all electronics, so it would work straight away, without a need to think about compatibility. There are many compatible boards from different manufacturers and RoboBoard X4 is one of them. Read Qwiic section to find out how to use them.

MEMS sensor

MEMS is a 3-axis accelerometer and 3-axis gyroscope allowing to measure board movement and angles. Very useful in many robotic projects. This chip is connected to I2C line (same as Qwiic connector) and can be used trough standard Arduino code. Read mode in MEMS section.

USB port

miniUSB connector is present for code upload from PC to X4 board.
X4 board cannot be powered from USB! It requires either DC or battery input.

Bluetooth

Uses BLE to advertise board appearance. This allows to connect it with smartphone using Totem App. This process is running in background, alongside your written Arduino code. Option ToolsApp controlEnabled must be selected to enable this feature. Also X4.enableAppControl() can be called inside void setup() function to enable this option programmatically.

Documentation and examples of BLE DIY solutions can be found in TotemArduinoBoards repository.

WiFi

ESP32 has integrated WiFi capability. It can be used to connect to home network and access Internet. From there possibilities are endless.

Documentation and examples of WiFi DIY solutions can be found in TotemArduinoBoards repository.

LED indications

Red LED next to DC jack - indicated battery charging status:
Blinking - battery not detected .
On - battery is charging .
Off - battery is charged .
NOTE: sometimes LED can start blinking when battery is charged.

Red LED next to user button for indicating board state:
Short rapid blink - board started or indicated.
Blinking constantly - driver initialization error (consult forum).
On - running.

Board state LED can be overridden:

X4.led.on(); // Turn LED On
X4.led.off(); // Turn LED Off

User button

By default this button is inactive and left for user implementation.
Example code how to turn off LED on button press:

void setup() { }

void loop() {
  if (X4.button.wasPressed()) {
    X4.led.off();
  }
  else if (X4.button.wasReleased()) {
    X4.led.on();
  }
}

On/off switch

Used to turn X4 board power on or off without disconnecting DC jack or battery.
Battery can be charged while button is set to OFF position.

DC input

15V DC input for powering board and charging battery.
Recommended to use only supplied DC power adapter.
Specifications: 30W, 15V, 2A, 5.5/2.0mm center-positive connector.

Battery input

Battery input for connecting 11.1V Li-Ion battery.
Recommended to use only supplied battery.
Specifications: 3S Li-Ion 11.1V 2200mAh, JST-VH connector.

Charging indication: LED indications