October 2016 Update: This project was originally tailored to a specific Hackathon event. It has now been updated for general public use.
In this step-by-step guide, we'll be building a soccer robot powered by Windows 10 IoT Core, using a Raspberry Pi 3 and a customized mBot kit from MakeBlock.
1. Setup your Raspberry Pi 3Install Windows 10 IoT Core
Windows 10 IoT (Internet Of Things) Core is a lightweight version of the Windows Operating System the that can scale from small devices to large scale industry machines. It allows for connectivity to other devices as well as cloud services like Microsoft Azure. The same enterprise-grade security features on other versions of Windows are here as well but it also makes a good platform to deploy your first app on a Raspberry Pi 3 using Visual Studio.
Windows 10 IoT Core is available via NOOBs on the Raspberry Pi (2 & 3). Alternatively you can follow the directions on WindowsOnDevices.com. and click the "Get started now
" button. This will show you how to flash an image to your SD card.
Note: An 8GB card (or bigger) is recommended.
The following components are required for this section.
Prepare the base by attaching the rectangular plate to the mounting posts and mounting screws as shown below. Ensure that you use the longer white posts for this step.
Now place the Raspberry Pi on the base. Take note of the direction in which the Raspberry Pi is seated on the base. Ensure that it is identical to the picture shown below.
The Raspberry Pi is the brain of your robot. The brain needs an interface to connect to the mechanical parts in order to control them. This is done through the Transit board (shield) shown below.
Once again placement is key; Ensure that the transit board is installed on the end opposite from the USB ports on the Raspberry Pi.
The leftover mounting posts should be the shorter set of 4. Screw these onto the board.
We'll be using three LEDs on the robot to provide status on the system. The jumber cables you acquired may differ in color from the ones used here, so follow the directions as stated. Color-mapping will come into play later.
For this first step we'll need three pairs of male-to-male jumper cables. They have to be paired; (2) to accommodate the positive and negative nodes of each LED. Place the three pairs on the other mounting plate included in the kit.
Now lets insert the LEDs into the jumper cables on the mounting plate.
Note: Each LED has a "long end" and a "short end". The long end is positive and the short end is negative. This is where your color-mapping on the jumper cables comes into play. Take note of the wire colors in which the negative and positive pins of each LED are plugged into. Maintain consistency; write it down if necessary.
Insert a LED into each pair of the jumper cables.
Secure the top mounting plates as shown below. Use the nuts provided in the kit.
We'll now connect the other end of the LED jumper cables to the transit board (Raspberry Pi shield):
Reference your color-mapping for the jumper cables used for the negative and positive pins on the LEDs. Plug them into the Transit board as outlined in the table below (using the LED Pin-Mapping diagram above for reference):
Insert your SD card loaded with Windows 10 IoT Core into the Raspberry Pi.
This concludes the Raspberry Pi 3 assembly.
Now that we've created the robot's brain, let's assemble the mechanical parts required for mobility. This includes the wheels, motors, and chassis.
NOTE: The mBot kit contains additional components that aren't used in this project. Follow the directions below carefully.
Follow the sequence of the manual below in a clockwise fashion, beginning at the top-left and going to the right.
This concludes the mBot assembly.
Lets put the brain and body together. Place the Raspberry Pi on top of the mBot and align the screw holes for the mounting posts on the mBot with the Raspberry Pi.
Secure both pieces together with the screws provided. Use the black RJ25 cables (black crystal wire) to connect the Transit board on the Raspberry Pi to Port 4 on the Motor controller (bottom board).
Lets add a limb to the robot to act as a paddle/kicker for the ball.
You will notice that there are additional metal parts included in your kit. Feel free to personalize your "kicker" design using these parts. We will use the pieces above for the purposes of this project.
Note: All kickers connect to a servo which has a single plane of motion. This will have an effect on your robots ability to maneuver the ball so keep this in mind during your design.
Attach the metal pieces together as shown below. Use the short screws for this part.
Secure the pieces with the nuts provided.
Now attach the Servo. Use the longer screw for this part. Remember, all flippers have to connect to the Servo assembly.
Secure the Servo to the mount with the nut provided.
Secure the assembled kicker to the mBot with two longer screws as shown below.
Pay attention to the placement shown in the screenshots. For best results, ensure that the connected wire is on the upper end when the flipper is secured to the mBot.
We'll now wire up the limb to receive power, and attach it to sync with the rest of the body. We'll need a Driver Board for this. There are two boards that look quite similar. Use the one shown in the screenshot below.
Secure the small Driver Board to the motor controller (bottom board) of the car with one small screw, close to Port 1 on the motor controller (bottom) board. You will need to remove the screw currently in this position, then screw it back with the Driver Board mounted.
Connect the Driver Board to Port 1 on the motor controller (bottom board) using the black RJ25 cable.
Now lets wire-in a battery for power:
This concludes the hardware assembly for the robot.
Connect the following inputs to the Raspberry Pi 3:
- HDMI monitor
- Network cable
- Xbox USB wireless adapter
- microUSB power cable
Once you've done so, turn on the switch on the Motor controller (bottom board):
Plug-in the USB power cable to the Motor controller (bottom) board. This will charge the battery while you work through the remainder of the project.
The Raspberry Pi will boot into the default home screen shown below. Make note of the IP address assigned to the unit:
Connect to the Raspberry Pi via your development workstation (e.g. your laptop) by typing the URL http://XX.XX.XX.XX:8080, where “XX
” corresponds to the IP address of the device.
Use the following credentials to log-in:
- Username:
administrator
- Password:
p@ssw0rd
(Note: use the number 0)
Click "Cancel
" when prompted to change the password.
Click the Home tab and locate the Display Resolution setting. If it is already set to 1920X1080 (60HZ), you can proceed to the next step. Otherwise, set the resolution to 1920x1080 (60HZ). This will initiate a system reboot.
NOTE: Do NOT set the resolution to any other value. This may cause the Pi display settings to behave erratically.
Now its time to program the robot - give it a set of commands which it will execute on demand.
The Visual Studio solution for this project can be found in the PiSoccerBot zip file under the Schematics section. Download and unzip it on your machine, then open up the Rpi3_Mbot.sln
file in Visual Studio.
In the Solution Explorer on right-most navigation column of Visual Studio, expand the "arrow" node on MainPage.xaml
then click on MainPage.xaml.cs
file.
In the Visual Studio toolbar, find the Debug menu, then click on Rpi3_Mbot Properties
.
On the Debug
tab, set the IP Address for Remote machine
to correspond to the IP Address of your Raspberry Pi 3 device.
Deploy the code to the Pi device:
The following screen is displayed, confirming a successful deployment of the UWP app:
Stop the project in Visual Studio.
The Robot App has been deployed to the Raspberry Pi. We'll now set that App as the default App so that it loads every time the robots is turned on.
Return to the remote connection on your web-browser.
Click the Apps
tab and locate Rpi3_Mbot
. Click "Set as Default app
" to instruct your Pi to boot-up running this app.
Click OK to accept the changes.
The gameplay code is now set as the default app.
Reboot the Raspberry Pi and confirm the changes by using the XBOX controller to test the robot. The LeftStick is used for direction, and the “A
” button activates the flipper.
Click on the Networking. Select the wireless network that corresponds with the hackathon, enter the access Key and click Connect
.
Disconnect the HDMI monitor, Network cable, and power line. Do do not unplug the Xbox wireless USB adapter.
This concludes the project. Your robot is now ready to dominate the soccer field.
TroubleshootingStartup 1.1 Power up the robot by turning on the switch on the bottom board. If a Red light is flashing, that means the Raspberry Pi is booting correctly. If the Red and Green lights on the Raspberry Pi are flashing at the same time, that means the Raspberry Pi didn’t boot successfully. In this case, turn of the power switch and try again.
Startup 1.2
Allow 45 seconds for the Raspberry Pi to complete the boot process. When all three LED lights on the robot are lit, that means the robot is ready for use.
Battery Charge
Always keep the power line connected to the power port on the robot as often as possible. This will maintain a charge on the battery and extend you playtime.
Comments