I require your help regarding a problem I’m encountering.
Description:
I am attempting to use an ultrasonic sensor in conjunction with my quadruped robot. I would like for the robot to sense its distance to a wall or barrier and stop moving if it is close.
I currently have code that runs on my quadruped that allows for the robot to take in Serial input like forward, backward, stop, turn, etcetera. Therefore, all I need is an Ultrasonic sensor that would send data over Bluetooth to my computer, have my computer analyze the data, and send the appropriate commands to the robot.
Is this feasible? Is an Ultrasonic sensor made by RobotShop that would work with this system? Has something like this been done before?
Hardware concerned:
Lynxmotion Quadruped Kit
BotBoarduino
An Ultrasonic Sensor
Software concerned:
Modified Pheonix code to accept Serial input
Possible other code required to program the ultrasonic sensor, interpret the ultrasonic data, and send commands to the BotBoarduino
Troubleshooting steps already taken:
Researched possible parts, but was unsure of which one would be best in this system
Thank you so much in advance for your help!
Best,
Christopher
I am unfamiliar with the setup you have and of course I have no idea what your code looks like, but I can offer a bit of guidance.
All of the ultrasonic sensors I am aware of are designed for direct connection to and control by a micro. None of the ones I know of have a serial interface. However, it would be quite simple to use almost any ultrasonic sensor and a small arduino board as a module. The arduino could run a simple program that controls and reads the sensor (or multiple sensors if you desire) and sends the data over the serial link. IF you truly need serial input that is what I would recommend. The cost would be low (probably a lot less than if you do find a serial ultrasonic sensor), it would be fairly easy to implement, and would be quite versatile.
However, if the computer you are using on the quadruped has the resources it may be better to interface the sensor directly. Most ultrasonic sensors require two digital pins: a trigger pin and an echo pin. A pulse on the trigger pin starts the measurement and the computer counts the time until an echo is received on the echo pin. That time is then converted to distance with a simple formula. That would be mostly the same code as would run on the arduino / ultrasonic module I described above. You don’t state exactly what the computer is but you mention the BotBoarduino. It is likely that it would have enough resources available to use the ultrasonic sensor directly.
In either case people here, myself included, could help you if you run into problems.
Hope this helps.
If you really want to send the reading to your computer, you would need to add a BT module and have the BBduino read the value and send it (same programming needed as the option above). You’d then need to “listen” for the computer to reply, all while running the Phoenix code (which becomes a bit harder).
Thanks so much for your prompt reply.
How would the sensor attach onto the BotBoarduino as you described for the Phoenix code to utilize the sensor? All the IO pins on the board are currently occupied by the IO extension board.
As I said, I’m not familiar with your setup. But I looked at the Phoenix on the Lynxmotion site and according to what it says there it is controlled by the Botboarduino connected to an SSC32 servo controller. If that is the case, the “shield” probably connects to all the I/O pins, but actually only uses a very small number of them. In that case, the others should mostly be free to use and I suspect connections are routed through the SSC32 to allow that. Perhaps the user guide/tutorial has that information.
Here is a link to the Lynxmotion section where you can find links to all the documents. http://www.lynxmotion.com/c-117-phoenix.aspx
Both the PING and Sharp are compatible with Arduino, and therefore are compatible with the BotBoarduino. The Sharp can plug directly into the analog pins (ensure the pin order is correct when plugging in). There’s a tutorial and a library for the PING: https://www.arduino.cc/en/Tutorial/Ping https://playground.arduino.cc/Code/Ping
Can the PING also plug directly into the analog pins?
Additionally, are analog pins you are describing on the Gravity I/O expansion shield?
Finally, are there any other sensors that you reccomend? I am planning on buying a few sensors to test, so I am just trying to determine which ones to purchase.
The PING needs a digital pin. Yes, the gravity shield simply breaks out the analog and digital pins, making connections easier.
For indoor use, you can experiment with the Sharp analog IR distance sensors, the PING, and perhaps an inexpensive ultrasonic: https://www.robotshop.com/en/hc-sr04-ultrasonic-range-finder.html
Do you want ideas for general sensor experimentation outside of sensing distance for a hexapod application?
It should probably be noted that on most Arduinos the analog pins can also be used as digital pins. I am not familiar with the Botboarduino or the gravity shield so it is possible they limit that.
suggestion… use two ultrasound or IR sensors in a differential configuration to drive your control singla modifier. with one facing forward/left one forward/right … works well to say get the hex through doorways etc… self centering
Thanks!
Would you recommend a similar approach when attempting to overcome some of the angle restrictions? For example, using multiple sensors so I don’t have to be walking directly straight in front of the wall and instead can be pointing at the wall at various angles.
you could use several at different angles. Code reading and calculating differentials between any two or combos thereof to give you distance relations to discern how close and at what angle compared to what direction you are moving.
Good afternoon,
Is there a sensor that would detect if the quadruped slips, or looses balance? From this, I would disable movement until it is repositioned.
Moreover, how would I connect multiple sensors onto the I/O shield? Is there an extender that I can purchase?
You could use an IMU which can be used to detect the angle at which the robot is standing. Regarding connecting multiple sensors to the I/O shield, it should have all digital and analog pins broken out, so if you need additional pins, you might need a different microcontroller. Note that if you are using the BotBoarduino, you can use the adapted Phoenix code and the SSC-32U servo controller to get your robot up and walking fairly quickly.
If not, your main issue will likely be implementing a proper walking algorithm.
Did you create your own code or you’re using something existing? Lynxmotion’s BBduino + SSC-32U using the Phoenix code really is about as good as it gets if you’re using RC servos. In terms of IMU, you need something fairly low g, and low rate of acceleration, like: https://www.robotshop.com/en/6-dof-gyro-accelerometer-imu-mpu6050.html
Note that this is I2C.