Intro: Adafruit's Circuit Playground As a Robot Controller With Bluetooth
A friend gave me one of Adafruit's circuit playgrounds (developer edition) to use, and I wanted to see would it make a good robot controller. The circuit playground is packed full of features like sensors, neo-pixels and even an accelerometer.
I wanted to add a L9110 motor controller and create a small bot I could use to show some of the expansion possibilities. The circuit playground uses the standard Arduino IDE so its has a huge amount of libraries and examples on the web to use.
I also wanted to make something robust that wouldn't have a lot of wires exposed, so beginners or children could use my bot and learn to program.
Adding bluetooth was also a goal which I talk about later in this article.
Step 1: Equipment Needed
- A case for your bot, I used an old smoke alarm
- 2 x Micrometal gear motors (I used 1:298 ratio but if you want something faster I would suggest 1:50-1:100
- 1 x L9110 Motor control board
- 1 x Adafruit circuit playground
- A small board to mount your motors on unless you want to add them to the case.
- Various jumper wires
- A set of bolts and nuts that will go through the holes in circuit playground
- Ends for jumper wire eyelets which need to be fitted
- Solder and Soldering iron
- Hot glue gun
- Small drill / Dremel to produce holes for bolts in case
Step 2: Putting It Together
First I took the insides out of my old smoke alarm which I was going to use as a robot body / case. I know its obvious but please don't use your working smoke alarm for this, get an old one or use something different as a case.
I placed the circuit playground on the smoke alarm case and marked out where to drill holes for my bolts to go through, these will be used to connect the motor driver board and anything else we want to in the future, keeping all the wires inside the case.
A nice modification to this would be to use wingnuts on the top so the playground board could be removed leaving everything else intact.
Step 3: Making the Jump Leads With Eyelets
I wanted to connect the L9110 motor driver board to the circuit playground using female jumper leads at one end and an eyelet on the other end to be used on the bolts with nuts as connectors.
I used eyelets that came in packs of 10 and cut off one end of my female to female jumper leads. I then crimped the eyelets on to the wires as shown in the pictures. I added solder to the crimped end to avoid them being pulled out during assembly or moving them around.
Once done I plugged the female ends into the L9110 motor driver board.
Now I was ready to connect the wiring inside the case.
Step 4: Preparing the Motors and Rollerball
I decided to use an old piece of circuit board to mount the motors and holders along with the roller ball. This required drilling in a number of places as shown. I then tested the L9110 motor driver worked by connecting up the wiring to the motors and to the bolt connector inside the case. I am glad I did this as it turned out the motor driver board was not working, this I tested with a multimeter.
Once replaced and tested with a simple arduino sketch I marked out where I wanted the wheels to go through the bottom of the case. Then using a dremel I cut these openings to allow my motors, wheels and rollerball assembly to sit on the bottom of the smoke alarm case.
Step 5: Internal Wiring to L9110
Next using the bolts as connectors I fitted the wires ending in eyelets to the following pins.
L9110 Adafruit Circuit Playground
B1A -----------> Pin 12
B1B -----------> Pin 6
A2A -----------> Pin 10
A2B -----------> Pin 9
GND -----------> GND
VCC -----------> VBatt
Step 6: Adding Battery Power
Because of the small size available in the smoke alarm case, I decided to add a Lipo battery and add a small charging board. I have ordered this and so will update this section once fitted.
For all my testing I did this with a USB cable attached
Step 7: Aduino Code
I wrote a simple sketch and added functionality so that pressing the left button on the Adafruit circuit playground started a simple control of the motors, forwards, back, spin left, spin right. This could easily be adapted for other use.
I have attached this code here.
Step 8: Taking It Further Adding Bluetooth / BLE
I added then a HC-06 bluetooth module.
The connections to the circuit playground are fairly simple and would be the same connections as a standard Arduino. I had to make up four more jumper wires which had the standard female ends, these kind pushed onto the pins of my HC-06 Bluetooth device. The other end of the jumper wires I added my eyelets and soldered them for security.
I the. attached these to the circuit playground bolts I had in place using the connections listed below.
Playground BLE device
RX ------------------> TX
TX ------------------> RX
GND ----------------> GND
VCC ----------------> VCC
Once connected power up the circuit playground and the Bluetooth device should show a power light, indicating you have the power correct coming from the circuit playground. There should also be another light which will be flashing. This shows the Bluetooth device is not connected / paired with a remote device. I initially tested this with my laptop, discovering the device and connecting to the HC-06 Bluetooth device. The default pin if prompted should be 0000 or 1234.
It should then be possible to provide control via an app such as https://appsto.re/gb/DDIR4.i
Step 9: Conclusion
This was fun, and creates a nice robust bot, its small and if you program the neopixels it really looks good. I really like the smoke alarm as a case as it allows me to open it anytime I need to using the original hinge and it keeps exposed wires safe.
Adding rechargeable power and BLE will really make a good plaform for small robot development, especially with the inbuilt sensors already part of Adafruit's circuit playground.