Creating A Remote Controlled Spy Bot

Quote:

Quote:

This is a project for the Georgia Tech class ECE 4180 (Embedded Systems Design) with Dr. Hamblen.

Team Members:

  • Landon Ballard
  • Alex Jossart
  • Sriharsha Singam

Parts Used:

  • Mbed LPC1768
  • Raspberry Pi 4
  • USB Webcam
  • Xbox or Playstation Remote Controller (Will need DS4 Windows for Playstation control)
  • Bluetooth Module HC-06
  • Class D Audio Amp
  • Twin Motors (5v)
  • Two Wheels
  • 7805 Voltage Regulator (and 2 electrolytic capacitors)
  • Four LEDs
  • LIDAR VL53L0X
  • H-Bridge
  • Speaker
  • Power supply - the power supply chosen will vary, but for this project, 3 cellphone battery banks and 4 AA batteries with a barrel jack attachment are being used. The Pi4 is being powered by a dual male to single female USB connector that is plugged into two cellphone battery banks and the mbed is being powered by just one. The motors and speaker use the AA batteries. You may also need some sort of counterbalance weight to make sure the chassis is balanced, this project used 6 AAA batteries taped together to balance weight.

This page will demonstrate how to construct an mbed powered, gamepad controlled, wireless spybot using minimal parts.

Pinouts:

Raspberry Pi 4

Credit: Amazon.com

Raspberry Pi 4Web Cam
Usb PortUsb Camera Cable

To get live video follow this simple tutorial on Hackster.io. Change the input parameters on the configuration file to be whatever frame rate and resolution that is desired. Keep in mind higher resolutions result in higher latency and higher frame rates consume more processor time if there will be other things running on the pi.

You can use any generic USB webcam for this project.

https://www.hackster.io/whitebank/rasbperry-pi-ffmpeg-install-and-stream-to-web-389c34#toc-3--config-something-2

Note that as of 2018, ffserver is no longer supported so in order to get this to work you need to install commit version 2ca65fc, aside from this the process is the same

Bluetooth Module HC-06

Credit:Amazon.com

MbedHC-06
Vu (5V)VCC
GNDGND
p14Tx
p13Rx

To get this to work you need to pair it to a windows computer. Once paired, it will automatically open a COM port through the Bluetooth connection. To view the COM port number, go to Bluetooth in settings, then click "More Bluetooth options" then "COM ports" to see the number. Use this number as the serial port in your C# program. Make sure to use "Outgoing" not the "Incoming" field. The "Incoming" field is for receiving signals back from the receiver.

Note:

*The C# program connects to a COM port opened by the HC-06 chip.

*Default pin to pair the HC-06 is 1234.

*The C# program uses default windows libraries.

*Sends data as character strings.

Class D Audio Amp

Credit : https://os.mbed.com/users/4180_1/notebook/tpa2005d1-class-d-audio-amp/

MbedClass-D Audio AmpBatterySpeaker
p5S (pull low with 180ohm)
p23ln+
GNDln-
PWR+5v from voltage regulator on batteries
GNDPWR-
Out+Spkr+
Out-Spkr-

The Class D Audio Amp allows the speaker to play tones. It must have either a 5v or 3.3v source connected to it. In this configuration, the mbed cannot supply enough power while the LIDAR and Bluetooth module are connected. It needs to be connected to the 6V battery pack through a voltage regulator which steps it down to 5v. The speaker plays a short tone when the LIDAR detects that it is near a wall.

Further information on the Class D Audio Amp can be found here : https://os.mbed.com/users/4180_1/notebook/tpa2005d1-class-d-audio-amp/

TOF Sensor VL53L0X

Credit: https://learn.adafruit.com/adafruit-vl53l0x-micro-lidar-distance-sensor-breakout/overview

MbedVL53L0X
p28SDA
p27SCL
p26shdn
Vout(3.3V)VCC
GNDGND

The VL53L0X Time of Flight sensor reads in data from the front of the bot and makes distance measurements in millimeters.

The library being utilized in this project can be found here: https://os.mbed.com/teams/ST/code/VL53L0X/ Further information about the LIDAR can be found here: https://learn.adafruit.com/adafruit-vl53l0x-micro-lidar-distance-sensor-breakout/overview

H-Bridge

Credit: https://www.digikey.com/product-detail/en/sparkfun-electronics/ROB-14450/1568-1755-ND/7915576?WT.srch=1&gclid=Cj0KCQiAt_PuBRDcARIsAMNlBdqj9wCw2t5CcrELWAxxsyhx6c8Nq7j0yutuXkNlx-CgU_op6zcZJPcaApLOEALw_wcB

MbedH-BridgeMotorsBattery
VMBatteries + (6V from the AA battery pack)
Vout(3.3V)VCC
GNDAll GNDs
A01Black on Right Motor
A02Red on Right Motor
B01Black on Left Motor
B02Red on Left Motor
p21PWMA
p8AI1
p7AI2
Pull high to Vout(3.3V) with a 180ohm resistorSTBY
p9BI1
p10BI2
p22PWMB

The H-Bridge Driver Circuit allows for forward and reverse motion of the motors on the bot. It takes in 6V from the batteries and uses that to boost the power signals from the mbed to control the twin DC motors with PWM.

Further information about H-bridges and other driver circuits can be found here: https://os.mbed.com/users/4180_1/notebook/relays1/

LEDs

MbedLEDs Purpose
GNDAll GNDs
p15Green 1
p16Green 2
p18Red 1
p19Red 2

The LED's can be placed wherever the user desires. They are made to flash when the LIDAR detects that the bot is near a wall.

Chassis

Credit: Sparkfun

The Sparkfun Shadow Chassis was used for this project.

Assembly instructions can be found here : https://learn.sparkfun.com/tutorials/assembly-guide-for-redbot-with-shadow-chassis

Once assembled, placement of various hardware components on the chassis is up to the end user. Feel free to experiment to find the solution that works best for your needs.

SpyBot Fully Assembled

/media/uploads/lballard9/spybot.jpg

Code running on the mbed

Import programMbedSpyBotFinalRevision

Twin Motor Spybot using Mbed with bluetooth connection to a PC

C# Program

Note: To use this program Windows Universal Libraries are required. To enable these, unload your project and edit it. After the file alignment section add one line <TargetPlatformVersion>10.0</TargetPlatformVersion>. Then reload the project and select add a reference. After doing this you need to add Windows.Gaming and System.Runtime.WindowsRuntime.dll then you will be set up.

C# Windows Program that Connects to an Xbox Controller

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Windows.Gaming.Input;

namespace xboxController
{
    public partial class Form1 : Form
    {
        Gamepad Controller;
        Timer t = new Timer();
        


        public Form1()
        {
            
            InitializeComponent();
            serialPort1.Open();
            openit("http://youripaddresshere/test.mjpg");
            t.Tick += T_Tick;
            t.Interval = 50;
            t.Start();
            
        }
        private void T_Tick(object sender, EventArgs e)
        {
            if(Gamepad.Gamepads.Count > 0)
            {
                Controller = Gamepad.Gamepads.First();
                var Reading = Controller.GetCurrentReading();
                double LY = -Reading.LeftThumbstickY;
                //double LX = Reading.LeftThumbstickX;
                double RY = -Reading.RightThumbstickY;
                //double RX = Reading.RightThumbstickX;
                //double RT = Reading.RightTrigger;
                //double LT = Reading.LeftTrigger;
                serialPort1.Write("L" + RY.ToString("0.00"));
                serialPort1.Write("R" + LY.ToString("0.00"));
                

                switch (Reading.Buttons)
                {
                    case GamepadButtons.A:
                        serialPort1.Write("A");
                        break;
                    case GamepadButtons.B:
                        serialPort1.Write("B");
                        break;

                }
                    Debug.WriteLine("R" + LY.ToString("0.00"));
                    Debug.WriteLine("L" + RY.ToString("0.00"));

            


            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {

        }

        public static void openit(string x)
        {
            System.Diagnostics.Process.Start("cmd", "/C start" + " " + x);
        }
    }
}

Video Demonstration


Please log in to post comments.