MGB

From Link wiki
Jump to navigation Jump to search

MGB is a LEGO Mindstorms to Gamepad Bridge that utilizes the low cost Raspberry Pi computer. Traditionally a LEGO Mindstorms robot requires a computer to write and download the program necessary for it to execute an autonomous movement. Tele-operated control is typically limited to Mindstorms to Mindstorms, IR remote to Mindstorms and Gamepad -> PC -> Mindstorms. Of the three, the third method provides the best user interface experience. PC to Mindstorms is done via Bluetooth or Wifi via FIRST Tech Challenge Samantha wifi interface module. In order to lower the cost and simplify the complexity of the system, MGB project was created by replacing the PC with a low cost Raspberry Pi computer. This solution has the added benefit of allowing the robot operator to roam with the robot without the added bulk of a PC.


History

The MGB was originally commissioned by Google Lunar X-Prize[1] for the Moonbots in a Box [2]educational outreach project. The premise of project was to provide a PC-less and programing-less interface for the LEGO mindstorms NXT robots. Moonbots in a Box was designed so that science museum visitors can simply pickup a familiar gamepad and run a series of missions on the mock lunar landscape without any prior programming experience. The entire MBB interactive display was designed to stored in two easily transportable boxes and can be setup in any 6' x 6' space in less than 30 minutes[3].

The initial MGB-X (NXT version)[4] was deployed as part of the Moonbots in a Box kit to various science museums across the globe. An experimental FPV (First Person Video)[5] version was tested in collaboration with University of Hawaii on the Astronaut Ellison Onizuka science day the University of Hawaii Hilo campus. Success of the FPV experiment prompted the development of the MGB-3(EV3)[6] and FPV integration solution to the Moonbots in a box robots[7].

Get Started

Components

The basic MGB system consists of the following:

1. Raspberry Pi Model B mounted in the PiLCD enclosure. http://www.linkinstruments.com/pilcd.html

2. 8GB SD card loaded with MGB-X[8] or MGB-3[9] image.

3. SteelSeries 3GC Gaming controller.

4. ASUS USB-BT211 USB Bluetooth dongle for MGB-X or CSR8510 based USB Bluetooth 4.0 adapter such as http://www.amazon.com/gp/product/B00HQCINKE/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

5. A LEGO Mindstorms NXT or EV3 robot with driving wheel motors connected to port B and C. Additionally the end effector motor is connected to port A.

The easy way

For LEGO Mindstorms NXT robots download your Raspberry Pi image from here:[10]

For LEGO Mindstorms EV3 robots download your Raspberry Pi image from here:[11]

Expand the image on to the 8GB SD card per this instruction [12].

Roll your own

If you like to install this on your own distro, here is the instruction on how to do it.

Setting up the Raspberry Pi

1. Grab the latest version of Raspian from [13]. Follow the raw images installation instruction provided on this site [14].

2. Boot up the Raspbian and set the it to boot into command line.

Package Installation

1. Gain root privilege.

sudo -i       

2. Update the package list.

apt-get update

3. Install the necessary packages.

apt-get install git-core build-essential joystick bluetooth usbmount libbluetooth-dev

4. Go to the home directory.

cd / home/pi

5. Download and install wiringPi, this will give you access to the LCD display and the rotary switch.

git clone git://git.drogon.net/wiringPi   
cd wiringPi
./build

6. Grab and install the mgb source and compile it.

cd ..
git clone git://github.com/tkrmnz/mgb.git
cd mgb
sh build_all.sh
sh mgb_move.sh

7. Set the type of the LEGO Mindstorms robot you will be running, NXT or EV3. For NXT

sh set_nxt.sh

For EV3

sh set_ev3.sh

8. To switch between NXT and EV3 robots, you must first remove the old robot and set the new robot. To do this, you'll need to SSH into the Raspberry Pi.

For NXT to EV3

sh remove_nxt.sh
sh set_ev3.sh

For EV3 to NXT

sh remove_ev3.sh
sh set_nxt.sh

MGB Operations

1. Turn on your LEGO MINDSTORMS robot. Turn ON the bluetooth function. Write down your Bluetooth address For NXT

Settings
Address: (4 digits. 2 digits. 2 digits. 2 digits. 2 digits)

For EV3

Brick Info
ID: (12 digit number)

This is the number your'll need to find your robot among the nearby Bluetooth devices.

2. Insert the SD card with the image that corresponds to your robot type into the Raspberry Pi. Be sure that the Bluetooth dongle and gamepad are also plugged in. Power up the Raspberry Pi. After about a minute, the MGB module will have scanned all available Bluetooth devices in the vicinity and ask you to select the robot. Rotate the knob to find the Bluetooth device that has ID number that matches your robot and press the knob to select it. If you've named your robot using the Mindstorms software, it will be displayed above the ID number.

The MGB will attempt to pair with your robot. Press the Orange button on NXT when you hear the beep. For the EV3 robot, watch for the pairing message and select the Check box.

Once the MGB has paired with the robot, press the mode button on the gamepad so the RED LED is on. You are ready to drive the robot.

Controller Operation

The right joystick controls the right motor (B) and the left joystick controls the left motor (C). You can reverse the direction of the drive by pressing button 9

Like wise for the end effector motor (A). Button 1 will raise it and Button 3 will lower it. Pressing Button 10 will toggle the direction of Button 1 and 3.

Buttons 7 and 5 are synchronized slow forward and reverse. Buttons 8 and 6 are Turbo forward and reverse. Again, button 9 will reverse the direction to match the design of your robot.


FPV camera

The instructions and 3D STL file for the FPV camera can be found here http://www.thingiverse.com/thing:461458