Srf235
John Board
Posts: 371
G'day,
Recently purchased a SRF235 Pencil Beam ultrasonic from Robotparts.com.au, and I've finally gotten around to playing with it. Decided to use my BS2px over my Prop(s), because there was some PBASIC example code. I've run into some issues - the sensors is using the I2C protocol, which I haven't any experience in (although I've been wanting to learn for a while). Useful Info:
"Data Sheet Page": http://www.robot-electronics.co.uk/htm/srf235tech.htm
BS2 Example: http://www.robot-electronics.co.uk/htm/srfxxbs2p.htm
Wired up as per instructions (except I/O), V+ to 5V, GND to GND, SDA to P1, SCL to P2, 4k7 Resistors between SDA and SCL to 5v. When I turn on the BOE, the sensors's red led turns on, for a brief period, as per the datasheet. The output from the serial terminal is as follows:
The code is:
So, although the IO is different in the electronics, changed the code to match (SDA being pin 1, as that's where the physical SDA is). Looked for physical obstructions to the sensor. that'd skew the readings, but it doesn't budge off 0.
Anyone have any ideas what I'm doing wrong?
Cheers,
John
Recently purchased a SRF235 Pencil Beam ultrasonic from Robotparts.com.au, and I've finally gotten around to playing with it. Decided to use my BS2px over my Prop(s), because there was some PBASIC example code. I've run into some issues - the sensors is using the I2C protocol, which I haven't any experience in (although I've been wanting to learn for a while). Useful Info:
"Data Sheet Page": http://www.robot-electronics.co.uk/htm/srf235tech.htm
BS2 Example: http://www.robot-electronics.co.uk/htm/srfxxbs2p.htm
Wired up as per instructions (except I/O), V+ to 5V, GND to GND, SDA to P1, SCL to P2, 4k7 Resistors between SDA and SCL to 5v. When I turn on the BOE, the sensors's red led turns on, for a brief period, as per the datasheet. The output from the serial terminal is as follows:
BS2p to SRF08, SRF10 or SRF235 Firmware Version 0 Light Sensor 0 (SRF08 only, Reads 128 on the others) Range 0 cm
The code is:
'{$STAMP BS2px} ' {$PBASIC 2.5} '*********************************************************** '** ** '** I2C Routines for the Basic Stamp BS2p ** '** with the SRF08, SRF10 and SRF235 Ultrasonic Rangers ** '** ** '** Copyright 2005 - Devantech Ltd ** '** Commercial use of this software is prohibited ** '** Private and educational use only is permitted ** '** ** '** Written by Gerald Coe - February 2005 ** '** ** '*********************************************************** ' Connect P8 (pin13) of the BS2p to the SRFxx SDA ' Connect P9 (pin14) of the BS2p to the SRFxx SCL ' Use 4k7 pull-up resistors from SCL and SDA to 5v supply SDA CON 1 ' SDA on pin13, SCL on pin14 Ver VAR Byte Light VAR Byte Range VAR Word ' range LP: I2COUT SDA, $e0, 0, [81] ' Rangeing command - 80 for inches, 81 for cm, 82 for uS PAUSE 100 I2CIN SDA, $e1, 0, [Ver, Light, Range.HIGHBYTE, Range.LOWBYTE] DEBUG 2,0,1, "BS2p to SRF08, SRF10 or SRF235 " DEBUG 2,0,3, "Firmware Version ", DEC Ver, " " DEBUG 2,0,4, "Light Sensor ", DEC Light, " (SRF08 only, Reads 128 on the others) " DEBUG 2,0,5, "Range ", DEC Range," cm " GOTO LP
So, although the IO is different in the electronics, changed the code to match (SDA being pin 1, as that's where the physical SDA is). Looked for physical obstructions to the sensor. that'd skew the readings, but it doesn't budge off 0.
Anyone have any ideas what I'm doing wrong?
Cheers,
John
Comments