Asked — Edited
Resolved Resolved by thetechguru!

Ultrasonic Sensor On Jd

I have my robotics class working to implement an ultrasonic sensor on their respective EZ-Robots. Each group uses a different type of robot - JD, Six, & Roli. I'm trying to help out the student with JD, but some of the problems extend to the other robots.

First of all on JD, there is no easy way to mount the ultrasonic sensor onto it. I tried removing JD head, but this seems to cause disconnection problems when using the ultrasonic sensor. So, for now, I have JD's head back on and loosely mount the ultrasonic sensor onto JD's body.

I have the sensor connected as described in the Ultrasonic Distance tutorial (using ports D21 & D22). Using this configuration along with the Ultrasonic Distance control, I am only able to get a value of 255 displayed wherever the sensor is pointed. The value never changes. There is a red LED on the black/red leads that always remains red. I get the same results using the Collision Detection and Radar controls, too. Any ideas on what I might be doing wrong?

Also, is there a way to obtain the actual distance reading that can be used as a trigger in a script?


ARC Pro

Upgrade to ARC Pro

Harnessing the power of ARC Pro, your robot can be more than just a simple automated machine.

#1  

If you remove JD's head, you need to remove the "JD Eyes" object (sorry I don't know the actual name in the project, but it is the RGB block inside the head) from your EZ-B project. Otherwise the EZ-B will lock up. This is true of any I2C device referenced by a project but not connected to the EZ-B.

If you are getting a constant value of 255 it is probably that you over-volted or reverse connected the sensor and it is burned out. The LED on the voltage regulator should always be red, so that isn't an issue. If you connected the sensor without the voltage regulator, that would have instantly burned it out. They are unfortunately fairly sensitive. They read 255 constantly when they are dead. They also read 255 when there is nothing within the detection range, so be sure to move your hand or an object a few inches form the sensor and make sure it is not responding before declaring it dead and giving up.

Once working, the value returned will be related to the distance, but each sensor is slightly different so it isn't like you can say 5=5" all the time. But the sensor will be consistent, so once you figure out what the increment is, it will always be the same for that sensor (although this is somewhat dependent on the object being measured. Soft surfaces will read further away than hard surfaces that give a good reflected signal).

Alan

#2  

Also make sure your trigger and echo lines are connected to the right ports. If you try to read the trigger port instead of the echo port it will read 255.

Alan

#4  

Alan -

Thanks for the prompt reply and the excellent info. When my student gave me her JD, I discovered that the connectors were placed on the wrong pins. I corrected that problem, but from what you say, the sensor is no longer any good. Can you tell me if the sensor is repairable? You would think that a sensitive part like this would have a fuse or some type of overload circuitry built-in. At the very least, it should have had prominent WARNING paperwork that shipped with it.

I figured that without JD's head, all of the controls associated with it must be removed from the project. After removing those controls, the disconnections stopped. Even so, the sensor did not work properly so I added JD's head back. Now that I know it's the burned-out sensor, I will have to forego doing this project with JD. I will check on the other groups to make sure they are not having the same issue with their Six & Roli.

Thanks again for you excellent insight.

Al

#5  

As far as I know the sensors are not repairable. The expensive part though is the voltage regulator and EZ-Bit case. You can get those sensors for $1-$2 a piece in bulk on eBay.

I have a couple of spares. If you want to send me your mailing address (my email is in my profile) I can send you one that will get there within a few days so you don't need to wait for EZ-B order processing or pay $20 shipping on a $20 part.

Alan

PRO
Synthiam
#6  

You should not be able to damage the sensor by plugging in the wrong pins, or in the wrong way. The sensor should still be fine.

As Alan mentioned, the RGB Animator control will need to be removed from the JD project if the head is removed. The "lockup" which you are experiencing is due to the RGB Animator control looking for the RGB Eyes, which are in JD's head. If the head is removed, the eyes will be removed as well - leaving the animator unable to speak to the eyes.

The ultrasonic sensor control is unable to lockup the ez-b. It is impossible for any ultrasonic sensor control to lockup the ez-b because it simply "waits a period of time for a response". This is due to how the sensor works. The sensor returns a pulse width which reflects the distance. There is a maximum pulse width timeout in the ez-b, so it can never lock up.

Ensure the ultrasonic sensor is connected correctly and you should be back on your way:)

#7  

I have already reconnected to the proper pins (D21 Black/Red/White, and D22 Green to White pin). The sensor is still pegged at 255. I previously restored JD's head to get rid of the disconnect problem.

On your tutorial video, I believe you mentioned that black goes in the middle, but it looked like you were using a different device.

I must still be doing something wrong if you say the ultrasonic sensor is not burned out and is still working. Now I have to figure out what it is that I am doing wrong.