View Full Version : Ping = lego?
01-23-2007, 01:52 AM
Yup it's me again... I got by on some other things but now I need some help wireing up this Lego Ulrasonic sensor to my bs2 (board of Ed), But the wireing's not the same. PING's got 3 wires (RED, WHT, BLK) and this Lego's got·six (WHT, PRP, RED, GRN, YLW, and BLU)... How can I wire this up? Here's a pic... THX.
01-23-2007, 02:02 AM
You need to find out what the wires do then maybe we could help. Put these types of posts in the sandbox area in the future.
01-23-2007, 02:09 AM
gotcha, thx. I'll start testing em asap.
01-23-2007, 04:01 AM
All the documentation I can find (http://www.wooster.edu/physics/jacobs/220/Appendix_7_Ultrasonic_Sensor_I2C_communication_pro tocol.pdf)
seems to indicate the Lego Ultrasonic is I2C communication based. It also looks like it's using 2 wires, not 6, but I haven't found a wiring diagram yet.
I still say a Ping sensor would be cheaper and easier to interface, if you want to go that way.
Post Edited (allanlane5) : 1/22/2007 8:05:56 PM GMT
With a BS2p you can use native I2C commands. The two data wires are the I2C SDA and SCL wires. Which is which you would have to try out. I2C is a protocol where you send the address of the device, then [optional] commands/data, then read in whatever data you've told the device to give you.
See I2CIN and I2COUT in the Stamp manual for examples. For the Lego Ultrasonics it *appears* that the device address highbyte is always $02 (hex 02) and then the lower byte is the register you want to read/write. You might want to start with just trying to read the version number of the device so you can verify that the device is online and you can communicate with it.
I do think this device is a bit more complex to use than a Ping))), and doing it on a BS2 would be more involved since I2C is not native on the BS2. But if you were using it with a BS2p (native I2C support) then it looks like the device does some pretty cool things. In particular the "event" capture, where the unit will not take a sonar ranging unless it can not detect *other* ultrasonic noise in the vicinity, and the captures where it will record 8 data bytes of ranges to 8 objects. Some experimentation would certainly be in order, I'm sure.
When the going gets weird, the weird turn pro. -- HST