Problem getting sensor working

I just received the BrickPi and started to experiment with it. The motor example worked just fine. I only have one sensor available, the LEGO Ultrasonic sensor. The sensor example for the ultrasonic sensor does not work. Debugging the Python code I see that BrickPiRx returns -2 which means that it times out. Why it times out is up to now not clear. Any suggestions?

Have you verified it’s on the correct port? If the motor example is working correctly, that means the BrickPi is probably working correctly. The best bet is that it might not be on the correct port.

Another question: how are you powering the BrickPi? To use the US sensor, you need to have 9V on the BrickPi power (you can’t power it just via the USB port).

It is on the right port. I also checked the other ports. It is powered with a 6xAA 9V block in addition to the standard USB power plug. I use brand new batteries, measuring a total of 9.4V.

The function call that fails is BrickPiSetupSensors() which returns -2. The motor example is still functioning so I assume the BrickPi itself is functioning. What additional tests do you propose?

PS: it is inside BrickPiSetupSensors() that BrickPiRx() returns -2, even when I increase the timeout.

Another PS: building the SimpleBot I just noticed that the motor example just works on Ports A and B, ports C and D seem dead. Maybe there is more wrong with the card?

That’s interesting. Maybe one of of the chips is dead. Is there a way you can move the US over to another side, on a different sensor port (ex, if it’s on 1/2 can you put it on 3/4?) Does it work when you change the sensor port?

I was allowed to return the board to Robotshop.com for an exchange. Good service. Keep you posted when replacement arrives.

Ok, great. I hope we can get somewhere with this quickly. thanks tjeerd, please keep us posted here.

Today I received the replacement from Robotshop.com. And everything works perfect now. I have a SimpleBot moving around here now with a ultrasonic sensor working and showing me pictures from the Raspicam. Very nice! The first board was just not good, that can happen. I am glad I have a good working replacement now.