Return to Robotics Tutorials

C2Bot Robot Project

C2Bot is an ongoing robotics project intended as a learning opportunity in exploring various robot technologies and methods.

What can C2Bot do?

C2Bot Robot Prototype

The following lists some of the features that are currently implemented:

  • ZigBee telemetry Remote control - XBee Pro S1
    ZigBee wireless control allows two-way communication with the robot from a custom telemetry controller. The two-way controller provides joystick control over the robot and also visualization of the sensors and modes in the robot.
  • RC Remote control - Turnigy 9X
    9 channel 2.4GHz RC transmitter is intended for controlling the robot drive, robot arm movement and overall operating modes (manual vs autonomous). Of the 9 channels, there are two dual-axis joysticks, two rotary knobs, a 3-position switch and numerous on/off switches. With the stock 100mW power output, range is currently untested, but is expected to be approx 50m-1000m. An ATtiny167 (Digispark Pro) is used to convert the RC PWM signal into an I2C interface for the robot CPU.
  • PS2 Remote control - Lynxmotion PS2
    As an alternate control scheme, C2Bot supports operation via a PS2 controller. Controller provides two thumb joysticks and 8 digital input buttons.
  • 4WD Robot Platform - Lynxmotion A4WD2 Rover
    Solid robot platform built with aluminum and lexan, supports approximately 5 lbs of payload. Lexan is lightweight yet extremely strong. Multiple add-on levels to house the sensors and control circuitry.
  • 6 DoF Robot Arm
    A six degree-of-freedom arm with base rotate allows the robot to grab and manipulate objects nearby. The servo motors are sized according to the required torque at each joint. In the future, I plan to convert these servos to provide positional feedback so that the robot arm can have closed-loop control.
  • First-Person Video (FPV)- Raspberry Pi Camera & Boscam
    A pair of cameras are mounted on the robot. A Raspberry Pi Camera is mounted in a fixed position on the front of the robot, intended to be used for on-board robot vision (using OpenCV) though this has been superseded by the JeVois system. This camera also streams video over WiFi to any web browser. A second camera is mounted in the robot's head allowing high-quality low-latency remote control operation. A 5.8GHz A/V transmitter and receiver pair can support long-range control over the robot from a remote LCD display.
  • Machine Vision- JeVois
    An additional camera has been mounted to provide machine-vision explorations. The camera integrates a quad-core ARM-v7 processor that is capable of running OpenCV and basic neural networks. The initial goal for this system was to aide in enabling the robot to follow pathways (such as a sidewalk) when GPS waypoints were not precise enough.
  • High torque motors - Pololu 12v 30:1 gear motors (64 CPR)
    These strong motors provide enough torque (8kg-cm) to drive the robot over some inclines and easily skid-steer on thick carpet. Integrated quadrature encoders (64 counts per motor rotation) enable basic odometry robot positioning. Dual motor controller provides differential drive with PID closed-loop control to maintain precise wheel speed.
  • 9-axis Inertial Measurement - InvenSense MPU-9255
    A MEMS device integrating 3-axis angular rate sensors (gyros), 3-axis accelerometer and 3-axis digital compass. Sensor fusion combines these inputs to assist with general robot orientation and turn management.
  • GPS positioning - uBLOX NEO-M8N GPS
    Satellite positioning provides general navigation assist for long-range waypoint planning. Onboard ATtiny extracts the position, speed and heading from the GPS via UART.
  • LIDAR laser range-finding - Neato XV-11 LIDAR
    A scanning LIDAR sensor has recently been added to assist in mapping and obstacle avoidance.
  • Ultrasonic ranging - HC-SR04
    A set of ultrasonic sensors provide medium-range distance measurement for navigation.
  • Infra-Red ranging - Sharp IR sensors
    A set of infra-red sensors provide close-range distance measurement for obstacle avoidance.
  • Wireless Access Point
    C2Bot provides its own wireless access point so that I can connect to it with my iPhone outside of my home wireless LAN.
  • Speech synthesis
    C2Bot can speak using text-to-speech. On-board 3W audio amplifier is mated with an 8ohm speaker.
  • LED Matrix eyes
    To add some personality to the robot for my young son, I added some animated eyes with a pair of 8x8 LED matrices. The LED eyes look around and blink according to the robot's activity. The head can be controlled remotely with a pan and tilt servo. The head was 3D-printed and incorporates a 5.8GHz FPV camera.

Latest Updates

  • 2017/06/17: C2Bot was on display at Science World as a part of the Pi Makers exhibit!
  • 2017/06/13: First 3D print attempt at the construction of the pan & tilt head containing the LED matrix eyes and integrated 5.8GHz wireless video camera.
  • 2017/04/25: Testing of computer vision system, plans for object tracking and road/path following.
  • 2017/02/05: First time driving robot around block using GPS and FPV remote video.
  • 2016/12/24: Released GUIslice open source embedded graphics library for Raspberry Pi & Arduino, used in the telemetry controller.
  • 2016/10/03: Initial testing of scanning LIDAR sensor, next step is to implement collision avoidance algorithm based on the lidar point cloud.
  • 2016/09/18: Telemetry controller visualizes IR sensor data. Initial attempts at simple wheel speed odometry (robot positioning) using motor controller input over time (wheel encoders would be next).
  • 2016/09/14: Robot movement now driven by telemetry controller. Zigbee link bandwidth increased.
  • 2016/08/20: Robot telemetry controller prototype with ZigBee and touchscreen TFT LCD.
  • 2016/08/17: Write SDL GUI library in C to control TFT touchscreen (PiTFT)

Next Steps

  • ZigBee wireless
    • Debug intermittent data transmission errors
  • Robot Positioning
    • Add Arduino processor for real-time quadrature encoder measruement and perform odometry calculations
    • Add GPS waypoint navigation mode (convert current and destination positions to heading and distance)
  • Sensors
    • Add 10uF bypass capacitors to Sharp IR sensors to reduce noise. Currently a large amount of averaging is required to produces stable distance measurements.
  • Electronics
    • Rewire robot to use new power distribution system (increase maximum current draw)
    • Replace prototype breadboards with more permanent wiring layouts. Later print a custom PCB
  • Robot Vision
    • Learn OpenCV and implement basic color / object tracking
  • Construction
    • Learn 3D printing and build housing for robot head. The robot head contains LED matrices and FPV camera above a Pan & Tilt servo mechanism.
    • Use 3D printing to build telemetry controller frame. Start by replacing the prototype foam board with Sintra sheets

C2Bot Bus Architecture

The following diagram describes the way in which the I2C, SPI and UART buses are connected together, linking a Raspberry Pi to multiple AVR / Arduino "coprocessors" and the sensors.

Click on the diagram to load a full-size version.

C2Bot Robot Bus Architecture

C2Bot Power Distribution

The following diagram describes the way in which the 3 NiMH batteries are connected up to the robot's various processors, controllers and sensors.

  • 12v NiMH 2800mAh - Main battery source powers the 4 drive motors (via the dual-channel 2x15A RoboClaw motor driver). This battery is also used to power the other 12v devices (audio amplifier, 12v LEDs via relay, the 5.8GHz FPV camera and the 5.8GHz A/V transmitter).
  • 6v NiMH 2800mAh - This battery powers the high current 6v and 5v peripherals. A high current BEC (Battery Eliminator Circuit) steps down the voltage to 5v for the LED Matrix and the InfraRed (IR) sensors.
  • 6v NiMH 1600mAh - A separate 6v battery is used to drive the Raspberry Pi CPU and the low-current peripherals that are attached to the 5v and 3.3v GPIO power rails.

Click on the diagram to load a full-size version.

C2Bot Robot Power Distribution

What processors power C2Bot?

C2Bot incorporates a number of microcontrollers that communicate with each other, leveraging the strengths of each processor.

  • Raspberry Pi - Primary application processor
    The Pi runs the high-level application code (in C), which is responsible for WiFi connectivity, remote command interface, autonomous navigation, etc. I plan to replace the existing Raspberry Pi B+ with a Raspberry Pi 3 shortly.
  • Raspberry Pi - Remote telemetry controller
    Another Raspberry Pi runs the touchscreen TFT LCD and ZigBee transceivers.
  • Digispark Pro / ATtiny167 - RC Receiver interface
  • Digispark / ATtiny85 - Motor control watchdog timer
  • RoboClaw 2x15A - Dual channel Motor controller. Reponsible for PID closed-loop / feedback control over the drive wheel speed.


Reader's Comments:

Please leave your comments or suggestions below!

So we actually fixed the bug if you are curious. Not entirely sure why it worked but we had to simultaneous issues occurring.

One we realized upon powering up the PCB/Prototype board placing a switch on the i2c line prevented the ATTiny's from pulsing oddly. it seemed that powering up the Pi with the i2c line would sometimes cause the line to enter some odd state with constant pulses and noise. Not sure if it was the Tiny's or the Pi so we inserted a switch.

We also found out that by adding capacitance to the line solved our reliability issue. I think we had relatively fast communication between the two and since we are only receiving small bits of data it wasn't a clock stretching bug. Not sure why adding capacitance helped but it did. We currently have 1 Attiny85 (Controlling Ultrasnoics), 1 Attiny84 (Controlling rotatry encoder data and talking to the L239 Motor driver) and a LSM303 on the i2c line and its become very stable.
 Glad to hear that you figured it out! It isn't obvious to me what issues may have been at play here without seeing a logic trace, but the important thing is that you managed to get reliable communication working now! Thanks for sharing the details, Ryan and good luck on the rest of your project!
 I am using a similar setup for a senior design project. A Raspberry Pi3 with an Attiny85 over i2c connected to ultrasonic sensors and an Attiny84 connected to Servos. We have issues where we lose the i2c connection which we check via i2cdetect and we have to cycle the power of the Attiny to get them to reconnecte. I know you've mentioned some issues have you experienced something similar?
 Hi Ryan -- I had encountered frequent data corruption cases on I2C between the Raspberry Pi and an ATtiny, primarily due to the RPI I2C Clock Stretching bug. If I recall correctly, I resolved these issues by coding the ATtiny write ISR to be as fast as possible but insert an extended number of wait states in the I2C read response. This enabled me to have error-free transmission without resorting to CRC. If you want more details on this, please let me know.

The fact that you lose I2C connection (as evidenced by I2C detect failing) might not be pointing to the same problem. It should be relatively easy to pinpoint your problem in the hung state by attaching a logic analyzer to the I2C bus after i2cdetect shows a failure. If you could send me the waveform trace I could try to help out.


Leave a comment or suggestion for this page:

(Never Shown - Optional)