ECE4180 Design Project: RF Controlled Robot with LCD Display on Custom PCB Controller

-insert picture of final design-

Overview

The goal for this project is to create a robot that can be remote controlled from 200 feet away (indoors) using RF transceivers (Will be much higher if outside in open space). The robot will have a custom PCB board on it containing the H-Bridge, mbed, Raspberry Pi 2, and one of the two TI CC1101 RF transceivers. The robot will also contain a servo which has the Raspberry Pi camera connected to it. The remote control will be another custom PCB board, containing a Raspberry Pi Zero, the other TI CC1101, another mbed, the TFT display, and two joysticks. One joystick will control the robot's movement, and the other will move the camera around, which feeds the TFT display.

Group Members

  • Brydan Rogers (Section B)
  • Peter Mei (Section B)
  • Matthew Kennedy (Section A)
  • Joshua Baldwin (Section A)

Video Demo

Block Diagram

http://i.imgur.com/0YOaaYV.jpg

Components

  • Raspberry Pi 2

/media/uploads/iemretep/rpi2.jpg

  • Raspberry Pi Zero

/media/uploads/iemretep/rpi0.jpg

  • Raspberry Pi Camera

/media/uploads/iemretep/pi_cam.jpg

  • 2x mbed LPC1768

/media/uploads/iemretep/pinout.png

  • Adafruit 5" TFT Display

/media/uploads/iemretep/screen.jpg

  • 2x TI CC1101

/media/uploads/iemretep/ticc1101.jpg

  • ECE4180 Robot Kit

/media/uploads/iemretep/robot.jpg

  • 2x 27800 Joysticks

/media/uploads/iemretep/joystick.png

  • H-Bridge

/media/uploads/iemretep/hbridge.png

PCB Schematics

Controller:

/media/uploads/iemretep/controller_pcb.png

Robot:

/media/uploads/iemretep/robot_pcb.png

Video Transmission (RPis)

The video transmission ended up being a bit harder than anticipated. First, the bandwidth available with the TI cc1101 isn't quite adequate to transmit usable video. A larger, higher bandwidth chipset is necessary to send usable video. As a fallback, we transmitted video over WiFi.

This led to the second problem. The Broadcom SoC used as the CPU/GPU in the Raspberry Pi has special h264 video encode/decode hardware built in. While it would be great to use this hardware to compress the video for transmission, there unfortunately isn't great software support for the encoding acceleration. For example, the built in raspivid program used to stream camera video accepts a bandwidth parameter, but encodes using the CPU instead of using hardware acceleration.

Because of the limited video encoding performance, the CPU quickly becomes saturated with encoding/decoding video transmission. As a result, we had to pick a trade-off between video frame rate, latency, and resolution. We decided that latency and frame rate were most important, so we had to make the resolution tiny, as you can see in the video above.

On the transmitting side we used raspivid, piped to netcat to send the video frames over the network. On the receiving side, netcat receives the stream, and hands it to mplayer.

Robot side:

Controller side:

Raspberry Pi cc1101

Our code for the cc1101 interface is based on f4exb's code on GitHub: https://github.com/f4exb/picc1101.

Our modifications allow for sending raw packets from one end to the other, in addition to parsing and printing the serial to and from the mbeds on each end of the link.

Our code is located here: https://github.com/mck1117/picc1101. All of the interesting goodies are down near the end of main.c.

mbed Code

Controller Code

#include "mbed.h"
#include "Motor.h"

//Sends joystick positions to robot

AnalogIn jx1(p17);
AnalogIn jy1(p18);
AnalogIn jx2(p19);
AnalogIn jy2(p20);

Serial rpi(p9,p10);

int main()
{
    rpi.baud(9600);
    
    while(1) {
            float x1_robot = 2*jx1-1;
            float y1_robot = 2*jy1-1;
            float x2_camera = 2*jx2-1;
            float y2_camera = 2*jy2-1;
            
            x1_robot = x2_camera;
            y1_robot = y2_camera;
            
            rpi.printf("%f %f %f %f\r", x1_robot, y1_robot, x2_camera, y2_camera);
             
    }
}

Robot Code

#include "mbed.h"
#include "Motor.h"
#include "Servo.h"
//Reads in joystick positions from controller and drives the motors. 

AnalogIn jx1(p16);
AnalogIn jy1(p15);
AnalogIn jx2(p20);
AnalogIn jy2(p19);
float mot_x = 0.5;
float mot_y = 0.5;
float cam_x = 0;
float cam_y = 0;

char buf[32];
int idx = 0;

Serial pc(p9,p10);
//Serial pc(USBTX, USBRX);

Motor A(p21, p20, p19);  //pwm, inB, inA
Motor B(p22, p17, p12); //pwm, inA, inB
Servo myservo(p24);

float pos;
float ii = 0.5;
int main()
{
    pc.baud(115200);
    myservo.calibrate(0.0011, 45.0);

    while(1) {
        
            int x = pc.getc();
            if(x == -1) continue;
            
            buf[idx] = (char)x; 
            
            if(buf[idx] == '\r' || buf[idx] == '\n'){
                sscanf(buf, "%f %f %f %f", &mot_x, &mot_y, &cam_x, &cam_y);
                //pc.printf("%f, %f, %f, %f\n", mot_x, mot_y, cam_x, cam_y);
                
                A.speed(mot_x);
                B.speed(mot_y); 
                pos = (cam_x-(-1))/(2) * (1);
                
                myservo = ii;

                if (pos > 0.5) {
                    if (ii >= 1.0) {
                        ii = 1.0;
                    }
                    ii += 0.01;
                    myservo = ii;
                } else if (pos < 0.4) {
                    if (ii <= 0) {
                        ii = 0.0;
                    }
                    ii -= 0.01;
                    myservo = ii;
                }
                idx = 0;
            }else{
                idx++;
            }
    }
}

Future Work

  • Improve resolution & latency of camera feed (Use a faster radio, make the encoding process faster, etc.)
  • Use a longer range RF transmitter (CC1120) instead of the CC1101 to increase operating range


Please log in to post comments.