Update 12/5/16 from Drew: Please click Known Issues to the right and review them before completing this build. Certain varieties of the kit have known problems and missing pieces. We have tried to outline the common issues. Some are still being resolved. The fixes will be rolled into the instructions as they are confirmed. Report any additional ones to me (@ReanimationXP) in the #intel channel of slack.hacksterlive.com. Thank you!
Don't Blow Up the Arduino
We've had reports of some assembling their bot and leaving the VIN jumper in place on the Motor Shield. Please take a moment to remove it before starting. Why? See Powering the Arduino and Shield below.
This project demonstrates how to use the built in BLE chip on an Arduino 101 to control a small 4x4 robot from your laptop. By having your computer take over control from the Arduino 101 itself you open up the possibility to incorporate processor intensive control methods such as computer vision, autonomous driving, and advanced feedback loops (PID).
Let's get started! What's this puppy come with? The robot platform used was the multi-chassis 4x4 from Sparkfun. It is fairly durable with an aluminum frame and has a lot of mounting points for additional sensors.
1) The kit requires some simple assembly, but it does take some time. Follow the instructions included with your kit for assembly, with the following deviations:
- Mount the Arduino 101 on standoffs (part of the separate Components Kit) to the top plate (lid) before attaching the lid to the robot chassis. If you don't have the standoffs, simply insulate the bottom of the 101 somehow and attach it to the lid.
2) The Adafruit Motor shield v2.3 will also requires some assembly, and by that we mean soldering. Header pins will need to be soldered on. If you received the female headers with your component kit (like the ones on the A101), use these and discard the normal male ones. Otherwise, use the male variety included with the motor shield. You can find detailed instructions for soldering both types here (scroll down to the appropriate section for male/female header type): https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/install-headers.
If you have never soldered before you might want to practice on something you don't mind burning as the headers can be a little tricky to solder into place. Asking someone who's soldered a lot to watch you will be the fastest way to learn. Start each header by soldering one pin at the edge, pulling tight on the headers so they are flush with the board and perfectly straight. You can use this technique to align things before soldering all pins which will lock the header in place pretty much permanently.
Do the 6-pin-grid female header next to the Bluetooth logo last. It looks like this: [: : :] Plug the plastic side into the Arduino 101 so it's fully flush, mount your now-fully-soldered motor shield on top, and allowing the male side of the 6-pin-grid to poke through it. Press down on the motor shield so it's fully inserted into the 101, then solder the male side of the 6-pin-grid header.
3) Attach the assembled motor shield to the top of the Arduino 101 using the headers you soldered on.
4) Use the jumper wires (male to male) to wire the motors to the motor output terminal blocks on the motor shield as shown below. Make sure that you match the correct pairs of negative and positive leads and follow the wiring diagram below. Note: The yellow wires are positive on the diagram, and red on the actual motors. Green wires are negative on the diagram, black on the actual motors.
5) Check that the VIN jumper is NOT attached before continuing. Use a pair of jumper wires to connect to the 5-count AA battery pack included with the robot kit to the voltage input terminal block on the motor shield, minding positive (red) and ground (black) orientation as shown in the diagram below.
Note: The 2x AA holder pictured below is NOT ACCURATE to real life and you will not have one in your kit - please use the 5x AA holder included in your robot kit. Some kits also do not contain 4 motors. In this case, simply hook up the proper motors to M1 and M2 as shown on the right side of the board and the top two motors.
6) Solder the barrel jack to the leads coming off the second battery pack. Make sure that you solder the red positive lead to the center (shorter) connection on the barrel jack.
Note: The 6x AA battery holder and its' barrel plug below were not included in the first shipment of ambassador kits. We will be supplimenting this shipment with an additional AA holder and possibly additional components soon. Finish building the bot and skip to Software Overview for now.
7) Attach the 6x AA battery pack to the rear of the robot with the strip of velcro:
Attach the barrel plug to the Arduino 101 to power it on. Once again check that the VIN jumper is not attached.
The robot should now be fully built! Make sure that both battery banks are unplugged so that they do not drain power.
The robot control system consists of two main pieces of software. The first is the Firmata server sketch that is loaded on the Arduino 101. Firmata allows your computer to access the pins on the Arduino - and by extension communicate to the motor shield which controls the motors themselves . Firmata also allows for bidirectional communication so that if in the future you attach a sensor to your robot you will be able to send the sensor data back to your computer.
The second piece of software is the Firmata client that runs on your computer. There are many different Firmata clients for a variety of languages but in this project we will be using the Firmata client that is built into Johnny-Five. Johnny-Five is a robotics and IoT platform for Arduino built on Node.js. More info can be found here: http://johnny-five.io/. Johnny-five has many useful libraries including Firmata and configurations for the Adafruit Motorshield that we are using.
In order for the Firmata client and server to connect we are using a ble-serial a node.js library written to open a serial connection over BLE to the Arduino 101. https://github.com/monteslu/ble-serial
1) To load the Firmata server sketch on the Arduino 101 you will first have to download and install the Arduino IDE: https://www.arduino.cc/en/Main/Software
2) Once you have installed the base IDE you will have to install the Arduino 101 Board. The following tutorial covers board installation as well as basic progamming, if you are unfamilair with Arduino this is a good place to start: https://www.arduino.cc/en/Guide/Arduino101 . The short version is that you need to install the "Intel Curie Boards" package via the Boards Manager in the IDE. Once you have done that, Arduino /Genuino 101 will appear in the Board submenu.
3) Plug the Arduino 101 into your computer via the USB cable.
4) In the Arduino IDE go to Tools -> Board and select Arduino / Genuino 101 . Don't see it? Go back to step 2.
5) Go to Tools -> port and make sure you have the correct port for your board selected. If you are not sure which port to use, unplug the Arduino and see which port disappears from the list.
6) Install the AdaFruit Motor Shield v2 package. Go to Sketch -> Include Library -> Manage Libraries, and then search for "AdaFruit Motor Shield v2". Select it and then click the Install button.
6a) If you would like to test your bot, flash the following .ino file to test your motors. By default this file will make your bot go Forward, Backward, Turn Left, then Turn Right repeatedly. https://github.com/ReanimationXP/a101_motortest .
NOTE! Get Ready for your wheels to move!
If you flash the a101_motortest program to the bot, the wheels will start moving as soon as the sketch starts executing. If you want to stop the wheels, you can either pull the USB cable (shutting off power to the Arduino) or pull one of the batteries.
7) In the Arduino IDE go to File -> Examples -> Firmata -> StandardFirmataBLE to load the Firmata BLE server sketch. Upload the sketch to the Arduino 101 by clicking the upload arrow in the upper left corner of the editor.
If the sketch is loaded successfully the last message in the output should be "Sketch starting in 5 seconds."
1) You will need Python 2.7.13 in order to install and compile the bluetooth-hci-socket Node.js package.
2) Go to https://www.python.org/downloads/. Download Python 2.7.13 and install it.
2) Once Node.js is installed create a new folder to contain your control code.
3) Open a Node.js command prompt and navigate to your project folder. If you are going to install the Windows tools in the next step, run the command prompt in Administrator mode.
4) If you are using Windows 10 you have to install the Windows tools. Do this using the following command:
npm install --global --production windows-build-tools
5) Install the following NPM modules:
npm install johnny-five npm install keypress npm install ble-serial npm install bluetooth-hci-socket
6) Download the control code in the github ( https://github.com/martinkronberg/Firmata-BLE-Bot ) and make sure control.js is in your project folder. You can clone the repo if you want but the chances of updates are fairly small...
We are now ready to start driving the robot! Make sure that both battery banks are plugged in and from your project folder run:
If everything works you will get a message similar to:
1476382259569 Connected [object Object]
Now when you hit "w" the robot will drive forward, "s" to drive in reverse, "a" and "d" will turn the robot left and right.
You may get a message like "No compatible USB Bluetooth 4.0 device found". Make sure your computer supports Bluetooth and that Bluetooth is enabled.
Note that you can check Device Manager in Windows to see if your PC supports Bluetooth. Look for a subtree called "Bluetooth Radios".
If Node and Firmata aren't working well for you, you can use the Blynk.cc Library instead. This is easy to use, cross-platform, has interfaces for mobile devices.
1. Download the Blynk.cc library and install it to Arduino. This can be done via the Arduino Library Manager. Version 0.4.7 at the time of writing.
2. Download and flash the following sketch to your Arduino 101:
3. Download the Blynk app. Create the following interface within the app:
Missing Parts: 6x AA Battery Holder and its' Barrel Jack, Tank kit has 2x motors only, not 4x.
Power Issues with Tank Kit: It appears the Sparkfun tank kit has a flaw - the battery holder included with it is not powerful enough to drive the tank bands. Solutions are to either remove the bands, replace the 5x AA battery holder with a 2S (7.4v) lipo battery with significant mAh (750mah for example), and/or power the 101 with one of your Intel USB battery banks.
Additionally, if the battery holder that comes with the Sparkfun chassis doesn't seem to be working, the batteries may not be seated properly. Pull them back while pushing down and you'll feel them snap into place.
Bluetooth/BLE issues: BLE support has minimum requirements. A computer must support Bluetooth 4.0 or greater, with Windows 8.1 or higher, to be guaranteed to support BLE, the low-energy variety of Bluetooth. Some computers may still have issues depending on driver stack and hardware differences. Most smartphones are more compatible with BLE. We are looking into use the Blynk platform to control the 101, which now includes BLE support. Details will be posted here when available.
We've also been told the BLE portion of the Arduino 101 is very flaky if not powered properly. Make sure you connect adequate power to the Arduino 101. I would suggest a strong 5v USB power supply, 2 amps or so to rule out brownout issues.
Screw Compatibility with Arduino 101: Screws from the component kit have heads that are too large to fit on the 101. Fix is to swap some silver screws from the robot kit in place of them, and vice versa if possible. You can also use Velcro squares, so the board is securely fastened and insulated, but easily removable.
Libraries: You need to upgrade the Firmata library to at least 2.5.3 (versions below 2.5.3 don't include Firmate BLE sketch)
Here are a few resources to make your life easier while running a meetup. The last two links require installing the Adafruit Motor Shield v2 library.
- This BLE Bot 9000 tutorial: http://bit.ly/blebot1
- Pete Hoffswell's DC motor test script: http://bit.ly/blebot2
- BLE phone-controlled robotics with Blynk: http://bit.ly/blebot3
Robot Control Code
- 1 project
- 28 followers
- 2 projects
- 75 followers
- 16 projects
- 667 followers
- 2 projects
- 1 follower
- 1 project
- 3 followers
Published onOctober 24, 2016
Members who respect this project
you might like