Hide thumbs Also See for RoboPi:
Table of Contents

Advertisement

Quick Links

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
1
2014-01-27

Advertisement

Table of Contents
loading

Summary of Contents for Raspberry Pi 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 2014-01-27...
  • Page 2: Table Of Contents

    Step 1: Get a compatible Class 10 speed SD card, 8GB – 32GB in size..........8 Step 2: Download the latest Raspbian image...................8 Step 3: Install Raspbian........................8 Step 4: Using the Raspberry Pi serial port with RoboPi..............9 Step 5: Installing RoboPiLib......................10 Step 6: Installing the RoboPi Firmware..................10 Step 7: Installing SimpleIDE for the Raspberry Pi (OPTIONAL)..........10...
  • Page 3 RoboPi v1.00 User Manual v0.85 Copyright 2014 William Henning Controlling a Continuous Rotation Servo...................20 Controlling a Standard Servo......................20 How to use PWM to control Gear Motors....................21 EN/A/B Three Wire Driver.........................21 A/B Two Wire interface........................22 EN/DIR/PWM Three Wire Driver.......................22 DIR/PWM Two Wire Driver.......................22 Why the ENABLE signal of three wire drivers is useful..............23...
  • Page 4: Introduction

    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 I/O and allow more precise timing than Linux running on the Pi allows.
  • Page 5: Robopi Printed Circuit Board

    The “PROPPLUG” connection is for stand-alone RoboPi operation (where RoboPi is NOT stacked on top of a Raspberry Pi. Pins 1-4 are the same as PropPlug (Pin 1 is GND), Pin 5 adds 3.3V for SerPlug. Plugging in a PropPlug while RoboPi is stacked on the Raspberry Pi may damage your Raspberry Pi, PropPlug and/or RoboPi.
  • Page 6: Robopi I/O Pin Definitions

    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 connector connected directly to processor pins, 3v3 I/O only •...
  • Page 7: Robopi Expansion Connectors

    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 your use •...
  • Page 8: Using Robopi With The Raspberry 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 use and control RoboPi with your Raspberry Pi. The Raspberry Pi Foundation has made this easy, by providing downloadable images of the Raspbian operating system, with instructions for using PC's, Mac's and Linux computers to make a bootable Raspbian SD card.
  • Page 9: Step 4: Using The Raspberry Pi Serial Port With Robopi

    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: Step 5: Installing Robopilib

    Step 7: Installing SimpleIDE for the Raspberry Pi (OPTIONAL) You only need to install SimpleIde if you want to write your own custom Propeller software for RoboPi on your Raspberry Pi, and do not wish to use the RoboPi firmware and RoboPiLib.
  • Page 11: 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, and was designed to be familiar to those coming to RoboPi from WiringPi, Arduino or Wiring environments.
  • Page 12 RoboPi v1.00 User Manual v0.85 Copyright 2014 William Henning http://Mikronauts.com 2014-01-27...
  • Page 13: Python Robolib Constants

    PWM output (0..255) SERVO pin mode for a servo output (0..2500) Python RoboPiLib Functions RoboPiInit(device, bps) use RoboPiInit(“/dev/ttyAMA0”,115200) RoboPiExit() close the serial connection with RoboPi readMode(pin) returns int returns INPUT/OUTPUT/SERVO/PWM pinMode(pin, mode) set pin to one of INPUT/OUTPUT/SERVO/PWM digitalRead(pin)
  • Page 14: C Robopilib Constants

    *bf, int ln) send a custom packet to RoboPi getPacket(char *c, char *bf, int *ln) receive response to custom packet sent to RoboPi In your program, include “RoboPiLib.h”, and add RoboPiLib.o to your command line as follows: gcc -o myprog myprog.c RoboPiLib.o...
  • Page 15: Using Robopi Without A Raspberry Pi (Stand Alone Operation)

    Parallax has written an excellent guide for installing SimpleIDE at: http://learn.parallax.com/propeller-c-set-simpleide Introducing RoboPiObj If you want to run RoboPi stand-alone (without a Raspberry Pi) you can still take advantage of the RoboPI API natively. RoboPiObj.spin is the top-level Spin object for implementing the functionality that is exposed by the firmware;...
  • Page 16: Robopiobj Constants

    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 pin mode for a PWM output (0..255) SERVO pin mode for a servo output (0..2500)
  • Page 17: How To Use Digital Inputs

    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. <insert schematic of two bumper switches, 100k pullup to 5v, shorts to ground when closed>...
  • Page 18: How To Use Digital Outputs

    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 <insert schematic of two LED's connected to EXP pins through 470R resistors>...
  • Page 19: How To Use Analog Inputs

    Reading SirMorph (short range distance / line sensor) SirMorph provides a standard 3-pin Sig/+/GND interface that can be plugged directly into any of the eight analog inputs on RoboPi. Use analogRead(ch) to read SirMorph sensors, and you will get a value between 0..1023 representing the amount of light reflected into the photo transistor.
  • Page 20: How To Use Servos

    RoboPi v1.00 User Manual v0.85 Copyright 2014 William Henning How to use Servos #include <stdio.h> #include "RoboPiLib.h" #define LEFT_SERVO #define RIGHT_SERVO #define SERVO_MIN #define SERVO_MAX 2500 #define SERVO_REV (SERVO_MIN+SERVO_MAX) int main(int argc, char *argv[]) { int i; RoboPiInit("/dev/ttyAMA0",115200); pinMode(LEFT_SERVO, SERVO);...
  • Page 21: How To Use Pwm To Control Gear Motors

    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 control.
  • Page 22: A/B Two Wire Interface

    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.
  • Page 23: Why The Enable Signal Of Three Wire Drivers Is Useful

    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 “off” period of the PWM signal –...
  • Page 24: Two Pin Motor Driver Sample Code

    RoboPi v1.00 User Manual v0.85 Copyright 2014 William Henning Two pin motor driver sample code #include <stdio.h> #include "RoboPiLib.h" #define MOTORA_IA #define MOTORA_IB #define MOTORB_IA #define MOTORB_IB int main(int argc, char *argv[]) { int i; RoboPiInit("/dev/ttyAMA0",115200); while(1) { // set both motors FORWARD pinMode(MOTORA_IA,PWM);...
  • 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(MOTORB_IA,0); pinMode(MOTORB_IB,PWM); for(i=0;i<256;i+=16) { analogWrite(MOTORA_IB, i); analogWrite(MOTORB_IB, i); sleep(1); for(i=255;i>0;i-=16) { analogWrite(MOTORA_IB, i); analogWrite(MOTORB_IB, i);...
  • Page 26: How To Read Analog Distance Sensors

    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.
  • Page 27: How To Read Digital Ultrasonic Range Sensors

    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: readDistance(int ch) RoboPiObj: readDistance(ch) will return the distance to the nearest object in millimeters.
  • Page 28: Stand-Alone Operation Requirements

    GND terminal of the external motor power screw terminal • If you will never mount your RoboPi on a Raspbery Pi, you could mount a two pin screw terminal on pins 2 (5V) & 6 (GND) for supplying 5V. Use a PropPlug to program your stand-alone RoboPi.
  • Page 29: Appendix A: Software

    For Raspberry Pi support, including Raspbian, please see the Raspberry Pi forums at: http://www.raspberrypi.org/forum/ For Parallax Propeller support, see the Parallax forum at: http://forums.parallax.com/forumdisplay.php/65-Propeller-1-Multicore-Microcontroller For RoboPi support, please visit the RoboPi thread in the Propeller forum at: http://forums.parallax.com/showthread.php/153275-Propeller-add-on-for-Raspberry-Pi-RoboPi..-the- most-advanced-robot-controller-for-Pi or the new Mikronauts forums: http://forums.mikronauts.com...
  • Page 30: Appendix D: Roboprop Software Compatibility

    • use 24LC512 EEPROM • use MCP3208 • While there is no motor driver on RoboPi, if you connect a two channel motor controller as follows it will be RoboProp compatible: Tie EN1-2 and EN3-4 high • P8 to IN1 •...
  • Page 31: Appendix E: Frequently Asked Questions

    Q: Can we make our own RoboPi printed circuit boards? A: I am afraid not. While RoboPi is an open platform in that it is fully documented, with source code available for its libraries and demo applications, RoboPi is a commercial product, and may not be copied.

Table of Contents