View Full Version : [Project] Jim and the Thinga-ma-bot - Update 3

03-02-2008, 06:49 PM
Well, figured my bot is currently a rover in the works, so I have moved my status postings into this sub forum.

For reference, my project consists of:

A RoboticsConnection Serializer WL as my controller
Bluetooth module on Serializer for communication
Large project box from Radio Shack
Parallax PING ))) sensor
Inexpensive 7.2V battery pack
Cheap RC buggy chassis that has 2 gearhead motors
JR Sport ST47 servo
Homemade wiring
Some various bolts/nuts and brackets from the garage
A wooden bumper
C#.NET Studio Express 2008There currently isn't a clear goal for the bot. I'm using it to experiment and learn while introducing my 6 year old son to programming, robots, and fabrication.

So the last time I posted an update I was using the PING sensor in a fix mount and was not happy with the speed and accuracy of sensor readings. Since then....

Servo Extender Wiring
Up until now I have been using an IDE hard drive cable for my sensor. It was the only cable I had that fit properly. As you can imaging it was way bulky and cumbersome to deal with. I went to a local hobby shop and they didn't have any female-female cables so I purchased some bulk wire and the terminators. After a little trial and error I have some working cables. Found out that soldering is not recommended as it tends to clog the receptacle.

C# Study
My basic programming skills have allowed me to do some cut/paste/modify code. However, when really working to understand how to properly dissect existing code and then reuse, modify and add to it I found that I was missing something. So I took some time to go back through the tutorials that Alex pointed me to and I feel like I'm about 80-90% of where I will need to be. Armed with this knowledge I went back into some examples and the documentation for the serializer and revised some of my code.

PING Motion
As I started to explore the PING sensor again, now that I had a better idea of what the code was doing, I was still not happy with the results. I visited the Parallax site and went through the sensor documentation, which helped me to understand how it worked. I also watched the video they have of the PING being used by the Boe-Bot. They use the sensor mounted on a servo to look around when it stops so it can find the most open path. I though....I can do that!

Sensor Mount
After seeing the sensor mount they used I pulled out some aluminum stips I have and roughed out a bracket. About 45 minutes later I had a bracket mounted to a servo and was putting the PING on it. Next I used some corner brackets to mount the servo on the front of my Thinga-ma-bot. Now to make it work...

Servo Code
I started with Alex's sample app for manipulating the servos, then found the sample code for the servo controller in the Serializer documentation. Between the 2 code examples I setup some test code that runs through a cycle of 5 positions (0, 45, 90, 45, 0, -45, -90, -45) and at each position reads distance on the PING to the console.

The PING sensor is just not living up to my expectations. I really do not know if I am not using it properly, if it is defective at some level, or if the Serializer just doesn't make good use of it. I frequently get readings of 255 (max result as if nothing is in range) when I have something directly in front of the sensor. In the current setup I rarely get any valid reading from the unit. The result is a situation that is not sufficient to automate the robot. I will need to find some alternative sensors and give them a try...

Here is the sensor mount:
http://forums.trossenrobotics.com/gallery/files/1/5/6/8/sensormount1_thumb.jpg (http://forums.trossenrobotics.com/gallery/showimage.php?i=147&c=3)

03-05-2008, 03:29 PM
Thanks for the update Jim!

I went to a local hobby shop and they didn't have any female-female cables

We have some female-female cables that work great with sensors on the Serializer:

The term "female" and "male" is very subjective when it comes to servos and sensors. We used the labeling that is on the package, but I think we're referring to the same cables:


I really do not know if I am not using it properly, if it is defective at some level, or if the Serializer just doesn't make good use of it.

Do you have some code I could look at, possibly just zip it up and upload it as an attachment? I don't have a PING sensor, but I can test it on other sensors that I have and let you know the results. I'm curious to see once you get the PING sensor working, just how well it works with the Serializer..

03-05-2008, 09:42 PM
I can see where my confusion is over male/female in regards to servo (and sensor) connectors. I'm thinking in relation to the actual connectors (the metal parts) and they label them based on the common plug (the plastic part).

As for the code, see below. This is a mod of the servo controller example code in the MSDN style documentation for the Serializer. There is also sample code for the PING sensor there as well. The PING sample uses a change in range to trigger an event, whereas in this example I am reading it manually when the servo is in the desired position.

03-06-2008, 12:04 PM
It's fun watching the evolution of this project. You are moving quite fast too! I actually sometimes wish I could go back and start learning from scratch again, that's the most fun part. I would suggest maybe playing with some of the sharp IR sensors if the ping drives you too crazy. The sharp sensors are cheap, fast , and easy. The only snafu to look out for is that the returned value isn't linear, but there are algorithms around the net for them.

03-07-2008, 04:17 PM
Ok. Unfortunately this project wouldn't open up in VS 2005 (what I have installed), so I had to download 2008. I finally got VS 2008 downloaded and installed yesterday and just got a chance to check out your app.

Unfortunately, I looked all around for a Parallax PING sensor and we don't have any here. We have them on the next order from Parallax so we should be getting them in pretty soon.

However, I did play around with the GP2D12 Sharp IR sensor (http://www.trossenrobotics.com/store/p/5429-GP2D12-4-30-inches-.aspx) quite a bit and I was getting some fairly reliable readings from this (see attached). It's a little hard to explain, but all I basically did was take a magazine, held it very steady over the sensor and slowly moved it closer then further away from the sensor. I also put a time stamp on each reading (down to milliseconds) so that you can see just how accurate and responsive these readings are.

Hope that helps a bit till I get ahold of a PING sensor:)

EDIT: Tyberius volunteered to send us his PING sensor, so when I get that I'll check out your code. Thanks Ty:D

03-08-2008, 10:54 AM
Thanks for the feedback guys! I really appreciate the help Alex. In a week or so, I should be able to order a few more sensors to play with.

In the meantime I am working on getting the bump sensor to work properly. I tried the example that Jason provided over on the RoboticsConnection site, but it caused my serializer to shut off when it was connected. So I need to work on the code to read such a sensor so I can do some testing with the physical parts.

If you get ahold of a sensor Alex, definitely let me know if you have any feedback.

03-10-2008, 12:20 PM
not a problem:) As soon as I get this sensor, I'll test it out for ya!

03-11-2008, 10:19 PM
Just an update...I replaced the PING sensor and the new unit seems to be working better. Or at least as well as the first one did initially. The bumps it took in my early tests must have damaged it.

With the new sensor, I'm back to getting decent response. There is still too much bumping, but I think that is going to be normal with most echo distance sensors. It tends to do good with most perpendicular surfaces, but suffers on angled or oddly shaped surfaces. I've placed an order for the Sharp IR sensor, so I'll play with it and see how it works. Perhaps a combination of the 2 will make a good set.

I was tempted to film the latest test with the bot. Now that I have the bumper protecting the sensor I was able to let it run longer. At one point it got stuck between 2 cabinets because it spins about 90 degrees. The result was that it would spin...stop....spin...stop. Rather comical.

I've also come to the realization that my platform is not going to be very effective. The front wheels are small and hard, so they do a decent job of sliding when the unit goes into spin mode, but they hang sometimes on grout lines of my tile. There is also an issue with the inertia required to get the unit moving vs. the resulting top speed. To be more specific, the minimum speed setting required to get the unit moving at all results in a moderately high speed if the unit has 3 or more feet to get up to speed before stopping. Lower geared motors should do the trick.

Oh the joy of picking up a new hobby...always something new to buy! :rolleyes:

03-13-2008, 11:02 PM
Hey guys! I got the Sharp IR (GP2D12) today. I haven't had time to implement it in my robot's code yet, but did play around with the sample code. Wow! Much nicer output than the ping. In comparison the IR sensor returned a much higher rate of output and seems to be less sensitive to the angle of the object in front of it. I'm really looking forward to getting this new sensor integrated into the code to see the results in the bot.

Will be working with it this weekend...along with possible mechanical upgrades.

03-14-2008, 03:20 PM
Much nicer output than the ping.

Great to hear! I had a feeling that you'd get a much better output.

I'm not sure if this is how all IR works (not an EE guy), but in my experience, IR is more "direct" than sonar. What I mean by that is that you have to have an object directly in front of the sensor for a reading to register. With sonar, you can get a reading of an object being in it's path, when it's really 10" to the left of the sensor. This is a good thing in some situations, bad in others.

04-15-2008, 05:37 PM
Hey Jim,

Many I'm sorry! Between moving our office and moving our website, I totally spaced out here and forgot to get back to you. I was just going through my box of "bot toys" and found that PING sensor and I realized I never did get back to you:o

I didn't have much luck with the PING sensor either with the Serializer. I just couldn't get an decent resolution out of it and the response time wasn't all that great either. I'm not sure if this was a problem with the PING itself or with the Serializer.

Have you had any more luck with this?

04-15-2008, 05:47 PM
Was that the Ping sensor I sent you? I had it working just fine for me on one of my basic stamps, so I think the sensor is fine.

04-15-2008, 05:59 PM
Sorry Ty, forgot to give you some cred;) My mind's been everywhere today, haha!

Yes, that was the Ping you sent over to us, thanks a ton by the way! I was really scratching my head trying to get it to work with the Serializer. Once I got it working, it just didn't seem to work as good as what I would think it would. Since it worked well for you, I'm going to have to revisit this again when I get a bit caught up with everything. Once I check everything out again, I'll post back here with the results. Also, if I get a decent demo working well, I'll upload it to our new downloads section (soon to be announced:D)

04-17-2008, 02:21 PM
Ha, no need for credit :p I just wanted to give you a control that it was at least working within expectations for me on my Basic stamp some months ago when I was playing around with my quad. It sat in one of my parts bins in an antistatic bag for all the time after that, so as far as I know, its 100% good to go and working.

Id ask to compare code, but my C# skills suck :p

04-21-2008, 08:54 PM
No problem Alex, I've been busy myself. I think I noted somewhere else that I picked up another PING after the first and got a slightly better reading (the first got beat up a bit before I had a bumper...hehe). The IR that I picked up later was way better. At a guess I would say it is might be something in the .NET library provided, but that is just a guess.

I'm a bit on hold with the bot at the moment. I've tried some different platforms since the project box, but just wasn't really happy with the results. I think I will hold out for one of the platforms that are made for the serializer just to save some effort on working out the little bugs of a new mobile platform.