Thursday, February 16, 2012

Where have I been?

Still programming away, of course.  I needed a small break though.  It's really easy to get burnt out when you're programming 9-5 for work, then come home and program some more.  Every once in a while I step back and take some time off to give my brain a break.  It also lets me get a feel for what I really want to work on next.

Since our last post, I created a GPS receiver using some parts from Sparkfun.  It was pretty simple to put together and get working.  I'd like to continue working on it and turn it into something I can mount on my motorcycle for when I go on trips.

I also made an all new enclosure for Tankbot.  I ordered an Arduino Pro Mini and soldered everything into a permanent enclosure so he can live on forever (or until the plastic rots away).

Going forward, I think I'd like to split my time between working on AstroMiner and continuing with the Arduino stuff.  I rarely talk about my personal life on here, but one thing that I should mention (since it effects my programming time) is that I've taken a new job back out in Texas.  This means that I'll be leaving the awesome Kennedy Space Center and moving back out there.  That'll happen over the span of the next month, so my development time will be severely limited while I'm in the middle of that.  Once I'm done, though, I plan to start right back up where I left off.

So that's all I have for you now.  Until next time ~

Tuesday, January 31, 2012

New Chassis Setup and Power Source for Tankbot

One thing I didn't like about the last chassis was how tall it was.  There really wasn't much reason for that and I wanted to see if I could lower the Ping sensor.  I also didn't like how far back the Ping sensor was, so I also wanted to move it forward.  Lastly, I wanted most of the weight of the bot in the center of the tank instead of forward.  This was because I wanted to switch power to NiMH battery and I wanted it to be in the center of the bot.

So, I present to you, Chassis #2:

Monday, January 30, 2012

Tankbot Stage 4

Tankie now has a servo on top that rotates the head around.  That way I don't have to move the entire thing whenever I want to detect objects.  If the bot decides that there isn't ample space to turn where it is, it'll back up ~1 foot and try again.  It'll do this indefinitely until it can turn.  I should probably add a reverse ping sensor, but that's a bit overkill for this little dude.

Next on the list is to move the reset button to the top of the bot instead of buried between all the wires.  I also want to figure out a better power setup.  Right now the Arduino and Ping run on a 9v while the motors and servo  are a 4 AAs.  This works fine, but whenever the 9v drops below 7v the Arduino's 5v out drops voltage and throws the ping off.  I'd like to see if I can fit some kind of battery from an RC car on here and powering them both from it.

I'm really happy with how this bot performs.  These tracks are awesome and the platform is real easy to work with (although a bit tight).  In my normal trend, the next "learning" step is transitioning from the Arduino Mega to a smaller Arduino Pro.  That'll cut back on a lot of weight and it's something that I'll need to know how to do for future creations.

Sunday, January 29, 2012

Tankbot Stage 3 (with video)

I continued work on the tankbot this week.  I wasn't happy with the chassis at all and was thinking of ways I could redo it.  I started looking online for examples when I found a premade chassis from the same company that makes the treads.  It was only 8 bucks, so I ordered it.  I was also having lots of electrical issues.  The motors draw lots of power at stall (2A) and this was stressing the Arduino and wasting battery >:[  I found a replacement set that were a real easy replacement (plug and play pretty much), so I ordered them as well.

Once it all came in, I reluctantly took the old bot apart and got to work.  It took me until 5am to get it done, but here she is:

Hey :]

Side shot.

Ok, so lots to talk about.  Let's start with the last picture (the one with the two circular looking things).  The bot needs to be able to avoid running into things and what you're seeing there is what I use to detect objects.  That is the Parallax Ping))) Ultrasonic Distance Sensor.  I got it a long time ago when I was playing with the Parallax Propellor.  It was very easy to get running with the Arduino (even easier than with the Propellor), so I've been using it.  A couple of weeks ago, I noticed that it would only detect up to 5 1/2 inches away.  This thing should have a range of ~9ft, so that didn't make sense.  I assumed that I'd just broke it somehow and since I've had it for so long, I'll just make sure that it's always at the very front of the bot.  The other night while I was toying with making a plastic front cover, I realized that when there was foam in between the Tx and Rx, it worked like it should.  I think that I'm getting some kind of interference between the two.  This was a nice and simple fix and it is now back to detecting its normal range.

My eventual plan is to mount it on a servo, so I can rotate the servo around instead of the whole bot.

Now let's go to the picture above it.  This is the closeup of the side view.  You can see my Tamiya Tank Treads, dual gearbox and universal plate set (all from Tamiya).  I did replace the motors that came with the gearbox with the Solarbotics RM3.  These motors use less power at stall and don't put nearly as much of a strain on the system.  This means longer run times :]

I also added a spring on the middle of the bot.  It can get bumpy, so hopefully the spring can take some of the bumps instead of the whole top.  You also can't see it in that shot, but I made some plastic spacers for the front of the bot out of hand moldable plastic.  They provide a full stop and also give the front somewhere to rest.  The rear rests directly on top of the gearbox.  The base has lots of holes in it, so the motors can still breath through it all.

That's it for the major parts lists.  The Arduino does all of the grunt work.  When the robot first gets power, it won't start moving until you press the start button.  You then have 3 seconds to get out of the way before it goes.  Since it just avoids obstacles and nothing else, there's nothing real fancy to it right now.  I did order a GPS chip last week (for a separate project) that I'm going to toy around with using this bot before I put it in it's own project.  It'd be neat if I sent the bot waypoints and it went there without hitting anything.

Anyway, it's 0620 and I need to sleep.  Last but not least, here's a video of the bot in action.  My dogs are not a big fan of it, so you'll have to excuse their barking.

Until next time ~

Monday, January 23, 2012

Tankbot Stage 2

I need to switch the motor gearing to high torque instead of high speed.  Also, notice the plastic sides that I made :]  Besides the motors being underpowered currently due to the wrong gearing, he works well.  My rangefinder is having some issues where it won't detect anything further than 6 inches.  I don't feel like spending money on a new one right now and that's enough distance for me to stop the robot in time, so it'll do for now.

I've found that the best way to mold the plastic while it's warm is to use your hands for the basic shape.  Then when it gets to ~100 degrees or so, start using scissors to get what you really want.  That's how I was able to make some cleaner edges.  I still want to experiment with having a mold and pressing the plastic into it, but that's for the next monster.

So after I switch the gearing (which means taking the whole robot apart, then taking the whole motor apart, redoing the gearing and putting everything back together), I'm going to order an onboard compass and integrate that.  After that, GPS.

This is fun.

Thursday, January 19, 2012

Tankbot Prototype

So I think this year is going to be more of a hardware year for me.  I had a lot of fun with software and I'm still working on AstroMiner (made some good multiplayer updates this week), but this hardware stuff is really fun as well.

I've been slowly learning different things with the Arduino.  Ping sensor.  Controlling servos.  Controlling motors. Building an opamp.  My big end goal is to make some kind of UAV, but I need to take baby steps to get there too.

I posted about my little robot last week.  He's neat, but he doesn't have much traction and that box is super heavy.  It's also put together with an Erector set.  I wanted to see if I could go to the next stage with him.  First thing I did was order tank treads and a dual motor gearbox.  That allows me to control each side independently, much like I do with the current bot.  Motors are a lot faster than servos though.

Next step was to build a better base.  I saw this awesome moldable plastic on Inventables and ordered that.  I've been toying around with it tonight.  You basically heat this stuff up to 140 degrees in water.  When you take it out, you can mold it almost instantly.  You can continue to mold it until it cools down to ~70 degrees.  As it cools off, it gets harder and harder.  If you don't like what you've molded, simply reheat and start over.

The down side is that if it gets too hot, the stuff will remelt.  When it comes to prototyping, though, it's pretty hard to beat.  That is, unless you have some cardboard.

So that's the basic shape that I'm thinking (minus the obvious lean).  The Arduino and motor drivers will fit inside of the bot itself and the batteries can sit up front or along the back.  I can throw a little ping sensor on the top with a servo that rotates around.

I'm going to start off with a generic object avoider like the last bot.  Once that's done, I'm going to hook him up to a remote control and make it so I can control him with that.  After that, who knows.  GPS waypoints?

So that's what I'm working on for the next couple weeks.  Next step is to finalize the actual body of the little dude and then make it using the plastic.  Once I have a design I like, I'll reinforce it with aluminum or something and go forward from there.

Family Photo :]
Until next time ~

Tuesday, January 10, 2012

Arduino + Electret Microphone

Last week, I ordered a whole bunch of Electret microphones from Sparkfun.  I thought I could add some cool noise sensors around the rover I've been building.  They come in and I start researching how to use them when I realize that I've made quite the mistake.  These little microphones are way too weak for the Arduino to read anything from.  What I should have purchased was this breakout board since it has a 100x opamp that amplifies the signal for the Arduino.  The damage was done though and I wanted to see if there was anything I could do to make these things work.

After much research online and toying around, I found this circuit and tried it to see if it would work.

Here it is on the breadboard:

When I first set it up, it didn't work and I couldn't figure out why.  I then realized that I just didn't have power going to the board.  Nice and simple mistake.  After fixing that, it seemed to return some value of 850.  Trying a different microphone gave me a different start value.  I set up my program so that it would get the ambient noise average before it started so I didn't have to worry about setting a value for each microphone.  After I got that setup, I simply check if the sound is higher than the ambient noise and flash an LED if it is.  That all seemed to work, so I went ahead and created a more portable version of it for my little rover.

The 3 pins are Signal, +5v, Ground.

Once that was done (and tested to make sure it still worked (it did)), it was Dremel time.

Now you can see why I added 3 pins :]

All tested and working well.  Here's a little video that shows it in action.

I still don't think it's quite right.  It should have a much larger range than it does, but this will do for now.  I can toy with this until I find a better circuit to use or just order the breakout board that Sparkfun sells.

Converting NUnit to MSTest

At my normal job, I was recently put in charge of converting our NUnit tests to MSTest.  After much researching online and reading lots of posts, here is the method that seemed to work for me.
  1. Remove dll references to NUnit.Core & NUnit.Framework.
  2. Add a reference to Microsoft.VisualStudio.TestTools.UnitTesting.
  3. In the code, find and replace:
    1. using NUnit.Framework; → using Microsoft.VisualStudio.TestTools.UnitTesting;
    2. [TestFixture] → [TestClass]
    3. [Test] → [TestMethod]
    4. [SetUp] → [TestInitialize]
    5. [TearDown] → [TestCleanup]
    6. [TestFixtureSetUp] → [ClassInitialize]
    7. [TestFixtureTearDown] → [ClassCleanup]
    8. (TestFixtureAttribute) → (TestClassAttribute)
    9. (TestFixtureSetUpAttribute) → (TestInitializeAttribute)
    10. (TestFixtureTearDownAttribute) → (TestCleanupAttribute)
    11. (TestAttribute) → (TestMethodAttribute)
  4. Update all of the Assert calls.
  5. The 'hidden' part. In your project file, locate <PropertyGroup> (not the one specifying debug|release settings), and add the following to it under <ProjectGuid>…</ProjectGuid>:
    1. <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    2. Do not change the GUID.  Visual Studio uses that exact GUID set to identify all Unit Test projects.
  6. In Visual Studio, go to the "Test View" and confirm that your tests are listed.
  7. If needed, change setup()→ public static void setup(TestContext context)
  8. If needed, change teardown()→ public static void teardown()
I'm posting this here for historical purposes.  UnitTests can come in handy for all kinds of development and Visual Studio's built in testing makes it extremely easy to do.  I know I'm guilty of not having many unit tests for my game, but as code becomes more and more mature, unit testing can make sure that we're not doing something we shouldn't.  It's also a good way to make sure the build you're about to release to your players isn't going to destroy something vital, like Saved Games or existing map data.

Saturday, January 07, 2012

Another Robot Dealie

I'm having too much fun with Arduino.

This little dude is pretty simplistic.  2 continuous rotation servos in the back control the rear wheels independently.  Another standard servo rotates the Ping sensor on top to check for collisions.  If an object is found in front, he'll look around for another way out.  If there's no way out, he'll back up and check again.  I also added a bright white LED up front for fun.

I built it using one of those Radio Shack project enclosures and a bunch of Erector Set parts.  I'll get some video of him driving around soon.

The catbot would've been fun, but I had a hard time finding an electric water gun that didn't leak.  I didn't want to risk burning out my Arduino, so I moved onto the next project.  I'll probably use this as a base for my projects for a while.  I also ordered some tank tracks and a dual-motor gearbox, so the next robot should be a bit quicker than this little guy :]

Monday, January 02, 2012

Arduino Catbot

We have 3 cats and 3 dogs in our house.  Whenever I go to bed, I can hear the little monsters walking around on the counter.  This drives me crazy and I wanted to find a solution.  What better way to keep cats off the counter than an Arduino?

First off, I know you can buy something to easily solve this problem.  That's not nearly as fun though.

To start, I picked up the Parallax Ping Sensor.  This thing sends out a sonar wave to detect any object in front of it.  It then returns back a measurement that I can convert into inches.  I mounted that on top of a 180 degree servo that I spin around.  To save power, I only trigger it all when my motion detector is set off.  Since these things will sit on top of the counter, they should only trigger when a cat jumps up.

The plan is to shoot a water gun at the intruder (cat) until it is gone.  I'll be mounting the water gun on top of the servo and ping sensor, so it will always be pointed in the direction of the intruder.

Once the final design is complete, I'll build 3 or 4 of these things and leave them around the counters.  That should teach them not to jump up there.  Long term plan is to network them and have them signal eachother so they can work in unison.  I think I can keep this simple and use some kind of IR signal.  Once that's all working, maybe I can even put one on wheels and have it patrol the kitchen.

So much to do, so little time.