Friday, April 11, 2008

L298 Modification for Breadboard

I got an L298 Motor Driver in the mail yesterday and was really disappointed that it looked like this



and not did not come in a DIP package like this






The reason I was disappointed was because the L298 cannot fit directly into a breadboard and was meant to be soldered. My simple solution to that was to bend the pins of the L298 so that its in a DIP package now and can fit in my breadboard.
Heres a picture of it :


And I also made this diagram for the "new" L298 DIP package :
Click the picture for a better view

Thursday, February 28, 2008

Electronic Book Combination Lock

I'm sure you have all heard of the trick in movies, where someone goes into a hidden room , which can only be opened by pulling out the correct book from a bookshelf.

I decided to change this movie cliche a bit. I took a sharp IR sensor and mounted on a bookshelf. It measured the distance to any book that was pulled out, and checked to see if that was the "key" book. After getting it to work with one book pulled out. I made it a combination of books. It has to be 7-9-5 in that order, any other books are ignored. It resets after 15 seconds.

Pay attention to the characters on the LCD screen in the video!


Sunday, February 24, 2008

Finally Done


I finally finished all the documenting on my robot for the Robocup Junior Rescue Contest !!!

All the docs are over here:
Line Following, Obstacle Avoiding, and Victim Finding , Oh My!



Cheers,
Eric

Saturday, February 23, 2008

Instructions for Setting Up PICBASIC PRO, MicroCode Studio, and the U2 Programmer

On the web there is supposed to be everything . Well I was looking for a guide to installing PICBASIC PRO, U2 programmer , and MicroCode Studio, but couldn't find any. Zero. None. Nada.

So here I go and write my own!

I originally posted it in my 3 in 1 robot tutorial here : http://www.societyofrobots.com/member_tutorials/node/84

I used PICBASIC PRO to make the program , but PICBASIC generates an assembly file as well.I will post that assembly code up also. If you know assembly language and do not need PICBASIC, all you need is the programmer. If you don't know assembly then just use PICBASIC PRO.

Now the first thing we need is a microcontroller . We will use the PIC16F616 PDIP microcontroller. PIC is the brand( which is manufactured by Microchip), 16F616 is the part number , and PDIP is the package type. PDIP means it will look like this .

The microcontroller holds the program , which is a list of instructions for the robot . The language that I will use in this tutorial is a language known as PICBASIC PRO. Here is some sample code to blink an LED.

loop:   High 0          ' Turn on LED connected to PORTB.0
Pause 500 ' Delay for .5 seconds

Low 0 ' Turn off LED connected to PORTB.0
Pause 500 ' Delay for .5 seconds

Goto loop ' Go back to loop and blink LED forever
End

The compiler software transfers the basic code into assembly code and then into robot code( called hexadecimal code) . Assembly code of that same program would be over a page long of almost incomprehensible MOVLW , MOVWF , EQU , $128 , and other various commands. From the assembly code , hexadecimal code(the robot code) is created, which is TOTALLY incomprehensible. Here it is , in case you are curious:

0000- 2828 01a3 00a2 30ff 07a2 1c03 07a3 1c03
0008- 2823 3003 00a1 30df 200f 2803 01a1 3ee8
0010- 00a0 09a1 30fc 1c03 2818 07a0 1803 2815
0018- 07a0 0064 0fa1 2815 1820 281e 1ca0 2822
0020- 0000 2822 0008 1383 1303 1283 0064 0008
0028- 1405 1683 1005 1283 3001 00a3 30f4 2002
0030- 1005 1683 1005 1283 3001 00a3 30f4 2002
0038- 2828 0063 2839

The compiler costs $250 dollars retail, but there sometimes are cheaper versions online -- however, those versions are pirated copies , and any free torrent downloads of PICBASIC PRO are also illegal copies . Buy the retail version from here

The following instructions are for installing and setting up MicroCode Studio with PICBASIC PRO and the U2 Programmer. I was surprised not to find any instructions to do this online, so I went ahead and wrote my own. Enjoy!

Now once you have the compiler , you need hardware that can download the robot code onto the microcontroller from the computer. There are many options available for this piece of hardware.

I recommend this U2 Programmer since it can program almost any PIC micro out there

There are other USB programmers out there , as well as Serial Port Programmers for cheaper.

OR you can buy the code preprogrammed on your chip from Microchip Direct . However, if you go with this option , you will not be able to edit or debug the code . If you do this then skip all of the steps below.

For the next steps you should have a microcontroller, the PICBASIC PRO compiler ,and a programmer hardware.

Lets begin:

Install the software that came with the programmer

Follow the instructions provided with PICBASIC PRO to put PICBASIC PRO software on your computer

Download and Install MicroCode Studio - a free program to edit BASIC code

Download and Install MPASM Assembly Compiler

Now open up MicroCode Studio. Click View in the toolbar and then select Compiler and Editor Options.

A pop up box should appear . Make sure the "Compiler" tab is selected and then click the button titled "Find Automatically". It should start searching your computer for the PIC BASIC PRO compiler.

After it has found it , select the tab titled "Assembler ". Click the "Find Automatically" button and wait till it has found the MPASM assembler software.

Now select the Programmer tab .

Click the "Edit" button. A box should pop up. Type in the program name of your programmer software. For the U2 USB programmer it is "meprog.exe" .

Click Next. Now click "Find Automatically" and wait until it finds the software for the programmer.

After it has finished finding the programmer software , click "Next". Then click "Finished".

All done with the options for MicroCode Studio !

Now open up the programmer software in C:/Program Files/meLabs Programmer. Click meprog.exe

Now click the Options tag and make sure only the options in the photo are checked. Uncheck the other options

Click the View tab and then click Configuration from the drop down list.

Change the configuration setting to match the settings in the picture.

Exit out of the programmer . You have finished setting up all the software and hardware!!!

Sunday, January 27, 2008

Infrared vs. Ultrasonic - What You Should Know

Over at SocietyofRobots.com , I wrote a tutorial explaining the pros and cons of using infrared and ultrasonic. I compared and contrasted them and wrote a bit of background information on the sensors.
The tutorial is titled Infrared vs. Ultrasonic - What You Should Know

Note: Ultrasonic is basically sonar : Infrared vs. Sonar is a valid title too
Cheers,
Eric

Friday, January 25, 2008

My Google Sketchup Tutorial

A Google SketchUp tutorial I wrote for SocietyofRobots.com

Here is the link for it http://www.societyofrobots.com/member_tutorials/node/70

Voice Control and Chives 's Software

So many people have contacted me regarding how Chives works , software wise. So here is a detailed explanation.

When Chives' laptop starts up, Windows Speech Recognition also starts up. Now Chives's software, which I programmed in Visual Basic 6.0 , consists of multiple buttons whose captions are the voice commands. Meaning the caption titled is the command it does. "Get me a drink" is the caption of the button which gets you a drink . By clicking that button , the computer sends a signal through a USB port to the Phidgets controller ( we'll deal with that later, but you can google it if you want .)

Now where does the voice control come in? My first attempt at Speech recognition was that of using the Microsoft Speech SDK , which did not work out well. Accuracy was terrible. Then I stumbled upon Windows Vista Speech Recognition which is amazing. It actually scans the page automatically for the captions of buttons, and when you say the caption of a button it will click the button for you , all controlled by speech. So now all I did was create a program filled with buttons that did different tasks. Vola! Instant speech recognition. Except there is one slight problem now ..... having the robot talk back to us. Now I know you could use Microsoft Text to Speech , but frankly , after using that I felt like I really was talking to a robot . So I found this http://www.research.att.com/~ttsweb/tts/demo.php and prerecorded all of chives's sounds and also created my own Number to Speech engine. This engine I made allowed me to simply slip in a number variable into the engine and then a number would be said in a natural voice, eliminating the need for me to record every single sound from 1 to 1000.
Another issue which emerges throughout this type of program is timing. There are over 50 timers in Chives's program, since this will allow for the words to be said , for actions to last a certain amount of time , you get the idea , you need at least one timer for each function.

Well you get the basic idea of how I got voice control to work and text to speech to work ( in a natural voice, not Microsoft text to speech) . But I warn you, there are hundreds of bugs which I had to work out , causing me a lot of headaches. If you endeavor to create a voice controlled robot , feel free to contact me and I'll help you out of the bugs which I already fixed , give you tips , give you sample programs I made , because this will save you a lot of time and headaches.

Cheers,
Eric