BrickPi doesn't work

I bought the BrickPi back in January, 2014, and finally decided to use it. It isn’t working. I have Dexter Industries raspbian image on the sd card and 9.0V power supply connected to the BrickPi. When I ran few sample programs initialization shows 0 and the next number (sensor setup I think) is -1.

M,
Sorry to hear about your troubles. A few questions:

  • Which sample programs did you try running?
  • Which language are you using?
  • Can you be more specific about your 9.0V power supply? What exactly are you using?

I’ve tried programming in “C” using the following samples: “LEGO - Motor Test.c”, “LEGO - Ultrasonic Sensor test.c”, and “LEGO - TouchSensor test.c”.

The power supply belonged to old a wifi access point. It connects to the wall outlets, and according to its label it provides 1.11 amp. I didn’t use oscilloscope, but a voltmeter shows a steady 8.96V while the Pi is running.

Hey m_dhar,

A voltmeter is good enough, no need for an oscope. Two more requests before we declare it dead:

  • Can you try running the python program “LEGO-Touch_Sensor_Test.py” and make sure that the documentation uses Port 4, and that you have the sensor on Port 4.
  • Wall based power supplies can be tricky. Maybe you can try a battery pack? Do you have an 8XAA battery pack available?

Hey m_dhar,

A voltmeter is good enough, no need for an oscope. Two more requests before we declare it dead:

  • Can you try running the python program “LEGO-Touch_Sensor_Test.py” and make sure that the documentation uses Port 4, and that you have the sensor on Port 4.
  • Wall based power supplies can be tricky. Maybe you can try a battery pack? Do you have an 8XAA battery pack available?

Good news: python touch sensor test program works!

Bad news: I don’t really know why C program isn’t working.

Why doesn’t the python program check the status of initialization or sensor update before continuing? From a quick glance, I am guessing my program stops somewhere in BrickPiSetupSensors function.

Why doesn’t the python program check the status of initialization or sensor update before continuing? From a quick glance, I am guessing my program stops somewhere in BrickPiSetupSensors function.

BrickPiSetupSensors tells the BrickPi which port to expect which sensor on . . . maybe I don’t understand the question?

I have exactly the same problem. The C demo programs does not pass the BricPiSetpSensors function, returns -1. I’ve bought a lot of BrickPi to be used for C-programming. What to do??

I am sort of a beginner so I don’t ask me why. I am not a big fan of wiringpi stuff.

I used i2c successfully on raspberry in the past using the instruction from

http://www.raspberry-projects.com/pi/programming-in-c/getting-your-raspberry-pi-ready-for-c-programming

This same library could be used for uart. I think brickpi will work with C programs if we use this library instead of wiringpi.

In order to do that brickpi header files and stuff has to be modified.

I don’t have patience or interest in robotics at the moment so I didn’t try this. Benn, since you have lot more brickpi’s you might want to give this a try and let me know if it works.

Does your python sample program work though? My python program works, so if yours doesn’t your problem might be little different.

Hey guys ! Still have the same problem…Python code is working but C code not…it’s return -1.

Did you find any solution ? i’m in trouble for my project ;(

Thank you guys !

We think we have a solution to the the BrickPi C code problem.

The way to make it work is to update the packages and the run the BrickPi setup script again. Also make sure that you have the latest C code too.

We have put together an install script that should help you with this. Here’s the link: https://github.com/DexterInd/BrickPi_C/tree/master/Scripts .

Download it and follow the Readme and the C code should work for you.

-Karan

Hello,
I have exactly the same issue: Python examples working perfectly but C examples don’t.

I tried to apply the debug script that you provided, but it did not change anything.

I have a few questions/remarks after reading closely what your script is doing, especially the install.sh script:

  • do I need to run it as root user ? Because your readme file does not ask to do so but then we get a (kind of hidden) log that tells to do otherwise (“Must be running as root user”). BTW, in the script, there are already lots of “sudo” when root permissions are needed, so maybe we don’t need to run the script as a root user ?

  • update of wiringPi does not work. The code in your script is the following:

#git clone git://git.drogon.net/wiringPi
#cd wiringPi
#./build
sudo unzip wiringPi.zip
cd wiringPi
sudo chmod 777 build
sudo ./build
cd ..
echo "wiringPi Installed"

I think something is wrong here, especially because the script never make us download “wiringPi.zip” in /tmp/ (where the install.sh script is executed). Maybe the commented part is what we should really do ?

  • It seems that your script makes us clone BrickPi_Scratch.git at the root of our file directory ("/"), which is not very clean IMHO.

Thank you for your anwsers. I am really looking forward to using my BrickPi, but if it does not work in C, it becomes a bit useless for me…

Thibault

Hi,
Please run the script as root and we have updated the changes that you had pointed out. The WiringPi is fetched for the BrickPi repository and then installed.

Let us know if this helps.

-Karan

I couldn’t figure out what is wrong with the brickpi image, so I started from scratch. And I managed to get it working with C programming. I downloaded standard image from raspi site and followed instruction from the brickpi site to make all the changes.

It asks to clone the github directory and go into “Setup Files” directory and run the script. The space in the name of the directory causes problem I think. I just renamed the directory to “SetupFiles” and the script ran smoothly.

@Karan
Thank you very much for the update, I’ve just tested it, everything works perfectly now for C programming.

Thanks for your reactivity !!
Merry Christmas !

Thibault

Hi. I have just bought my son a BrickPi Advanced Power for Christmas (from ActiveRobots). We have connected it up and run various tests. The LED tests work fine, but not the lego touch sensor or motors. We are using an early Pi model B and the latest install of Raspbian. Power is from both the Pi and an external 6xAA battery pack. The LED tests run fine with either or both power sources connected. Any ideas?

Thanks,

Phil and Alfie.

I am not familiar with the led test program because my brickpi doesn’t have LEDs on it. So I am not sure what part is and what part isn’t working for you.

Did you follow the instructions on getting started guide? It’s on brickPi website. BrickPi won’t work from get go if you have standard Raspbian. You have to modify few settings and such as the instruction says and run the script that karan talks about in this post.

@Phil and @Alfie,

mdhar brings up a good point. You should check out our post here: http://www.dexterindustries.com/BrickPi/getting-started/pi-prep/ about the sd-card and using the right image. We recommend downloading our own modified version.

Also, which language are you testing in? Have you run the tests on python? If you’re running it in C, you will have to make the upgrades outlined by Karan above first. It would be worth trying to run the python motor and touch sensor tests first to double check they’re working first.

Thanks for the response. We have run the setup.py install script and run the programs that import BrickPi without any errors, just no response from the sensors or drive to the motors.

I think that the LEDs work directly from the Raspberry Pi drivers, so without using any comms to the BrickPi.

We are using Python rather than C, so I didn’t think that I would need to run the wiringpi script above. Do we still need to do that?

Thanks again.

Phil.

Phil and Alphie,

THere are a few steps you have to take to modify your own image (ie not the Dexter Industries Raspbian for Robots image). These are outlined in that link (http://www.dexterindustries.com/BrickPi/getting-started/pi-prep/)

If you’re just starting out with the Pi, it’s much easier to download the Raspbian for Robots image (the second option on above links). Could you try doing this?