Problems connecting

one correction about the question I was asking about the powering the Pi, I mean to say the Micro USB not the Micro SD Card.

This is what I did.

Change /etc/network/interfaces file to

allow-hotplug eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.222
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1

Thanks milind.

milind,
I was able to power up the BrickPi through the micro usb cable and ran the sample python program. As far as java jdk goes, I think there is space issue since I am getting the out of space issue. There are about 7% space left if you do “dk -k”. I am looking into the possibility of expand the space.

Thanks,

That’s right. I ran into that as well. When you install Raspbian, you get an initial screen which allows you to expand and use all available space. I did that, but after installing Java, I had lost my network connectivity on the RPi. I don’t know how, so I was starting over again. I just haven’t had a chance to play with it since. I’m a Windows & Java guy so every action for me starts at google.com :slight_smile: Please let me know what the commands would be to expand space. Since I have plenty of space with a 32GB SD card.

BTW, out of curiosity, what SD card are you using?

I am using ADATA 16GB class 10 SD Card. One thing I am not sure is that whether I can expand this SD card which it is used for BrickPi image?

For sharing internet connection, if you have Mac laptop, it will be very easy to setup the share connection. You can take look at the following URL to see how to get it to work.

Actually it turns out the expansion of space was very easy. You can run the sudo raspi-config command and used the first option. You can use the following link as reference:

And I had successfully installed JDK 1.7.

I ended up modifying the Raspbian image I had. The instructions in the Getting Started page turned out to be not that daunting after all.

BTW, there is a typo on the 9th point for the “Configuring the 5th Sensor” section. “pyton” should be "python"
So the line should have read
sudo apt-get install python-smbus

However, I was unable to get any of the python examples working so am not sure if I did get it all right.

kool, what sample Python program did you run?

If I run
sudo python setup.py install
I get the following error
Traceback (most recent call last):
File “setup.py”, line 6, in <module>
import setuptools
ImportError: No module named setuptools

If I copy BrickPi into the “BrickPi_Python/Sensor Examples” directory and run
sudo python DI-dCompass_Test.py
I get the error
File “DI-dCompass_Test.py”, line 26
SyntaxError: Non-ASCII character ‘xe2’ in file DI-dCompass_Test.py on line 26, but no encoding declared;
see http://www.python.org/peps/pep-0263.html for details

Yes. I did that and it was a big mistake. I expanded to the full 32GB SD card.

I backed up the image following the instructions at

(Highly recommended BTW after making changes).

The problem is the image is now 32GB. I can shrink it down to 500GB using 7Zip. But it takes 30 minutes just to zip it using normal compression and even longer using ultra compression. I’m going to have to google on how to shrink the partition and re-clone it.

The first program setup.py started working after I installed and setup the Scratch samples. Probably Step 2 which sets up Python.

The second file DI-dCompass_Test.py I fixed by adding

coding=utf-8

on the first line

kool, if you don’t have to do that then, perhaps the coding is set up to default to utf-8 in your BrickPi image.

The program itself just runs and exits since I don’t have any sensors.

Edit: I ran LED.py and that worked. Both the LEDs start flashing blue. So I guess my setup is working now. Awesome!

Based on what you said and you had to change multiple places in order to get the code to work, I would suggest you to start from scratch again such as getting a new SD card since you never know what it will happen next if you continue going down this route.

BTW, I was working on converting the C code to JAVA in the last few days and I was able to make a progress to get it to work by using a library called Pi4J open source program. This program is using JNI to wrap around the wiringpi c program. I was able to recompile the Pi4J library to use the modified wiringpi C program from Dexterindustries for BrickPi and converted the C code to Java. Currently the code base is still very unorganized, I will try to find more time to clean up the code.

Heck No!! :slight_smile: I have invested so much time into crafting my own image :-)Actually, it’s been a good experience and I think it’s working well now. I was able to get the LED tests working with Scratch and Python.

I also set up the Java environment using Pi4J and I got the LED examples working from Java. Pi4J is really neat. I haven’t looked at the C programs in wiringpi. Are they different from the ones in the Pi4J examples?

I need to get some sensors now and start using the BrickPi.

What’s your environment like? I got it down to being pretty productive right now. I have Eclipse running on my Windows box with the class files being written directly to a shared folder on the Pi. So I get the compile-build on Windows and I execute on the Pi.

Sharing a folder from RPi
http://raspberrywebserver.com/serveradmin/share-your-raspberry-pis-files-and-folders-across-a-network.html

I assign a drive letter to the shared folder and use that as the output folder for the class files on Eclipse in Windows (Source tab in the Java Build Path of the project). I wanted to change the directory and couldn’t find where the reference was stored. Turned out to be in the project’s .project file. Not obvious and I spent some time discovering this.
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-45.htm

I use XMing Xserver on my Windows box to use the file explorer and text editor from my PC. Putty for SSHing to the RPi with X11 forwarding enabled in the configuration (Connection->SSH->X11->Enable X11 forwarding). I find that better and faster than VNC, although I use that as well.
http://www.straightrunning.com/XmingNotes/

Basically, the outputting of the class files directly on the RPi drastically increases productivity compared to building it on Windows and transferring it to RPi and executing it there. A save in Eclipse and the class file is already on the RPi.

Sounds like you have everything ready and fully charged :slight_smile:

I am also using eclipse but on Mac to stay away from windows since I am using it at work :-). I will look into how to share the folder with Mac since I currently have to ftp the file over the Pi and then ssh over the Pi through Mac Terminal and run the java program.

The Pi4J library won’t work for the serial port with baud rate of 500000 since this is how the BrickPi is using to communicate with the sensor and motor. At least this is how I understand. Let me know when you have the sensor and motor and if you want I can email you the custom driver.

Hey guys, sorry to hop in late on this one: to get the setup.py to work, you need to first install setuptools. apt-get install python-setuptools

I made a change to the python repo on github, as well as our programming guide. Thanks for pointing this out!

Hi kool,

I have just started trying to get the EV3 version of leJOS to work with BrickPi. I converted some of the BrickPi C to Java and tried using librxtx for the serial comms, but I don’t think this will work at the 500000 baud rate, so I started looking at pi4j. I realized that I needed to recompile it to use the modified wiringPi implementation and looked to see if anyone else had done this and found your post. Is your stuff in a repository? Do you have the rebuild version of libpi4j.so available?

I too am using Eclipse, but use an ant built file to build a runnable jar file and copy it with an scp task to the RPi. This is the same method that I use for the LEGO Mindstorms EV3 and works well.

Lawrie Griffiths

Lawrie,
Sorry for the late reply, just came back from vacation. Had you figured out yet, if not, I will send you the libpi4j library.

Kool

Hi Kool,

I stopped working on the BrickPi for a while as I am busy working on leJOS
on the Mindstorms EV3, and I am building a 3D printer. But I want to get
back to the BrickPi, so your libpi4j library would be useful to me.

Lawrie

hi

i have been trying to connect to my raspberry pi 2 but i cannot connect whatsoever.i am using the gopigo stuff from dexter industries, my SD card says 2015.03.02 on it,i have a gopigo 2 and i am using a macbook pro air. as well as this the ether-net port(on the back) green light blinks some times and the orange light stays still. i believe that the pi is booting up properly.

plz plz help many thx.

can i also add that i have reimaged my sd card and that i followed the dexter industries instructions.
thx

Hi jujujegjeg,
It looks like the image that you are using is pretty old (The latest image right now has a date of 2016.06.26). It might be better to upgrade it and install a newer image following the instructions here: https://www.google.com/#q=installing+a+SD+card+dexter+industries. There have been a lot of improvements with the latest image in terms of performance and fetaures that have been added and it would be easier to use too.

Do let us know if this helps.

-Karan