Archive for the Robotics Category

Well now that finals are done with I can get back to blogging and working on my pet projects.

I blogged earlier about my first robotic project: the air freshener. After some ebay action (win some, lose some) I finally got a servo for about 5 dollars. It’s a fairly simple robot so the servo was the only thing I needed.

Servo

I did a little wiring and since I am such a newbie looked had to get a little help know which wires were what. Society Of Robots is a good resource for newbies like me :)

So after wiring to the Arduino some programming needed to be dealt with. I found some servo code here. Great code with a bunch of comments. Perfect for me. Whalala copy, paste, and uploaded to the Arduino. To talk to the Arduino I used the screen to connect via USB.

screen /dev/ttyUSB0 9600

At first it didn’t work. So I had to tweak the original code to disregard the left and right arrow keys and just used “u” and “d” to increment/decrement the pulse width sent to the server. Or to change to angle of the servo.

// Adjust these values for your servo and setup, if necessary
int servoPin = 6; // control pin for servo motor
int minPulse = 540; // minimum servo position
int maxPulse = 2370; // maximum servo position
int turnRate = 100; // servo turn rate increment (larger value, faster rate)
int refreshTime = 20; // time (ms) between pulses (50Hz)

// The Arduino will calculate these values for you
int centerServo; // center servo position
int pulseWidth; // servo pulse width
int moveServo; // raw user input
long lastPulse = 0; // recorded time (ms) of the last pulse

int intTest;

void setup() {
pinMode(servoPin, OUTPUT); // Set servo pin as an output pin
centerServo = maxPulse - ((maxPulse - minPulse)/2);
pulseWidth = centerServo; // Give the servo a starting point (or it floats)
Serial.begin(9600);
Serial.println(” Arduino Serial Servo Control”);
Serial.println(”Press to move, spacebar to center”);
Serial.println();
}

void loop()
{
// wait for serial input
if (Serial.available() > 0)
{
// read the incoming byte:
moveServo = Serial.read();

if(moveServo == ‘u’)
{
pulseWidth = pulseWidth + 10;
Serial.println(”Increasing Width”);
Serial.println(pulseWidth);
}

if(moveServo == ‘d’)
{
pulseWidth = pulseWidth - 10;
Serial.println(”Decreasing Width”);
Serial.println(pulseWidth);
}

if(pulseWidth < minPulse)
{
pulseWidth = minPulse;
}
if(pulseWidth > maxPulse)
{
pulseWidth = maxPulse;
}

}
// pulse the servo every 20 ms (refreshTime) with current pulseWidth
// this will hold the servo’s position if unchanged, or move it if changed
if (millis() - lastPulse >= refreshTime)
{
digitalWrite(servoPin, HIGH); // start the pulse
delayMicroseconds(pulseWidth); // pulse width
digitalWrite(servoPin, LOW); // stop the pulse
lastPulse = millis(); // save the time of the last pulse
}
}

This also was a good way to find out the min and max pulse of the servo I got. Oh also side note if anyone happens to buy a AE A1903 servo the above settings are perfect.

Hi All,

Well once again I have been looking for a program that will allow me to draw and save my schematics on Linux. There is a couple of different solutions out there but one that did catch my attention is Quite Universal Circuit Simulator(QUCS). So I downloaded and compiled a it seems to work great. I will be the first to admit I am not a expert on circuits but in a couple of minutes I “think” I drew a simple voltage divider.

The QUCS project seems to be very alive and still producing updates. It is not yet complete so still in “beta” but so far my experience with compiling and using have been great.

QUCS Voltage Divider

Well I have decided what my first robot it going to be. I know after I tell you my idea there might be a good chance you will be laughing. Keep in mind I wanted my first robot to be simple. It will let me know get my hands dirty with a little bit of micro controller programming (as shown earlier with python) and dc electronics.

So without further adu my next robot will be a air freshener.

Simple air freshener

Yup you read it right a simple air freshener. Basically I will take a can of Axe or something similar and have one motor to press the spray valve for a second or two then release. At first I will have it set up for every 30 minutes or something.

The next version after that will have a button to change the time modes, 10, 15, 30, 60 minutes. Depending how comfortable I am I might throw in a LCD to tell the time remaining. So yup there is my idea. It’s sort of sad isn’t it?

Well shortly I will be releasing some blueprint drawings, circuit diagrams, and pictures (once I find or buy a digital camera) to share and show my progress.

Wish me luck!

Well I finally got had some free time on my hands so I decided to play with my Arduino :)

Well here is a simple sketch that reads the serial for a ‘0′ or ‘1′ and does something based on the input. For me it was to trip (if proper terminology) a transistor to turn on a LED. I will put a little motor instead of a LED once I can get my hands on one.

(I found a good example of Arduino Serial here. I adapted the code to fit my needs.)

char incomingByte; // for incoming serial data
int intdigitOut = 7;

void setup ()
{
beginSerial (19200);
pinMode(intdigitOut, OUTPUT);
digitalWrite (13, HIGH); //turn on debugging LED
}

// MAIN CODE
void loop ()
{
// send data only when you receive data:
if (Serial.available () > 0)
{
// read the incoming byte:
incomingByte = Serial.read ();

//turn of power to base pin on transistor = no led ground
//ASCII 48 = 0
if(incomingByte == 48)
{
digitalWrite(intdigitOut, LOW);
Serial.println(incomingByte, DEC);
}

//apply voltage to transistor = led ground available
//ASCII 49 = 1
if(incomingByte == 49)
{
digitalWrite(intdigitOut, HIGH);
Serial.println(incomingByte, DEC);
}
}

}

Hi All,

Well this is my first post in reference to a Linux distribution called Mandriva. I seem to have pretty good luck with Mandriva so I stick it out when times get rough.

Anyways with Arduino there was no fancy RPM to download and install. Instead you had ensure the dependencies were all downloaded and then run the program. With that said I will next introduce what the Ardunio Board is.

Ardunio is a open source micro controller. It.. well I will just copy and paste what it says off their website.

Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It’s intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.

My reasons I chose it: Cheap, Open Source, Cheap!, Very Active Community, Lots of How To on the Internet

For the price a $65 you can get a complete Arduino starter kit that comes with a bunch of goodies including a prototype shield for experimenting. Click Here

This guy summed it up the starter kit:

Another interesting tidbit is there is a website that comes with tutorial that are complete lessons 1-5 and soon the rest of the lessons will be finished. They can be found here

Well enough said about the Arduino hardware. The other magic of the Arduino is the software. It runs on Linux, Windows, and Mac and can be downloaded here.

The Linux install isn’t so bad once you get it working the first time. You are then like, “ohh so thats how it works”. First you need to start by downloading a bunch of things. Most are really small.

1. Gimp
http://gmplib.org/#DOWNLOAD

2. MPFR
http://www.mpfr.org/mpfr-current/#download

3. Good old GCC
ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.2.2(insert new version at the end)

4. AVR-Lib
http://download.savannah.gnu.org/releases/avr-libc/

5. Bin-utils
ftp://sourceware.org/pub/binutils/snapshots

Note: There is some other dependencies for GIMP and MPFR but they can be found in the Software Management in the Control Pan of Mandiva.

Next is to simply build and compile everything. The whole process takes about a hour on my laptop and is mainly due to the long wait time make gcc.

To build bin utils

./configure –target=avr –disable-nls –program-prefix=”avr-”
make
make install

To Build GMP

You will need gmp-4.2.2.tar.bz2
Unzip

run commands:

./configure
make
make check
make install

To Build MPFR

Unzip
./configure
make
make check
make install

To Build AVR-GCC

Unzip
./configure –target=avr –enable-languages=c,c++ –disable-nls –disable-libssp –with-dwarf2
make
make install


To Build AVR-LIBC

Unzip
./configure –host=avr
make
make install

Here is the source where I got most of the info. As always when I ran into a error I googled it. lol

Note: The above website and other websites that refer to compiling the software refer to a install directory. I did not do it for simplicity of my first time but fear that I will regret the decision in the future when it comes to updating.

Last thing to do is download Arduino, untar, and run and Viola you can now program the Arduino via USB.

Hi All,

Well this is my first official blog and my first official blog post. I never really quite understood the point of a blog when they became increasingly popular but I decided to give it a shot. You know just to see what it’s all about. Well now I must tell you a little bit about myself.

I am currently a college student. For the past years of my college career I took night classes and worked full time. It really doesn’t leave any time for a social life. lol Anyways so I have experience as a MIS Manager. On my free time I programmed mainly database driven applications using C#, ASP.NET and ADO.Net. So I have experience with that.

One of the big projects I did required using a new feature called SQL Management Objects (SMO). Well there was a bug where you had to delete references every time you wanted to build the project. Wasted hours deleting references and such. Well I can’t remember the exact details or I would hyperlink the bug but in short. Microsoft said “yeah we know it’s broken. By fixing out mistakes we may break something else. From a business viewpoint it’s not a wise decision to fix the bug. It will be fixed in the next release. aka Visual Studio 2008″

So in short I had to start using the new version of VS with the new framework. Gee wonder where I could around 800 bucks to buy the IDE. So that really rubbed me wrong and left me stuck with this bug on a big project. Thanks Microsoft.

So in short that was enough to kick me into the open source world. Since then I have been playing with free goodies and toys. I like it but I am still learning so much with Linux and all the goodies.

So to tie everything back together I will be “blogging” (not used to saying that) about .Net stuff, Linux stuff, robotics and what comes to mind that is interesting. If I learned it the hard way and could save somebody the pain-it’s getting blogged.

Also if you have read this and looking at my other blogs forgive my spelling. I can code better than I can spell. Sad isn’t it?

-Mr 337

Disclaimer: Info seen on my blog is use at your own risk. I offer NO guarantee on content seen on blog. Also you can use whatever is on the blog but give me some credit!