Introducing the Universal Bluetooth Robot Controller. This is not a tutorial or project guide. It's simply a, "What I made, and how I made it."

Specs:
Two, Dual Axis Thumbsticks with center buttons.
One, 4way+center, button stick.
4×4 keypad with values of 1 through 16.
16×2 White on black serial LCD.
A powerful Roving Networks RN-24-E, Class 1 100meter bluetooth RS-232 module.
And at the heart of it all, The Basic Atom Pro 40.
This Post will be broken into Sections using the Expand Buttons. This is a bit more for convenience, so you can check out each section 1 at a time.
The orders at which things happen are a bit off. Since there was no real order in which I did everything. I make this up as I go. I barely preplan anything.
I only plan the parts, not the details. So I don't know exactly where something will go, until I’m ready to put it in.
Which means this will not be a step by step guide.
I'll be posting a bunch of pictures, and a little description about what's going on in each picture. Most images when clicked will open in a new window.
Bluetooth information can be found in its own post.
The Roving Networks RN-24, and RN-41 Class 1 Bluetooth adapters can be found here.
Let's start with the Keypad.

This is a short section. The keypad. Not the cheapest, but was the smallest, and with my controller. Size is a factor.
The modification to this keypad was simple, I removed the header, and replaced it with wires, and moved the Bussed Resistor network to the back.
The reason for this was I wanted it to sit as flush with the case as possible, and the parts were in the way.
The blue wire was my bad, the header pins they used were giving me trouble and sure enough I pulled up the solder pad. It's happened before, but nothing I can't fix.
BEFORE : Clicking images will open in new window.
AFTER:
I could have soldered the wires to the back, but for stronger solder joints, i decided to go through the holes.
The header prior to being incased in hot glue. The loose wire is the 5v, and it gets its own female header.
Next up the case.

I'm using the PacTec PPT-4081.
The case is sturdy, and high quality. The plastic is very strong, and if left unmodified, is water resistant, probably water tight within reason of course. The black outer layer, is a rubber foam. Gives a good grip, with just the right firmness. This is also responsible for sealing out water and debris.
You'll notice in my pictures, the case is upside down. I did this for one main reason. Comfort. The case, when held with 2 hands, is far more comfortable upside down and used like a game controller, than right side up when used like a multimeter.
I have long slender fingers, so a wider grip is simply more comfortable. No overlapping fingers.
The front. (upside down.)
This next image is a very large one. It's the back half of the case. The 6 screws (included) fit well, and leave a nice snug fit. Very nice.
The face plate measurements aren't perfect due to the odd rounded design.
Cutting into it.
Well I don't have a whole lot of tools, and I can't say I’m proud of the job I did. I've cleaned up the edges pretty nicely, but they still aren't precision cuts.
I ended up using an old xacto blade, which I heated with a pocket torch until red. (smelled pretty foul) But it did cut it fairly well. Later holes I used a solder iron with an old oxidized head that I was going to toss otherwise. It smelled worse. But since it's below freezing outside.. what can you do.
Yup.. that's one seriously straight line. -sigh-
Jagged edges? Nothing a fresh Xacto blade can't fix.
Need a place for that keypad.
A bit of single sided foam tape to keep debris out. The holes at the top are for the Bluetooth adapter's SMA plug and it's LED's. The LED hole was just sealed with hot glue. It works fine, nothing fancy.
Below you see the 10k slide pot's hole. This wasn't originally planned, but I’m happy with how it turned out.
You can also see the holes for the thumb sticks. At first I thought I made them too large, but when I was done, I realized they were just right.
I originally intended a couple small round holes just for the joysticks to stick out, but then I decided to fit the whole thumb stick into the hole. Whatever, it works.
And now we're mounting! I used hot glue. It's cheap, easy to use, and can be removed if you mess up. Because of the size constraints, I couldn't fit special fancy brackets or breakout boards. Before you judge the project, thinking Hot Glue is amateurish, weak, or for the poor. Weigh your options. $60-$150 for special/custom brackets, or $0.25 in glue sticks. Also the hot glue keeps debris out, moisture, and adds a bit of flexibility. It'll bend rather than break.
Roving Networks RN-24-E, Class 1 100meter Bluetooth RS-232 module.
When gluing in the thumb sticks, I had to be very careful not to get any glue in the moving parts of the sticks. such as the center of the turquoise pots, or under the buttons. These sticks receive a lot more glue later on.. Let’s just say, they aren't coming out.
The keypad wires get trimmed later on. Those were just way to long.
That covers the case construction. There wasn't a whole lot to it. Just a lot of cutting. I would suggest anyone making one to use a Dremel, and a wet blade. 1 second on, 1 second off, just so you don't stink everything up, and you can get smoother edges.
PS, I’m getting a Dremel for Christmas, so future projects will look a lot cleaner.
First things first, we need an IC Socket for the MCU. Since I'll be using a 40 Pin MCU, I need a 40 pin socket. To allow for more user space, I've broken away and trimmed down the center bar for more user space in the center of the socket.
Now then, don't make the mistake I did by building the Main board first, in fact it comes last. I had to scrap the original board and start over.
You design the board to fit your case, not the other way around.
You need a PCB to attach all your goodies to right? I've been using these. They are cheap and Flimsy, and they work fantastic. I bought 30 at once.
A Razor will trim the left over notches on the sides. Maximizing the user space without weakening it too much.
Ok, now we're going. I started attaching header pins and the socket. There are dozens of high quality guides on YouTube on how to solder, so I won't get into it.
The 3 pins in the lower left are separated and didn't solder straight as I use salvaged parts. But they work fine, and lead to the serial LCD.
Quick TIP: When soldering Right Angle Male Header pins, it's easy to use a 2×4 Female header to get the size and the angle just right. See the top of the aforementioned image. It holds the pins in place while I solder them, without burning fingers or having pins stick up.
This image here just shows the additional headers, including the 2 power pins to the Bluetooth adapter.
Now we need power. The regulator of choice? The Texas Instruments REG1117-5.
It's small, good current, and doesn't get to warm. Why more people don't use these is beyond me. I've ran it in my controller for 20 minutes straight and it barely got warm.
I like to trim off the fins for a few reasons. One being it makes it shorter, so you can actually fit it inside the IC socket. Like in my Bot Board Mini Pro 28 As seen by the lower orange arrow. Use a tool like needle nose pliers and try to straighten the pins the best you can.

The board now has regulated power.
What you're looking at here is two 10uF capacitors immediately above the 5v regulator.
The wiring is simple. 1 capacitor between the ground and Vin on the regulator, and one linking ground and Vout. This helps with various spikes, noise, and other power related issues.
The small 0.1uF (104) capacitor inside the IC socket is between the VSS and VCC. This is also to reduce noise.
The new 2 pin header above the regulator goes to the reset button. One pin to RES line on the MCU, the other to ground.
Next up, the underside. Definitely click the image to open in new window.
The pins of the IC socket are hard to see, and not all headers are soldered in. Just the corners and the needed pins.
The programming pins S_out, s_in, ATN, and GND, are all pretty straight forward, and thus use direct links using some scrap leads from trimmed resistors, capacitors etc. The VCC and VSS have nice long leads for future links.
The capacitors and regulator has its own little mess over to the side. That Loop bit you see is the ground linking the second capacitor. It isn't pretty, but it works great.
A lot of the best things in life, aren't all that pretty.
Wiring: 2 images
Wiring, you can see I "stitch" through some of the holes. This is uncommon for me as I haven't done this in projects before. Usually I try to make the top sides as clean as possible, But since this board won't be open for display, I simply didn't care. So I did this to get the wires out of the way.
Wiring Part2:
Now it's getting hairy, we have a lot more wires going around.
The black loose wire is the ground to the controls. It's loose because I want to solder that on last, but I wanted a heavy enough wire so I didn't use my traditional kynar.
The wires inside the IC socket do go somewhere!
The larger male header at the bottom goes to the buttons and 5v, where the smaller one goes to the pots- the joysticks and slide pot
You can see I have the keypad header wired up now.
That's it for the MCU board. The only thing that you're not seeing is, the 4 analog pins, the ones immediately under the programming header, received some 0.1uF SMD capacitors. This was because I was getting a lot of noise and jumpy values.
The MCU pinout:
A bit of explanation is due.
P0-p3 goes to the 2 joystick Axis. P30 goes to the slide pot.
P31 despite being an analog pin is just being used as an input pin, should I ever need to use that analog pin, I’ll reroute the center select button to p8.
The _______ was from when I printed this out, should I need any extra notes to write down.
The 8 C/R pins are the keypads inputs/outputs. C1-C4 = column 1-4, and R5-R8 = Row 1 to Row 4, the colors are the wires of the keypad, just for personal reference. When coding, have it check if any of the columns are pressed, and then if any of the rows. Column 2, row 3, would be second button over, 3rd down.
VIN is not used, as I supplied my own 5v. But is listed for reference.
Now with the Keypad, Case and Mainboard out of the way, let’s put everything together.

Well more stuff is getting mounted.
A 4 +1 way button stick is placed between the joysticks, and our slide pot is in place. The slide pot, for the Rover is essentially a master speed control, which increases the speed up to a multiple of 10.l So speed 1 = 6, and speed 10 = 60. Very useful, like switching gears on a car.
The craft stick section in the center, is mostly so I have something to work on, and to secure the button down a bit.
Ya it sort of looks like a face. The glue looks really bad in how it refracts the light, but cost being a factor, well worth it. And the thumb stick toppers hide the glue.
Pay more attention to the top of the next image. The controller gets its programming connector. A Female DB-9 serial connector.
There's enough spacing around the connector for the male to fit comfortably. Giving you remove the screw headers from the male end. Else you'll need an adapter.
The ground of the thumb sticks and the center stick is getting wired up.
The wiring is done in a way so UP will = 1023, and down is 0, and Right is 1023, and left is 0.. on both sticks, despite one being upside down.
The end faze. The connections are simple. The SMA Bluetooth antenna, and under it, the black dot is the reset button.
The DB9 connector. The switch is a dual rail slide switch, which switches the RX/TX of S_in/out, between the DB9 connector and the Bluetooth. This means bluetooth and the programming header can use the same MCU S_in/S_out pins, just not at the same time.
This protects the Bluetooth adapter and the PC from signals interfering with each other.
Due to a wiring goof up, I had to redo that whole mess of red wires in the center near the sticks. I wasn't able to take as many pictures and I would have liked. All the hookups have been tested with the continuity test on the multimeter, and everything is good to go.
The battery is a 2cell, 20C, 800mAh li-po, if you look close at the bottom of the case, you'll see the 3 pin charging connector sticking out.
The controller… gets a heart.
And the controller construction.. Is done.
It works, the keypad puts out values 1-16, and The LCD looks good and is very legible even with the camera's flash.

Total time for construction? Roughly 30 hours. Even simple things take forever, and you should never rush yourself.
Programming… still working on that. But it's looking good so far.
I apologize for my poor grammar.
I will eventually include a schematic, but those are a bit time consuming to sketch up.
To-do list:
Add an internal speaker, just a simple one to use with the sound command.
Add a clip on, 3.5" or 4.3" video LCD to the blank gap on the top to be used with a wireless camera. It won't be part of the controller, just a clip on accessory.
Adding a hardware serial output header somewhere. This will connect to a slave MCU to be used with a 3D control arm. See Youtube



































4 comments
1 ping
Jim says:
December 24, 2010 at 3:23 am (UTC -8 )
Your controller has given me several ideas for one that I am in the early stages of designing. You have certainly added a lot of bells and whistles. My question to you is do you have any concerns as to the responsiveness of this system given that you are (I assume) polling 5 pots, a key pad, and several switches? As I pointed out, I am in the early stages of designing a simpler version myself and was concerned that the processor I planned to use (Nano 18 or 28X) would not be responsive enough due to the polling.
Fallentine says:
December 26, 2010 at 1:05 am (UTC -8 )
The 28X is a pretty decent choice, it’s much faster than the nano 18.
I had no trouble with all the pots, but i’m using the atom pro 40 which is 5x more powerful than the 28X.
The code for sending the pot signals was pretty simple.
each of the pots was put into a “word” and transmitted in 4 digits, 0000 lowest to 1023 highest, and i had the receiving MCU store each of the 4 digits into their own variables.
i added a check on the receiver end that should it receive >=1024 on any of the pots, to goto a hault command, as not to have a runaway rover.
The send looked like
hserout 1,[dec Lx\4, dec Ly\4, dec slide\4] ; etc.. but it would go for all 5 pots. The keypad was transmitted in 2 digits, and the various buttons in 1. Though for some buttons on the main controller, i assigned a value to each of the buttons and had it manipulate the same variable. So button 1 = 1, button 2 = 2, and so on, but both would set the value of the same variable. This was to reduce how much information needed to be transmitted. My center joystick would do 1-5, and 0 being nothing pressed.
The keypad value is decided by the controller and transmits 01-16, in a 2 digit set, so even if the keypad is unpressed, it’ll transmit 00.
I do this by setting the value to 0, then going to a subroutine to check if there are any key presses.
The receiving code is
hserin hault,400000,[dec4 Lx, dec4 Ly, dec4 slide] etc. so if 0000 gets transmitted on Lx, then the receiver gets 0000, and i use the same variable names on both ends.. for simplicity.
38.4k baud is plenty of this. There is about a 150ms delay when sending in rover mode but only about 10-15ms in arm mode, since the arm updates more rapidly.
I also transmit a single digit at the end of my code, that the bot decides which is arm and which is rover, so i can’t transmit rover commands while in arm mode. once i switch to rover mode, the bot receives a 0 and is forced into movement mode, where if i send a 1, it’s forced into arm mode.
Now you might have trouble with that on the nanos. The atom pros are so powerful i can scan these massive sub routines for changes without so much as a hic-up. but on a weaker slower MCU, such a scan would take considerably more time. I use the atom pro 40 on the controller end, because i wanted the controller to do most of the thinking. I can base bots on nano 18′s or even smaller micro controllers like slow 8 pin PICs, because the controller does all the thinking.
If you want, just say the word and i’ll email you my bas files, but the commenting in it is minimal at best but the code is so easy to follow, it’s all straight forward.
Jim says:
December 26, 2010 at 3:01 pm (UTC -8 )
What a great response. Thank you and yes I would be interested in a copy of your code. Why re-invent the wheel if you dont have to.
The controller, that I have just started working on, will not be as complex as yours. I have ordered and recieved a couple of enclosures for measurements. Have a pair of the same joysticks as you. And have designed a custom layout on pcb Express for the joysticks. I will probably be using xbee for the wireless portion of the project. I have not decided on how much functionality it should have. Like you, i am trying to make it universal so I can use it on other projects.
Concerning the xbee, I have had a lot of success using it in my project. I have written a program in VB for my laptop that provides directional / speed control and control of a pan and scan for video. The user interface is a series of on screen buttons with 2 modes of opperation, In one mode the robot travels in the direction of a clicked button and continues in that direction until another button is clicked. In the second mode, the robot travels forward/reverse and changes direction when a button is pressed and returns forward/reverse when the button is released. The hand held remote will use joysticks, but I might do another that does push button control. One last thing on the xbee. Digi Int., the company that manufactures thr xbee has a xbee dongle that eliminates much of the mess when interfacing with a PC. I use one and it works great.
The project that I am working on is a tracked vehicle (love it when they spin). I have just recieved some Nano 18 mini boards from PCB Express. Their function is to control 3 servos (2 for pan and scan and 1 for the sonars) interface with 3 sonars, provide LCD output for sonar data, run 3 status LED's and provide a serial interface with the main board. Software for this part of the project is progressing. Next up is the main board. I had planned on using a 28x chip but at present, can't get my computer to recognize it. Not ready to give up on it yet.
I know that some of this has been off topic, but when you are on a roll, why stop?
One more point, this may be a duplicate of another reply I tried to send. I think CAPTCHA spam blocker didn't like my answer. Any ways, I sent a reply and it seemed to disappear.
Jim
Fallentine says:
December 26, 2010 at 3:07 pm (UTC -8 )
All messages, even mine must be approved, sometimes CAPTCHA marks a person as spam, a false positive. But i actively check all the spam and catch any thing that gets put into the wrong section. IE spam that gets through, or real replies that don’t.
A note to all spammers, you ain’t gettin past me, so give up.
I’ve since removed your last message as it’s mostly a duplicate now.
RoboClaw 2×5 Tracked Rover » Basic Micro Tutorials & Projects says:
December 1, 2011 at 8:36 am (UTC -8 )
[...] « Universal Bluetooth Robot Controller [...]