Git Product home page Git Product logo

brickpi's Introduction

BrickPi

This project combines the brains of a Raspberry Pi with the brawn of a LEGO MINDSTORMS NXT. Read more about it here: http://www.dexterindustries.com/BrickPi

These files have been made available online through a Creative Commons Attribution-ShareAlike 3.0 license.

Compatibility

This repository is for the BrickPi and BrickPi+. For the BrickPi3 (hardware version 3.x.x) see the BrickPi3 repository.

Getting Started

We've devoted some serious time to trying to make sure that it's easy to get started. If you're lost, we would like to first direct you to our website for the BrickPi.

Quick Install

In order to quick install the BrickPi repository, open up a terminal and type the following command:

curl -kL dexterindustries.com/update_brickpi_plus | bash

The same command can be used for updating the BrickPi to the latest version.

This Repository

This repository holds firmware and hardware designs, as well as software examples for Python, C, and Scratch.

Image for the SD Card

Our custom image for the Raspberry Pi makes using the BrickPi easy. We've modified the standard Raspbian a little bit. You can download the latest image here on our getting started section.

Firmware

The board firmware is made in Arduino in order to make it super-hackable. The firmware is written in Arduino 1.0 and can be uploaded via an ISP programmer. It can also be uploaded with an Arduino Uno, with an adapter explained in this repository.

The board supports LEGO NXT motors, EV3 motors, and LEGO NXT sensors, as well as many of Dexter Industries sensors for LEGO Mindstorms.

Dexter Industries BrickPi for the Raspberry Pi

brickpi's People

Contributors

cleoqc avatar dlech avatar f4814 avatar graykevinb avatar jaikrishnats avatar karan259 avatar rafiyagi avatar robertlucian avatar shoban94 avatar sitfit avatar woolfel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brickpi's Issues

Fix for ReadAnalog() values coming out of order after calling SetMotor() in BrickPi2.py

When Python starts on the raspberry pi it sends a character '\xf8' to the buffer. This causes inputString[0] to be that character instead of the character corresponding to the correct case of the switch in parse_string_data(). this can be handled by putting a case statement at the beginning of parse_string_data to determine if the "startup character" has been sent. i put the code i used below:

if(inputString[0]=='\xf8') {
for(int i=1; i< inputString.length(); i++) {
firstRun+= inputString[i];
}
inputString= firstRun;
firstRun="";
}

gpio package dependency missing

while others are apt'ed these packages seem to be missing:

Dependencies installed
Installing WiringPi

/home/pi/Dexter/lib/Dexter/script_tools/update_wiringpi.sh: line 11: gpio: command not found
wiringPi VERSION is
/home/pi/Dexter/lib/Dexter/script_tools/update_wiringpi.sh: line 30: [: -eq: unary operator expected
Did NOT find WiringPi Version 2.36

Also missing in order to use the GrovePi repo: python-numpy

Incorrect rotational speed with EV3 Gyro

The mode TYPE_SENSOR_EV3_GYRO_M1 doesn't give the rotational speed, it instead reads out the angle same as TYPE_SENSOR_EV3_GYRO_M0. In fact, I tried all the modes and none of it give the rotational speed.

# TYPE_SENSOR_EV3_GYRO_M1 - Rotational Speed

The same query is posted in the forum too.
https://forum.dexterindustries.com/t/how-to-read-the-rate-of-rotation-using-ev3-dev-gyro-sensor/6832

Run according to readme get error

Clone git and follow webpage's instructions:

$ python RPi_Server_Code.py Traceback (most recent call last): File "RPi_Server_Code.py", line 38, in <module> from BrickPi import * #import BrickPi.py file to use BrickPi operations ImportError: No module named BrickPi

Compile BrickPiFW_Compressed_Communication.ino get error.

I tried to compile BrickPi/Firmware_BrickPi/Firmware_2.0/BrickPiFW_Compressed_Communication/BrickPiFW_Compressed_Communication.ino, but always get below error messages:

BrickPiEV3/BrickPiEV3.cpp.o: In function EV3_Setup_Touch(unsigned char)': /Users/timesong/Documents/Arduino/libraries/BrickPiEV3/BrickPiEV3.cpp:246: multiple definition ofnxt_debounce'
BrickPiA/BrickPiA.cpp.o:/Users/timesong/Documents/Arduino/libraries/BrickPiA/BrickPiA.cpp:33: first defined here

Is this a issue?

support the Ultrasonic sensor

The current README states that the Ultrasonic sensor is not supported.
The Ultrasonic sensor is really cool, please add when you get the time.

Improve firmware flashing?

Not really a request for an enhancement, more a discussion starter.

I think this should be fairly easy and work well.

If you put a serial bootloader on the atmel processors on the board and put two reset switches connected to a Pi pin a (very slightly) modified version of avrdude should be able to start, wait until the Pi pin is high and so one of the atmels has reset and then download new firmware over the serial link.

Might need to be a little cleverer, like hold the other Atmel in reset while you flash the other one, but I doubt it. Might also be possible to reset both chips and flash both at the same time (but I think that would be much more complex).

Timing issues with EV3 UART sensors.

I've notice that the EV3 UART sensors return an error value quite often instead of the sensor value. Usually, the value is -2, and sometimes -4. I can see these are error values returned by the EV3_Update function. I stuck my logic analyzer on it and immediately saw the problem.

Normally, the timing works like this...

selection_012

  1. The RPi polls the BrickPi by executing the BrickPiUpdateValues function.
  2. The BrickPi sends a keep-alive (called NAK in the code) to the UART sensor.
  3. The UART sensor sends back data in response to keep-alive.
  4. The BrickPi sends the data back to the RPi.

However, quite often, this happens...

selection_013

  1. The RPi polls the BrickPi by executing the BrickPiUpdateValues function.
  2. The BrickPi sends a keep-alive (called NAK in the code) to the UART sensor.
  3. (This happens after 4, which is too late.) The UART sensor sends back data in response to keep-alive.
  4. The BrickPi sends the data back an error because there was not data to be read.

It seems that this happens most often when data value is changing rapidly. A couple of easy fixes would be to A) wait a bit longer for the UART sensor to respond before sending an error or B) send the previous value received.


I've worked around this for now by filtering out the error values, but it makes the sensor unresponsive for noticeable periods of time, which does not make for good robot building. Also, some of the sensors can return negative values in certain modes, so I also have to filter out possibly good data in those modes, which is not nice.

What's the correct instruction to update my compiled firmware?

I updated the firmware as follow steps.

  1. Compiled BrickPi/Firmware_BrickPi/Firmware_2.0/BrickPiFW_Compressed_Communication/BrickPiFW_Compressed_Communication.ino to get BrickPiFW_Compressed_Communication.cpp.hex.
  2. Copied hex file to BrickPi/Firmware_BrickPi/Updating_the_Firmware/Firmware_2.0_Loading_Package/ to replace original file.
  3. Execute Arduino-upload1.sh and Arduino-upload2.sh to update firmware until two ICs were updated successfully.

Then, I assembled BrickPi to raspberry-pi and test EV3-Touch.py, I can't get any response because BrickPiSetupSensors returned -1. also I tracked the brickpi.py, in line 436, the "res" value is -2ใ€‚

However when I use the original Firmware_2.0_Loading_Package/BrickPiFW_Compressed_Communication.cpp.hex, all sample code working fine.

Maybe I did some mistake in above steps, but is there a way to resolve this issue?

Some Firmware Edits

When testing out the BrickPi i ran into two issues:

  1. whenever i called readAnalog after calling SetMotor the values came in out of order.
  2. nothing happened the first time i called setMotor or ReadAnalog

to fix 1: in firmware_2_0 the first line of the function parse_string_data() is: Serial.print(inputString[0]). every time something is sent from python to arduino it then sends back a character which is then left on the buffer to be read by the next (unsuspecting) function. delete that line.

to fix 2: when python starts on the raspberry pi it sends a character '\xf8' to the buffer. This causes inputString[0](in firmware_2_0) to be that character instead of the character corresponding to the correct case of the switch in parse_string_data(). this can be handled by putting a case statement at the beginning of parse_string_data to determine if the startup character has been sent. i put the code i used below:

if(inputString[0]=='\xf8') {
for(int i=1; i< inputString.length(); i++) {
firstRun+= inputString[i];
}
inputString= firstRun;
firstRun="";
}

A few other small changes i made:

  1. I changed the i changed the python motor function to be of the form: SetMotor(motor_number, motor_speed) in both the firmware and python library.
  2. I added a case 9 to parse_string_data to handle the python function SetAllMotors(motor_speed) i created to set all the motors to one value.
  3. i changed the python ReadAnalog() function to take in a port number and return the int value of the sensor in that port.

I can send you my edited versions of the firmware and BrickPi2.py if you'd like to take a look.

CLOSING THIS ISSUE AND OPENING UP INDIVIDUAL ISSUES FOR EACH PART. New issues can be found at:
#6 (Fix for ReadAnalog() values coming out of order after calling SetMotor() in BrickPi2.py)
#5 (Fix for nothing happening the first time ReadAnalog() or SetMotor() are called in BrickPi2.py)

What is the right layout to connect sensor & motors

Good morning,

I am doing some tests with Brickpi+ for the project:
https://github.com/ev3dev-lang-java/ev3dev-lang-java

and I am not sure what is the best way to connect sensors & motors for brickpi v2.8:

img

In the documentation on the website appear other layout:
http://www.dexterindustries.com/BrickPi/getting-started/attaching-lego/

img

with 5 sensors, but in my board in the position of the 5th sensor, I have the energy connector.
Following other images, I notice that the first row of RJ45 input is for motors and the rest of the connectors is for sensors, isn't it?

Juan Antonio

Message format?

I am trying to build a language interface for a different language than C, Python or Scratch (Erlang to bed precise) but I find it quite hard to re-engineer the way you have coded the messages. In the end I think I will succeed, but the code submitted here is not very helpful. Is there any documentation about the message format the UART expects?

Need Firmware Level Servo Targeting

BrickPi needs firmware level servo targeting to be able to accurately move motors to position.

Then:

  • Add to BrickPi Python
  • Add to BrickPi C

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.