Raspberry Pi RoboPi User Manual

Other manuals for RoboPi: User Manual

Summary of RoboPi

  • Page 1

    Robopi v1.00 user manual v0.85 copyright 2014 william henning using robopi copyright 2014 william henning robopi user manual v0.85 photo 1: fully assembled robopi v1.00 the most up to date documentation will always be available at: http://www.Mikronauts.Com/raspberry-pi/robopi/ http://mikronauts.Com...

  • Page 2: Table Of Contents

    Robopi v1.00 user manual v0.85 copyright 2014 william henning table of contents introduction................................................................................................................................................4 robopi printed circuit board.....................................

  • Page 3

    Robopi v1.00 user manual v0.85 copyright 2014 william henning controlling a continuous rotation servo...........................................................................................20 controlling a standard servo................................................................................

  • Page 4: Introduction

    Robopi v1.00 user manual v0.85 copyright 2014 william henning introduction robopi is the most advanced robot controller add-on board for the raspberry pi available at this time. Robopi adds an eight-core 32-bit microcontroller running at 100mhz to the raspberry pi in order to off-load hard real time...

  • Page 5

    Robopi v1.00 user manual v0.85 copyright 2014 william henning robopi printed circuit board here is a top view of where parts are located on the robopi printed circuit board: you can refer to this image while wiring your robot after assembling your robopi. Please note the “propplug” connection is for...

  • Page 6

    Robopi v1.00 user manual v0.85 copyright 2014 william henning robopi i/o pin definitions before you can write programs for your robopi based robot, you have to learn what resources are available for you to connect to sensors, motors and other devices or boards. P0-p7: servo 1 – servo 8 • 10 pin exp1...

  • Page 7

    Robopi v1.00 user manual v0.85 copyright 2014 william henning robopi expansion connectors raspberry pi i/o header pins • robopi requires exclusive use of rx/tx • robopi makes the raspberry pi i2c available on a mikronauts four-pin 3v3 i2c header • all other raspberry pi i/o pins are available for yo...

  • Page 8

    Robopi v1.00 user manual v0.85 copyright 2014 william henning using robopi with the raspberry pi downloading & installing raspbian (debian for the pi) if you already have raspbian running on your raspberry pi, you can skip to step 4 installing raspbian on your raspberry pi is required before you can...

  • Page 9

    Robopi v1.00 user manual v0.85 copyright 2014 william henning step 4: using the raspberry pi serial port with robopi the raspberry pi has 3.3v serial rx and tx signals available on its 26 pin header. Normally this port is configured to display boot messages, after which it becomes a serial console. ...

  • Page 10

    Robopi v1.00 user manual v0.85 copyright 2014 william henning step 5: installing robopilib download the latest version of robopilib.Zip from the robopi product page at: http://www.Mikronauts.Com/raspberry-pi/robopi/ step 6: installing the robopi firmware download the latest version of robopiobj.Zip ...

  • Page 11: Introducing Robopilib

    Robopi v1.00 user manual v0.85 copyright 2014 william henning introducing robopilib robopilib is a library designed to interface the raspberry pi with the robopi firmware. Robopilib was designed to make it easy to write programs on the raspberry pi that use all of the firmware features of robopi, an...

  • Page 12

    Robopi v1.00 user manual v0.85 copyright 2014 william henning http://mikronauts.Com 12 2014-01-27.

  • Page 13

    Robopi v1.00 user manual v0.85 copyright 2014 william henning python robolib constants digital pins can be configured for one of the following four modes: input pin mode for a digital input output pin mode for a digital output pwm pin mode for a pwm output (0..255) servo pin mode for a servo output ...

  • Page 14

    Robopi v1.00 user manual v0.85 copyright 2014 william henning c robopilib constants digital pins can be configured for one of the following four modes: input pin mode for a digital input output pin mode for a digital output pwm pin mode for a pwm output (0..255) servo pin mode for a servo output (0....

  • Page 15

    Robopi v1.00 user manual v0.85 copyright 2014 william henning using robopi without a raspberry pi (stand alone operation) installing simpleide on pc/mac/linux for stand-alone robopi use parallax has written an excellent guide for installing simpleide at: http://learn.Parallax.Com/propeller-c-set-sim...

  • Page 16

    Robopi v1.00 user manual v0.85 copyright 2014 william henning robopiobj constants input pin mode for a digital input output pin mode for a digital output pwm pin mode for a pwm output (0..255) servo pin mode for a servo output (0..2500) robopiobj methods start initialize robopiobj, start service cog...

  • Page 17

    Robopi v1.00 user manual v0.85 copyright 2014 william henning how to use digital inputs reading bumper switches probably the simplest digital input possible is a switch. #include #include “robopilib.H” #define left_bumper 22 #define right_bumper 23 #define pressed 0 int main(int argc, char *argv[]) ...

  • Page 18

    Robopi v1.00 user manual v0.85 copyright 2014 william henning how to use digital outputs the simplest way of demonstrating a digital output is to use it to light an led. Using led's to show which bumper is pressed #include #include “robopilib.H” #define left_bumper 22 #define right_bumper 23 #define...

  • Page 19: How To Use Analog Inputs

    Robopi v1.00 user manual v0.85 copyright 2014 william henning how to use analog inputs reading a potentiometer probably the simplest analog input possible is a potentiometer. #include #include “robopilib.H” #define pot 0 int main(int argc, char *argv[]) { robopiinit(“/dev/ttyama0”,115200); while (1)...

  • Page 20: How To Use Servos

    Robopi v1.00 user manual v0.85 copyright 2014 william henning how to use servos #include #include "robopilib.H" #define left_servo 0 #define right_servo 1 #define servo_min 500 #define servo_max 2500 #define servo_rev (servo_min+servo_max) int main(int argc, char *argv[]) { int i; robopiinit("/dev/t...

  • Page 21

    Robopi v1.00 user manual v0.85 copyright 2014 william henning how to use pwm to control gear motors standard motor drivers normally are controlled by two or three digital signals per motor. En/a/b three wire driver the popular l293d and l298 motor drivers are often configured for en/a/b three wire c...

  • Page 22

    Robopi v1.00 user manual v0.85 copyright 2014 william henning a/b two wire interface for two wire drivers, use digitalwrite() to set the direction you are not going in to 0, then use analogwrite() to control the motor speed using pulse width modulation for the direction you want the motor to turn. P...

  • Page 23

    Robopi v1.00 user manual v0.85 copyright 2014 william henning why the enable signal of three wire drivers is useful most motor drivers will actively break the motor if the a and b inputs are at the same level. When pwm speed control is used, both inputs are guaranteed to be driven low during the “of...

  • Page 24

    Robopi v1.00 user manual v0.85 copyright 2014 william henning two pin motor driver sample code #include #include "robopilib.H" #define motora_ia 12 #define motora_ib 13 #define motorb_ia 14 #define motorb_ib 15 int main(int argc, char *argv[]) { int i; robopiinit("/dev/ttyama0",115200); while(1) { /...

  • Page 25

    Robopi v1.00 user manual v0.85 copyright 2014 william henning for(i=255;i>0;i-=16) { analogwrite(motora_ia, i); analogwrite(motorb_ia, i); sleep(1); } // set both motors reverse pinmode(motora_ia,output); digitalwrite(motora_ia,0); pinmode(motora_ib,pwm); pinmode(motorb_ia,output); digitalwrite(moto...

  • Page 26

    Robopi v1.00 user manual v0.85 copyright 2014 william henning how to read analog distance sensors the sharp gp2y0a02yk0f is an excellent infrared distance sensor that uses a 5v supply and typically draws only 33ma and can present a new reading every 50ms. You can find the data sheet at: http://www.S...

  • Page 27

    Robopi v1.00 user manual v0.85 copyright 2014 william henning how to read digital ultrasonic range sensors the robopi firmware implements preliminary support ultrasonic range sensors. All supported ultrasonic distance sensors will use a generic interface robopilib: int readdistance(int ch) robopiobj...

  • Page 28

    Robopi v1.00 user manual v0.85 copyright 2014 william henning stand-alone operation requirements supply 5v to robopi via one of: • pins 2 & 4 of the 2x13 pin pi header • “pi5v” terminal of power selection header sv2 or sv3 supply gnd to robopi via one of: • pins 9 & 14 of the pi header • gnd termina...

  • Page 29: Appendix A: Software

    Robopi v1.00 user manual v0.85 copyright 2014 william henning appendix a: software • raspbian wheezy or later • simpleide 0.8.4 or later • propeller-load3 or later • robopi api v1.0 or later • robopilib v1.0 or later appendix b: data sheets http://www.Parallax.Com/sites/default/files/downloads/p8x32...

  • Page 30

    Robopi v1.00 user manual v0.85 copyright 2014 william henning appendix d: roboprop software compatibility: • use the supplied 6.250mhz crystal for 100mhz operation • use 24lc512 eeprom • use mcp3208 while there is no motor driver on robopi, if you connect a two channel motor controller as follows it...

  • Page 31

    Robopi v1.00 user manual v0.85 copyright 2014 william henning appendix e: frequently asked questions q: where can we buy robopi? A: currently you can buy robopi: directly from us – please email us at mikronauts@gmail.Com with desired quantity and postal address, we will be happy to send you a quote....