Reading PING ultrasonic sensor results in a PC Software

Hi everyone,

I dont know whether this has been done before or not, but I didnt find any related thread around so i thought I should post it in this section.

My goal is to install a PING Ultrasonic range sensor on my hex to measure the distance from an obstacle. At the moment I am communicating with my hex through SSC-32 over BlueSmirf with a matlab program. Through some searching I found that PING cannot be connected directly to the SSC-32 analogue ports which concludes that I must use BB2 with Atom pro in conjunction with SSC-32.

Precisely, my goal is to measure the distance and read the results back in my computer software which is driving the robot. Since I am controlling my bot through a matlab program so I want to read the sensor results back into my program for some room mapping and simulation purposes.

Therefore, i need initial thoughts and steps to start with. I have a BB2 and Atom pro, and i may start with connecting it with SSC-32 according to the phoniex tutorial posted at lynxmotion. But i seek assistance in writing a program for the PING sensor. And a method to read back the results in computer software.

Hence, the main theme is to issue the instruction from a pc software to detect distance using PING and recieve the results back into the pc software. And i dont know what electronics should come in between to materialize this intention. I have the required equipment. All i need is your support and assistance in the right dimensions.

I appreciate your assistance. Thanks a lot

You might want to look at the below ultra sonic range detectors. They have an analog output that could be used with the ssc-32.

maxbotix.com/
maxbotix.com/BUY_NOW.html
oceancontrols.com.au/Sensors … o_0725.htm

Well i find a serious trouble in making up the connections.

My current configuration is that SSC-32 is communicating with PC through BlueSmirf, so the RX & TX pins are occupied. How should I connect the BB2 with SSC32 now?

Secondly I want to communicate with Atom pro through BlueSmirf. Is it possible?

If i connect a bluesmirf with BB2 and communicate over bluetooth with the PING sensor,would this configuration be sufficient to collect the date from sensor to pc application?
so one bluesmirf connected to ssc-32 would be controlling the hexapod at one com port,and the second bluesmirf would be used for pan&tilt movement and ping sensor control on a different com port.thus this way both the boards would work independently.
Once i collect the data from ping sensor,i may manipulate it in my pc application to make decisions for the ssc32.does this work flow seem pragmatic?

since ping cannot be connected directly to ssc32 and nor BB2 could be connected with SSC32 over a common bluesmirf link,i think this is the only way to read the ping data in computer and then instruct the ssc accordingly.
Any thoughts/suggestions/recommendations plz.
I shall be thankful

I have not done much with the bluesmirfs. So take my answer with a grain of salt.

If you would like to use the bluesmirf to program your Atom Pro (or just atom) remainder I will simply state BAP, I don’t think you can get sufficient band width. if however you wish to simply do communications from your program on the PC to one on the BAP, I believe you can do that. Simply plug it into one (or two) for bidirectional TTL pins. If you place it on IO pins 14 and 15 you can use HSERIAL support on the BAP.

If you are adding a BAP to your system, you have several options. You could setup the SSC-32 to communicate to your pc as yo have been doing, or you can simply have it connected to the BAP. You could define a packet format that you send between the PC and the BAP, which on the BAP you could then generate the appropriate ascii commands to send to the SSC-32.

As for having them run independently, could be done. Is it a good thing? Good question. Could always try and find out. However you may find that having the BAP send the info to the PC with the serial time delay plus the processing time, plus the serial time delay when you send the command back from the pc to the SSC-32 might cause some delays? Maybe not. Also might not be bad to have some local decision making. The robot is marching along, coming up to a cliff that sensors detect and oops we lost communication. But then again since this is a hex and you have to probably generate many steps per leg movement, it may not be a problem as it would probably just stop mid stride. (More of a problem with a rover where the motors are a runnin).

Sorry for my rambling. Hope some makes sense.

Kurt

115.2k would not suffice the bandwidth requirements; Considering the fact that BAP would gonna be used for PAN & TILT servos and PING sensor only, not even then?

Is there any significant benefit in using BAP as an intermediate platform between the PC software and SSC32? At the moment the commands are issued directly to the SSC32 over blueSMIRF. Considering the scenario where BAP is communicating with the SSC32, should the work stream be like this:

  • BAP is connected via BlueSmirf with the PC at 115.2k baud rate.
  • PC software sends data in form of a packet to BAP over BlueSmirf.
  • BAP translates the packet to appropriate ascii commands and issue them directly to the SSC32.

Considering this scenario, the advantage I see is an option to add PING sensor support with the BAP which in the previous case where PC software was communicating with SSC32 over bluesmirf was not valid.

You are absolutely right about the delay which may aggregate to some significant levels in this case. The only intention to do this was to integrate PING sensor in my current hexapod configuration. But as apprehended above a scenario where BAP comes in between SSC-32 and PC application, I believe it may enable me achieving my goal.What do you say?

So, summarizing the findings, I create the following work flow.

1- I connect bluesmirf to BAP (dont actually know how to do that).
2- Setup a serial connection with BAP just as I did for the SSC-32.
3- PC application issue motion commands to BAP which in-turns instructs SSC32 accordingly.
4- Control PAN & TILT servos as well from SSC32.
5- Connect PING ultrasonic sensor to the I/O of BAP.
6- Write some lines of code in BAP which enables/disables the PING from PC application control.
7- Once PING is enabled, BAP collects the PING data,translates it in appropriate distance measurement and send them to PC software over the same BlueSmirf connection.

Now I have obstacles data in my PC software, which can be used for some offline map building. And if it has to be used for real-time obstacle avoidance, it is preferrable to make the decision inside BAP rather than from PC software and sending it to SSC32 over the same above mentioned data transfer flow.

Does everything sound logical? and pragmatic?
Any shortcomings or bandwidth issues in this case?
I appreciate your support and cooperation

Thanks

Ok, to accomplish the step 1, here are my findings:

  • Connect BB2 with SSC-32 according to the phoenix tutorial. i.e. yellow cable connects TX pin of SSC32 to the inner most PIN 10 of BB2. Red wire connects RX pin of SSC32 to the inside PIN 11 of BB2. Black wire connects ground pin of SSC32 with the outermost PIN 10 of BB2.

  • Now connecting BlueSmirf with BB2. the yellow cable connects TX-O pin of BlueSMIRF with inner most PIN 14 of BB2, the blue cable connects RX-I pin of BlueSmirf with inner most PIN 15 of BB2. Where should the cables from PWR and GND pins of BlueSMIrf be connected on BB2?

does the above configuration seem appropriate?or should I connect the other way around i.e. SSC32 with PIN 14 & 15 and BlueSmirf with PIN 10 & 11 of BB2?

Step 2

I define the following constants to be used in the code:

BT_IN con p14 ;bluetooth in-pin
BT_OUT con p15 ;bluetooth out-pin
BT_BAUTE con i9600 ;BlueSmirf Baud rate

SSC_IN con p10 ;SSC-32 in-pin
SSC_OUT con p11 ;SSC-32 out-pin
SSC_BAUTE con i9600 ;SSC-32 baud rate
**
Is it mandatory to set the baud rate to 38400 for SSC32, BB2 and Bluesmirf? or setting 9600 to all would work also?**

Now I need BAP code to initlialize these com port settings. Secondly, my PC application was sending over servo move commands to SSC32 previously, which now should go to BAP in some packet form. What sort of packet? Can anyone shed some light on it? The information the packet may contain would definietly be the SSC-32 servo move instructions but in what form? and how to translate it back in BAP to ssc-32 servo move instruction?

Thanks

Anyone got any answers to my questions?

Thanks.