leider bin ich in der Suche nicht fündig geworden und die Site scheint ein Problem bei der Darstellung der einzelnen Nodes zu haben.
Ich suche eine Möglichkeit einen Devantech USB-I2C-Adapter zum Laufen zu bringen. Ich betreibe damit einen SRF02 Ultraschall Abstandsmesser von Devantech (Beides bei roboter-teile.de gekauft).
Im Grunde müsste der RS232-node den Sensor via USB ansprechen. Ich sende also einen per Spellvalue gewandelten Hex Befehl an den Sensor. Dieser zeigt allerdings nicht (wie beim Devantech-Tool zu sehen) per LED an, dass er etwas empfängt, und er sendet auch keine Daten.
Die Frage: Hat jemand das Problem gelöst und eine Tipp, was man tun muss, dass es funktioniert?
OK, I realize that this an English speaking forum, so I’ll say again in English.
I’m connecting an Devantech Ultrasonic distance meter (SRF02) via an USB-I2C-Adapter to vvvv. The RS232 node should actually send a Hex Command to the Interface. But there is no reaction (LED blinking) or so.
Drivers are installed, the supplied app from devantech reads the distances perfectly.
Anyone here ever used an USB-I2C-contruct this way and had good results?
hi philipp, i just had a look at your patch and the documentation you provided and i think you’re doing some things wrong ;)
first of all don’t use SpellValue (String). you want to send the command “Real Ranging Mode - Result in micro-seconds” (82 in dec), but you’re sending 52 (dec) which is not a valid command. so i’d recommend to avoid the hex address representation and stick to the dec ones.
second thing, simply writing 82 is not enough. you need to tell the SRF02 to do a ranging (writing a 82 to its command register), then you need to wait up to 66ms till it has written the ranging result to its output registers and after that you can read the result from there.
now to tell it to do the ranging have a look at the example “Writing to I2C devices with a 1 byte internal address register” from here. the byte sequence should look like this:
0x55 | 0xE0 | 0x00 | 0x01 | 0x52
in dec
85 | 224 | 0 | 1 | 82
this tells the usb-i2c module to write one byte (the actual SRF02 command) to the i2c device located at address 0xE0 (the SRF02) and register 0x00 (the command register).
after that you can read the data. probably like this:
0x55 | 0xE1 | 0x02 | 0x02
this tells the usb-i2c module to read two bytes from the i2c device located at address 0xE0 from register 0x02.
again have a look at the section “Reading from I2C devices with a 1 byte internal address register”.
also check the section “Checking for Completion of Ranging” here.
hope this helps.
oh and please don’t take the things i wrote here for granted, i don’t have that hardware to test it…
OK, thanks again, and thank you Kalle. I used the patch you did to encode a string to have some easier way of putting my commands in.
Now I only have the Problem, that I don’t have the slightest idea how to read out the distance measured from what I’m getting from the Sensor.
But so far this is where I am right now.
(Sorry for adding another Newbypatch)
Anyone an idea how to easily extracting the distance information?
Of course I’ll need to implement the 500mS wait somehow without making things to shuttery.
AND of course the reading register is 2 and not 0. I’ll upload another corrected patch, as soon as I get this stupid web problem around here fixed.
EDIT: OK here goes. It’s the latest state. I can’t seem to find the right string for reading. LED responds on the write but not on the read send. (see att.)
Ranging
send the ranging command to the device and if the rs232 node returns non-zero emit the OnRangingDone event.
Polling
like described in the article, read register 0 of your device and once it returns a value other than 255 (0xFF) the ranging is complete and you can emit the OnPollingDone event.
Reading
read the ranging result from the device. in register 2 (R2) is the high byte in register 3 (R3) the low byte. so your final result is:
(R2 << 8) | R3
and now emit the OnReadDone event and the automata goes back to Ranging state.