Sunday, July 31, 2011

The plan is coming together...

So the physical hardware and software are coming along well. I have also been able to get around some device configuration issues.

First I set the gps to use the uart on the arduino. Apparently there is a hardware buffer that is better able to handle the nema strings than the newsoftserial library. I now get timely and reasonable coordinates.

Second I wired up the xbee shield to the software serial port. I also configured them to crank at 115200. I get some funny asci characters on occasion the the telemetry is solid enough.

I also have wired up the throttle and steering to servos in code. The steering now reacts to the given gps data, a target location, and the compass reading. I was able to get the jitters out but now when I swing wheels around I get somewhat erratic readings from the compass - always something to improve.

I now plan to use the telemetry from the hardware platform (using the RC controller) to gather some gps data. With this I hope to create a course up and down my street!

Monday, July 4, 2011

Turnkey Linux LAMP appliance and Zend

So I wanted to bring up a test environment for a web project I was considering. For this project I wanted a LAMP server with Zend server installed. Unfortunately the instructions and my weak knowledge of linux/apache stifled what should have been a straight forward install.

I now submit for my own reference and edification the steps I had to follow to get things running.

1. Installed Zend Studio trial on my windows host
2. Install vmplayer
3. Download the Turnkey LAMP appliance
4. Unzipped it and played it on the player - applied the security updates automatically and configured the network connections
5. Installed Samba (apt-get install samba)
6. Installed Aptitude (apt-get install aptitude)
7. I then followed the manual install instructions for Zend Server
8. Picked up the webmin samba component with (apt-get install webmin-samba)
9. Created a share to the /var/www/ folder after logging into webmin via the default IP assigned to the VM
10. Changed the file and folder permissions and chmod'd the web folder so I could write to it from my windows host
11. Created an example project via Zend studio in the shared LAMP folder
12. Finally configured the virtual host per the quickstart guide

Whew! So I now have a Zend server that displays the welcome screen and runs the example project. Now all I have to do is walk the example and learn how to use Zend. Hopefully it is easier than getting the example to work!

More coffee and jitter free Servos

So after an extensive look at example code I was able to smooth out those shakes. I ended up adding a delay() and servo.detach() after each servo.write() statement. With a lot of bench testing I am now able to turn the board and see the wheels turn in kind towards the offending waypoint.

Now what... guess I need to figure out how to go forward! I made another cable with some servo extensions and plugged everything into the arduino. After more fiddling with the stock speed controller on the Traxxas (the ESC XL 5 was set to training mode or something) I got regular servo commands to spin motors.

Yay!

So now I have left right and forward. Now I need to capture some gps data on my street to get multiple points for this thing to follow. I built an arduino stack with an xbee shield and the gps shield (both retail kits) with the thought I would strap this puppy down with some zip ties. With everything secured I then could tear up asphalt and wirelessly obtain my waypoints. Unfortunately I only get a few lines of lat/lon data before the wireless connection binds up and freezes on the serial monitor.

After a beer I came to the conclusion that the serial stream from the xbee (9600 by default) was probably binding up the flow of data from the gps and my print statements. I recalled reading in the Sparfun gps shield example that the baud rate needed to be 115200 to keep things nice. That or my arduino was browning out with my janky 9V battery connection... After another beer I decided that even if I was wrong I should be able to tinker with google maps and come up with some approximate points for testing.

Soon I hope to have the hardware stack rebuilt to put the bench test model onto the frame.

Wednesday, June 22, 2011

Jitters

So with code for the compass, gps, and servo all bootloaded up on the arduino I ran my first test of the navigation software. And it seemed to kinda work?

With the compass and bearing calculations establishing that I turn to the right or more lefter on a consistent basis the servo writes should be no problem right?

Wrong...the servo write statement did turn the wheels of the car when I pointed the arduino in a particular direction relative to a point, but the servo has got some wacky jitters as I continue to move things around.

At first I thought that I must be near a degree value where the bearing that was being calculated was bouncing to the left and right of the heading reading or vice versa.

Creating an error correction value that would allow for readings to bounce + or - 5 degrees still didn't fix the issue. Don't know what I will do to fix it but for now I can get things to turn in the right direction even if they are a bit twitchy.

Monday, June 13, 2011

Don't void the warranty!

With my code coming together for navigation I need to get back to the platform itself. I have decided that I finally need to put down the RC controller and see if I can actually control the RC car with the arduino.

Taking the top off the receiver wasn't too hard. Just had to remove some screws with the hex wrench that came with the car. After that I unplugged the servo and speed control. With some okie ingenuity I was able to rig up a connection to the servo with a servo extension from SparkFun even though the plugs didn't completely mate.


Once I got the whole thing wired up I began with some simple code from the arduino sketches to "write" the servo positions to the servo. I had to swap some wires to establish what was power, ground, and data but once that was established I was able to point wheels left, right, and center on command. I did notice that although the servo was equipped to run from 0 to 180 degrees the linkages under the car only allowed for a min of 45 and a max of 135 with 90 being dead center.

Soon I hope to combine the waypoint bearing calculations and compass readings from the navigation testing with the servo controller code!

Saturday, June 4, 2011

Fun with Trigonometry!

So now we have a nice heading value coming back from the compass. Next I need to calculate a bearing to know what to match my heading to. I Frankensteined my San Jose GPS module off of the old truck onto the dev shield that had the compass already running.http://www.blogger.com/img/blank.gif. With a few code tweaks to combine code from the compass example and last year's banana I was able to get a heading along with a latitude and longitude.

Ok so I know where I am and where I'm facing.... I need somewhere to go....

What I did to get crackin' at some testing was to pick several points (8 to be precise). The first four were directly north, south, east, and west of my current position on my desk.

This is fairly simple to fake, in North America we live in the 4th quadrant, latitude to the north will increase - latitudes south will have a smaller decreased value. For longitude we will have increasing numerical values to the east (although they will still be negative) and even smaller negative values numbers ("more negativer") numbers to the west.

For points north east, south east, south west, and north west I had to do some thinking but I already had values to combine from the first set of spoofed points.

Now the hard part: trigonometry. For me the classes that introduced me to the theories of Pythagoras were of a bygone era. Quite literally the last time I used trigonometry to do much of anything I was a decade ago. This was going to be fun I thought I'd just work out the 8 examples and with an arcosine or two I'd have the bearing in radians er or degrees ... or was that supposed to be arctangent?

I will admit that I eventually caved and got the calculation for bearing by googling. This proves that anyone regardless of how they did in math in highschool may be able to program a robot to drive itself around. More on test results later.

Wednesday, May 25, 2011

Heading out

So after running the car flat out and watching my children crash it into trees an parked cars, I decided it was far past time to get to work. I wanted to first address problems with steering from last year. I had a GPS module to tell me when to turn but I was using a rather crude delay to time the corning for the truck.

This year I got a compass! With the compass I should be able to get a heading to point the truck in the right direction. In the past I attempted to use the GPS modulehttp://www.blogger.com/img/blank.gif for this but had limited success. GPS modules need time to get locks and can take even more time it seems to establish that you are traveling in a specific direction. During last year's Autonomous Vehicle Competition at SparkFun I overheard several other teams having difficulty getting reliable data from GPS - either because of the weather (snow/rain) or because of weather proofing (plastic wrap, zip sandwich bags, tupperware, etc)

Instead I give you the HMC6352 for an instant heading. I wired up the HMC6352 to a development shield on my arduino and with some example code I was able to get reasonable values for where I pointed the little bugger. When I turned right the heading followed - turned left and numbers seemed to go in the right direction.

Yay!

Friday, May 13, 2011

Autonomous Vehicle Competition 2012

This year I competed again in the Spark Fun Autonomous vehicle competition. Like others in past years the weather was variable. Snow in the morning broke to sunnier skies by afternoon. A good time was had by all and it was great to see the field of competitors had grown a bit.

My 'bot Dr Zaius' Magnificent Flaming Banana opted for costumes instead of pyrotechnics. It seems there is at least one good spring fire that gives me pause. I was invigorated after seeing my cheap clearance RC truck attempt to make the first turn - straight into the loading dock / dumpster. Other heats were a little disappointing because of a short in my battery connector.

So after winning "best dressed" in my gorilla outfit, I decided that I might try a little harder this year and start earlier. In that vein I have also asserted to myself that I will no longer "rig up" things in a manner that "might work". Instead I will seek to construct things so as "not to fail". And I vowed to obtain a platform worthy of my code.

Enter the Traxxas Slash!

I picked up this little treat at the local hobby supply store. Attracted first to the claims that it can top out at something like 30 MPH and then completely sold when I saw how easy it would be to remove the cover and hack the steering servo and speed control unit.

I think we are in a much better starting position than we were last year but only time will tell!

Saturday, February 19, 2011

Entity Frameworks and Spatial Data

So as part of my new job I've begun self edification in ORM (Object Relational Modeling). I've been asked to evaluate methods to use .Net 4.0 Entity Frameworks with spatial data. The rub being that the framework currently doesn't support SQL server's spatial types.

After a lot of reading and some experimentation I think I've found a solution. There are some basic requrements I am trying to meet. First the solution needs to accommodate frequent rebuilds of the edmx model. I expect developers on my team to be making frequent changes and I don't want to be constantly making hand edits to xml. Second I need to allow for spatial queries - can't just axe spatial support altogether.

So first I built the model from the database using the wizard. No problem - I get the usual warnings that the tool will skip spatial types. No way to access the spatial data via EF.

I read that we can store spatial data as a varbinary in sql server. So back to the db to add a binary column. Put on a trigger to handle keeping the spatial column and the binary data in sync with a re-cast of binary data inserts or updates. Now back to visualstudio to rebuild the edmx. Sure enough same warnings but now I have my binary column that I can, with the addition of a patial class, cast to a spatial object. Additional casts back in the set method and I'm writting binary data back through EF. With my after insert trigger to keep things copacetic I am in business!

Just have to add some stored proceedures or explicit sql for spatial queries and done.

Monday, January 17, 2011

New beginings

So after starting my new foray into PHP dev with the Forest Service two things happened. The birth of my second daughter and a new job. Needless to say this, along with the holidays has occupied my time for the last few months.

The PHP project has completely stalled out due to my time constraints. It will now be progressing in a different direction with me providing some ad hoc support instead of a wholesale rewrite. Probably not much to share there I think.

My new job is now in development. I'm a database developer working on a project to replace some legacy applications. As part of that I've been asked to own and work on the data access layer. Now I've done some .Net development in the past and I've written some DAL code, but alas that was in .Net 2.0 and things like Linq to SQL and other object relational modeling systems have come to fruition. I will be frantically ramping up to grok as much as I can as things get cooking.

Monday, December 20, 2010

SSIS and Lego Mindstorms

So I've begun to skill up on Sql Server Integration Services (SSIS) in anticipation of starting a new job. My hope was two fold - to accomplish a professional development goal (MCITP Database Development Certification for 2008) and hit the ground running in my development role after the first of the year. So I went to crack open the Business Intelligence Development Studio (BIDS) and a self paced training kit. Much to my surprise the components in BIDS reminded me of Lego's integrated development environment.

It had been a long time since I've used BIDS for much. In previous development endeavors I was dissuaded from using SSIS or reporting services as they required exceptions in the production environment. Not since I studied for my exams for SQL Server 2005 had I really looked at SSIS and then it was with the intent of obtaining just enough proficiency to pass the exam.

In this last pass though it was apparent that fundamentally the two were very similar in their graphical syntax. For instance SSIS has the same "sequence containers" and "loop containers". Control structures do not have the same striking similarities but the concept of dropping graphical objects and linking them in sequences to accomplish a goal remains the same.

Less than a decade into my career, I fear my 8 year old son is already poised to surpass my technical skills.

Saturday, November 20, 2010

Silly String Shooter


Ok so after over a year of messing about I finally have completed my Silly String Shooter. It serves no higher purpose other than to optically recognize a threat and neutralize it with gooey silly string.

Here we have it with the heavy duty missile switch to arm the device, a potentiometer dial to adjust for range and an arcade over ride button to commence firing at will.

To begin I started with some basic hardware and an arduino. A friend, Andy suggested using a hinge to depress the button on the spray can. I also had some scrap wood, some "L" brackets.

After I roughed in a vertical post I mounted the servo and hinge. I cut and bent a wire coat hanger for the armature to operate the hinge. This worked marvelously.
I then proceeded to wire up an IR sensor and mount it to one side of the post (so as to "see" around the can of projectile goo).
I found what I thought was a reasonably sized enclosure for the arduino and such and proceeded to stuff it to the gills with buttons, dials, batteries and switches. Here is a shot of what is contained in the enclosure. Basically a battery, arduino, a dev shield, and the aforementioned external controls.
With a little bit of code I can use the powered up arduino to react to 2 different stimuli. The arcade button when depressed sends the servo into a pulsing fire mode that squirts unsuspecting intruders or kittens with silly string. Alternatively by arming the device and setting the distance with the potentiometer knob, perpetrators that break the IR beam are squirted automatically.

Check out the video for a crude demonstration.



Wednesday, November 3, 2010

New adventures in development

So I've undertaken a new project this past fall. I felt compelled to share what few skills I have with the Forest Service. It seems they have some volunteer websites they use to track volunteer hours, trail conditions, plants etc that could use some work.

Initially it seemed like a fairly simple task to knock off the rust from my php / mysql skills and sort out a few pages. Now it appears to be a slightly more daunting task with little or no documentation for the current site and a fairly complete data model for a go forward site. I expect some additional forensic work this week and some real coding soon.

Additionally, I've been reading blogs on SQL Server Central since catching Steve Jones at SQL Saturday #52. He had some interesting perspectives on creating a personal brand and the state of the modern resume. From now on I hope to post with more focus and regularity. I hope that with the new look and some discipline I can share my professional and volunteer experiences.

Tuesday, August 4, 2009

Making Maibock

So I got a few minutes now that the move has more or less concluded. Soon I hope to be firing up the soldering iron to prep for robothon! Mini sumo here we come. Additionally I want to get the arduino to log some temperature data from inside the mash tun. Projects whoo hoo!

This message has been sent using the picture and Video service from Verizon Wireless!

To learn how you can snap pictures and capture videos with your wireless phone visit www.verizonwireless.com/picture.

Note: To play video messages sent to email, Quicktime@ 6.5 or higher is required.

Wednesday, April 15, 2009

Fire in Motion


Criteria Met! Tinkerbell took off from the start line the first and second run. During the second run sparklers were aflame and I can now check autonomous robot on fire from my must do list. Now that I have a better idea of the terrain and the conditions (a beautiful Colorado day), I hope that there is another competition next year that will afford me the time to improve on the platform. All and all a great showing by all the competitors! There were some that ended up in trees or the drink, but I think everyone had a good time. Sparkfun put on a great event - and now I have as much time as I will ever have to prepare for the next one.

Tuesday, April 14, 2009

This is how we roll...

So after a lot of experimentation I have something. Will it find way points mmmm we'll see. I managed to hack up some code. I was able to combine libraries and wiring source from tinygps and newsoftserial along with ardupilot. With all these components I wrote a little code to utilize the libraries to acquire gps points, and used ardupilot to set up way points and plot courses. Now I wish I could do more testing. Many thanks to ardupilot and tinygps/newsoftserial creators! I'd be cooked without them or the arduino. Let's say right now I'm less crispy... code listing to come soon.

Speaking of crispy, my rocket igniters didn't fire up the sparklers. The plan was to wire some Estes model rocket engine igniters to the motor pins on the hbridge and have them start a sparkler as the robot began navigating the course. I think the sparklers are too beefy for one little igniter to set off. Sad to say it looks like I'm out of time on this one too and I'll have to remember to bring lighter.

For whatever reason, I could never get the bluetooth connection working on my laptop. In fact once I gave up on wirelessly driving the robot and gathering data I was finally able to get some code cobbled together. I wish I was able to "see" what the robot was doing later today on the course and it would be a lot of fun to drive the beast around the office later this week. Maybe after the competition I can trouble shoot some more.

I now have ambitious plans to write a java app for my phone so that I can drive and get data with it. Now that I know the Arduino and the development environment better I'm excited to see what else I can do. Lots of people seem to be doing a lot of really cool things.

Monday, April 6, 2009

More progress...

So I've been playing with NewSoftSerial for the Arduino. I'm still having difficulties coordinating all the serial communication from the gps out the bluetooth to the laptop. I can debug using the usb connection for now but once the streets are dry I want to see a rover about a way point. Hopefully I can at least get some data back while driving. The acceptance criteria for the final product of this project is officially reduced to pyrotechnics and any movement in the general direction if the first way point. Yeah I said pyrotechnics!

Tuesday, March 31, 2009

'Grounds are just magical'

So sayeth the EE. After being shown the data sheet for the h bridge, reworking a common ground to the arduino, the motors spring to life!

A quick bench test and the robot hurtled itself onto the floor to the end of its usb cable tether.

I've coded up some simple menus and added some way point code a la ardupilot. Can't wait to see if I can seek a point autonomously.

Sunday, March 29, 2009

End game approaching fast...

So after a spring break trip to Kansas and some work stuff I'm back in the saddle. Minutes before we left I was able to verify that my coordinates from the gps unit were good.

After I realized that the output was in degrees/decimal minutes, not degrees/minutes/seconds I was able to plot my exact position from inside my duplex! Google maps even put me on the correct side of the street - hooo raaay!

With that revelation I'm back to hacking up some code to get the motors to do something.
Additionally I found a really cool uav project - ArduPilot to rip apart. Hopefully with some simplification (I don't need pitch/altitude) I can save some serious time.

Friday, March 13, 2009

RTM

So I finally broke down and started to look for the data sheet for my gps unit. Before I even opened the link on the Spark Fun site I saw that the default baud rate was 38400.

Wah?

Well there is my problem! Setting this correctly in the arduino code fixed the ascii soup issue right up. Now if I can get lat and lon that places me outside China I'd be nearly back to where I was.