dinsdag 8 juni 2010

Wheels for my android bot

I've got some wheels for the Android Robot I'm working on. Had to find some wheels directly driven from modified servo's. Lego Technic to the rescue:

Van Drop Box

These come off a Lego Technic set with number 8479, the green scanner truck for those who are familiar with Lego (who isn't :)). You can buy the tires separatly and they also have the rims. You can look for a shop closer using the product numbers on this website.

The servo horn I used ships with the 9g servo's. They fit exactly inside this wheel. I used some tie wraps to keep it in place.

Now I'll be looking for some platform to attach these wheels to.

vrijdag 4 juni 2010

Simple and cheap Android powered robot

Android powered Robot Concept

I'm working on a cheap android powered robot. The intention is to keep it stupid and simple. If I can get my Android phone to drive all directions I'm done. All I need then is the software to control what direction to drive. I can then use the build in sensors of my Android device to decide what direction to follow, receive commands over the network, etc.

Afer some searching I found this cellbots.com blog where they already implemented this idea by using an Arduino for controlling the servo's. This still requires some basic knowledge and a hacked kernel to get the serial out of the htc ext usb connector working. Less technical approach is using Bluetooth for controlling the Arduino but that isn't cheap anymore (and still requires a custom rom for some 1.5 devices).

So I kept looking for an easier setup. And I found it on this german website. It's a great idea to use the soundcard of a computer to control servo's. Soundcards work with pulse width modulation or pwm anyway for reproducing sound so adapting this to control a servo (also pwm) should be possible.... even with an Android device. Turns out someone did that already.

Android powered Robot Setup

I tested the code from the link above and got it working. That was my first step in getting an Android powered robot. It's based on a 2 servo's setup for skid wheels. Those servo's are cheap (check ebay) and have all electronics for controlling the motor and gearing built in. All we need to do is modify them for continuous rotation. Check this link or search the web for more information on how to do this.

I ordered some cheap servo's for modifying myself. My first tests were with some more expensive servo's I don't want to hack. If that is finished I'll come back to post you my motor setup.

I will keep it simple for sure. All you need to know is how to connect 2 modified servo's, a batterypack and the stereo cable. Please keep in mind that you are doing this on your own risk. Don't do this when you don't know what you're doing! You might damage your device! This is a basic schema on how to connect all:



1) You'll need 4 AA battery's as a power supply for the servo's. Connect ground of batterypack (-) with the ground of the servo's (brown) and the ground of the two stereo channels of the headphone cord.

2) Next connect the plus (+) of the battery pack with the + (red) of the 2 servo's.

3) Don't connect the red or white wire from the stereo headphone cable with the batterypack (not even the red one :)). These 2 wires (red and white) will be used for the signal towards the servo's. So connect the red one to one of the servo's signal (orange) wire and the white one to the other servo's signal (orange) wire.

That's all for the electronics.

Android powered Robot Software

When my wheels are ready I can focus on writing some simple apk for basic movement. That will be the base to an autonome Android powered robot.

The Android device I'll be using is a HTC Hero GSM (Europe). For some features like voice recognition and bluetooth control I'll need to get a 2.1 custom rom. I might release 2 apk's, one for the original 1.5 and one for 2.1 with more options. We'll see.

This is a great article on developerworks about the android sensors.

Some features I'm thinking of:
  • Automatic Callibration. When the program is launched for the first time I only know I need to spin the wheels in the opposite direction (in case of a common dual servo setup with 2 skid wheels). What direction depends on how the servo's are wired (position of left and right channel). I can try one direction and detect if robot is going forward (that is facing camera forward). Other direction will be backward.
  • Basic collision detection. I'm not yet sure on how to implement this. I could check if the device is still moving like expected. If I detect no change in location robot can react and try to recover by turning into other direction.
  • Remote Camera View. Send captured images or video over the network (streaming) in order to see what robot is doing. Camera should be mounted in front for that (see callibration).
  • Face recognition. I can turn on face recognition and interact with recognized faces? See interaction for more about how to interact. The camera is on the back of the phone so the robot would have to turn towards the detected face first. Also face recognition is done on still images so would have to take intermediate pictures for recognizing then? Or does api provide other methods? Have to check this.
  • Interaction: It's a pitty we don't have sound to interact. Android comes with a speech engine so it could really speak to you. But we used the audio channel to drive our motors so that is no option anymore. I've been looking for alternatives and one is to use smileys like the Callo telephone robot. That combined with the face recognition could be a great solution. Also text remains. Therefore on the screen could be too small so maybe have it interact over the network.
  • Navigation using waypoints.  We have a compass to head in some direction. We also have a gps onboard so we could move based on a preset route using google maps or manually stored waypoints. About those waypoints a saw a robot somewhere that let you set the waypoints by hitting a button and then it would go over every waypoint. Can't find link though. Anyway a search on the internet will give you enough results on self navigating robots.
  • Remote control. can be realised over the network. With some simple commands like forward, backwards, left, right, stop. And maybe some text interaction as well. Would be nice to have some interaction.
  • Voice recognition is an option for 2.1 devices. It could receive the same commands for remote control over voice this way. Also some basic interaction is possible.
  • And many more... feel free to leave your ideas here.