DJ Sures Homepage Contact Me Follow us on Twitter Follow me on Facebook
Share/Bookmark

Robots: K-9
Project name: K-9 autonomous robot (from Doctor Who)
Birthdate: October 20, 2007
Description: It's in the software!

I developed K-9 from inspiration as being a robot companion and mature toy. K-9 is interactive but he shines as an independent personality. He is aware of his surroundings which gives him the ability to move around your enviroment. His personality changes as would a real pet, but He won't just turn himself off when you turn your back. Instead, he'll go off and explore. His autonomous awareness prevents him From falling down stairs, Driving into things or requiring your assistance.

All with one distance sensor, you won't beleive it until you see it.
The goal: Most people are so used to being human that we forget that robots are not. People expect robots to see, hear and Maneuver like humans. The goal has to be rationalized during the architectual phase by determining the expectations and function. Assumptions can be made to reduce complicated and cpu intensive programming by simplifying the process. For example, K-9's distance Sensor programming keeps a history for reference. This allows K-9 to determine if an object has moved within his path. K-9 Assumes that if something changed then it must presumably be human therefore interact with it. This approach gives us the Impression That he is aware and therefore saves thousands of lines of complex facial and visual recognition algorithms.
Cpu: Microchip pic 18f4685
Cpu speed: 20 mhz external resonator
Peripherals: 2 x modified servos for drivetrain
2 x unmodified servos for head
2 x pager motors for ears
2 x leds for eyes
1 x speaker (digital tone generated sounds and 1-bit Audio sample playback)
2 x surface pushbuttons for menu interface
1 x power switch
1 x sharp gp2d05 distance sensor
1 x ir receiver sensor
1 x 2 line serial blue backlit lcd interface @ 19,200 ttl
Power source: 5 x 1.2v 3000mha rechargeable batteries
Development enviroment: +1,300 lines of c code

Shell: Custom shell of styrene
K-9's Dimensions and template for shell Here.


Images

Click to see photo albums:
  1. New drivetrain and emic speech module
  2. Ir addition pictures
  3. Pictures with ears & eyes
  4. Pictures with new paint
  5. Pictures of new body
  6. Pictures of original beta platform
  7. My workshop


Software
Last updated: 12-14-2007
Description: For many years, my previous robots were simple and performed single tasks. However, my software infrastructure began evolving And becoming far more effecient and reusable. The best feature of this code structure allows for flexability and expandability. The software is split up into modules. Each module is named to encapsulate the function of the commands within it.

I wanted K-9 to be smart, and effecient. It was not an easy task and has required plenty of expiremental time to determine his algorythms And conditional reactions. This is all done in the software, that's the key to K-9.
Features: K-9's advanced programming structure provides an interface to a map of his surroundings. A 3-d array of information is constantly Updated during scans.C functions. This feature provides the movements.C functions ability to determine escape paths and understand It's enviromental surroundings.

When K-9 is powered up, it is important he is on a level surface with no objects within 2 feet of his path. This will let him Initially scan the ground in 5 vertical degrees. By doing this, he now has an idea of the texture of the terrain. Later when performing In autonomous mode, he will look down in a timely fashion to avoid ledges and terrain obsticles. All of his scanning functions are Timed with his forward speed to ensure he does not fall down a stair or drive into a blocking obsticle.

Personality activity is determined by a global emotional variable. The variable increases or decreases with human interaction (or change). K-9 understands human interaction as change of his enviroment; assuming that only humans move and walls don't. The less interaction, The more often he will sleep, stand still, or perhaps whine a little. With interaction, the variable will narrow his randomness towards Modes that allow him to explore and be motivated to move.

This is all done with only 1 ir distance sensor.
Neko.C This is the program file that contains the main() entry point. Initialization occures here (init head, init movement servo timer, init lcd, etc)
Neko.H Contains microcontroller fuse parameters, program #defines, and communication stream definition. The #defines are declared in this File so they may be easily modified in one location.
Moveservos.C Timer1 is used in conjunction with ccp1 and ccp2 to control the pulses to the movement servos. Servos are controlled individually with speed and direction as parameters
DJservos.C This module contains the functions to move the head and tail servos. They use my own pwm control function. The reason for this is that it lets the user specify how many degrees from center to move the servo. Then the number of pulses to move the servo from it's current location to the new location are sent. The current location is always stored for future reference.
DJtones.C A simple function that contains a tone generator with a optional oscillation parameter. A #define list notes are specified for musical score. The oscillation parameter gives K-9 the futuristic effect to the sound you hear.
Audio.C This file is an export from my c# .Net program I wrote that exports roman's btc 1 bit Audio encoder to a eeprom rom declaration. My .Net program is available for download.
Sounds.C A collection of functions that play different melodies and sound effects.
Audiocontrol.C Provides an interface to play 1 bit Audio samples stored in the eeprom.
Lcd.C An interface to control the lcd screen. Provides an initialization feature. And functions for organizing variables and modes for sensor debugging.
Actions.C This file holds all the functions to control K-9's emotion actions (ears & eyes)
Scans.C A list of functions that provide scanning capabilities. They include getmaxright, getmaxleft, isleftclear, isrightclear, getdirectionofdifference, etc..
Movements.C Movements are small re-usable macros that are used by modes. The movements assist K-9 in getting out of jams, or avoiding objects by using scans.C functions.
Modes.C This file contains the list of modes. A mode is a macro of movements, scans, actions and sounds. Examples of a movement are nodatnearestobject, gotoclosestobject or goautonomous. Modes are infinitely choosen by the personality generator function in the main() entry point.
Menu.C The lcd screen allows K-9 to display diagnostic information while "living". His x/y data can be displayed via a menu system that is navigated by 2 buttons on his panel. Realtime sensor data can also be viewed to help tweak application constants.
Adc.C Contains my adc library which performs redunancy and false positive checking.
Util.C Common utilities that are used often. Mostly which are functions to calculate differences with medians and servo degree position differences.
Personalityactivity.C This feature has finally passed it's beta testing. It's what varies his activeness with activity. All functions that notice movement call increaseactivity() or decreaseactivity() respectively. The more movement K-9 interacts with, the more active he will be.


Project videos
New wheels, pic board and emic speech module

His old tread setup was giving me grief. Well, him grief. And I decided to replace the tread with wheels. I also Took the time to add my new pic board, stilling sporting the good old 18f4685. Then I added the emic speech module To give him voice!

Public interaction

Our weekly robot club builders meeting is held at the calgary aerospace museum. The facility was rented for a christmas party And we were invited to display our robots. We brought out the mars rover, heathkit I and of course K-9 *smile*

K-9 was a big hit with the kids and adults too. He was interacting very well and you can tell he enjoyed the attention. I didn't Get as much video with him and the kids as I wanted. I spent most of my time watching out to ensure K-9 didn't get hurt. The kids Were very good with him, except one little kid who kept tormenting him. I would have said something to his mother but she was just As bad ..

Ir sensor added

I added an ir sensor under the sharp distance sensor at the front of his mouth. It detects ir signals, such as your tv remote control. The idea is to add some enviromental interaction. Throughout the day, people use ir remotes to control devices and if K-9 detects the Use of ir then he will head towards the source. It interrupts anything he is doing and he'll position his body towards the source.

If by chance he was in autonomous mode, then he will direct himself to where the ir source was detected and move towards it. If he is In any other mode, his body will still move but he will merely face the source. It's a neat interactive feature.

Part 4

In this video he has working ears, eyes and more complicated personality programming. The video is long, but built to answer Questions I have received from internet sources. People want to see his interaction with the world and without human assistance. I did not assist K-9 throughout any of this video.

Part 3

In this video he is demonstrating his new paint job. Not much really has changed in this version. Minor bug fixes. There was some Structual strength and programming additions.

Part 2

Here is a video of K-9's new body. Built entirely custom of styrene. The programming of the first version is pretty much the same. The only differnces in programming is to compensate for the differences of ranges and head movement limitations. Mostly a Re-calibration.

Part 1

This is the first version of K-9. I really do miss this little guy. I know it's simular robot programming and mobility structure As the newer version, but he had a great personality. I have been thinking of rebuilding a new version of him in this format for fun. This video demonstrates his initial ability to avoid objects, understand the enviroment, learn exit strategies and explore autonomously.

This version was a pic 16f877a @ 20 mhz. The programming wasn't as effecient as the newer versions but it got the job done. The programming Structure that I came up with was first beta tested in this version.


Updates
2008-10-01 The old tractor tread setup would loose it's treads on carpets and sticky surfaces. So I built a wheeled version.
2007-11-25 I spend the past few evenings with an electrical cad software designing a universal microchip pic robot board. It's done and I'll be sending it to the printers soon. It consists of an h-bridge motor controller, adc ports, digital input/output ports, And servo ports. Plus has an incircuit programmer. This will allow modifications and additions to K-9 to be a lot easier. His Current board is so packed with wires that I am afraid to touch it.
2007-11-21 I had some luck with the ir sensor. Rather then looking for an ir signal, i'm going to look for a specific frequency of the Ir signal. So the sharp distance sensor should not interfere becuase it's frequency is well above the average remote control. The whole idea of detecting any ir is so he'll follow it. Doesn't matter if it's a tv remote or a dvd remote, he'll see it *smile*.
2007-11-19 Well the ir detect circuit might be removed. It seems that the sharp distance sensor ir is interfering with the ir detector. Not a problem I thought, so I whipped up a quick circuit to control the power to the sharp sensor via the micro. The power can certainly be toggled, but the power-up restore time of the sharp sensor takes too long. Because for every check Of the sharp sensor, I turn it off to check the ir sensor, then I turn the sharp sensor back on. The values i'm getting back from The sharp sensor are inaccurate now that i'm cycling the power so often. Also, adding a longer delay between power cycles in my Code knocked the head timing/movement out of whack. When the timing is out of whack, I have to recalibrate the movement speed To keep the checkforclear() timing in relation to his movement.
2007-11-15 I just added this update section. So I can keep track of progress, issues or changes.



Copyright © 1995-2012 DJ Sures

hacker emblem