PaperBots Robotics Kit

This page is under construction

The PaperBots Robotics Kit contains:

  • 1 PaperBots Robotics Module
  • 1 Motor w/ alligator clip points
  • 1 light sensor w/ alligator clip points
  • 5 alligator test leads

The PaperBots Robot Module is a relatively inexpensive “brain” for your PaperBots creations. (Price to be determined once I’m no longer making them from scratch but the small batch prototypes are still under $50 a piece)

It runs off a Teensy powered by Arduino programing. To get started, download the following:

A simple graphical interface for programming is being developed for Google code, Scratch and Modkit. More information will be added as this is developed.

For now, here are some Arduino codes that can be loaded onto your PaperBots Module.
Click in the box and select the code. Cut and paste it into the Arduino Environment.

[textbox rows=”3″]// PaperBots Sample Code – 2012-10-26
// Light Sensor Analog Input
// Motor Switches ON in Dark
const int ledPin = 11;   // Teensy has LED on 11, Teensy++ on 6// Assign Button Input Pins
const int St = 5;

// Assign Digital Input Pins
const int D1 = 7;
const int D2 = 8;

// Assign Analog Input Pins
const int light = 5;

// Assign motor pins
//int motor[] = {1,2};

// Variables for the program loop
// Assign Motor Control Variables
const int m1 = 1;
const int m2 = 2;

int val1 = LOW;
int val2 = LOW;

int val;

int go = 1;

void setup(){
Serial.begin(38400);
pinMode(ledPin, OUTPUT);

// Setup Motor
pinMode(m1, OUTPUT);
pinMode(m2, OUTPUT);

// Setup Button Inputs
pinMode(St, INPUT);

// Setup Digital Inputs
pinMode(D1, INPUT_PULLUP);
pinMode(D2, INPUT_PULLUP);

// Setup Analog Inputs
pinMode(light, INPUT);
}

// Base functions for motor on, off, forward, backward, All stop
void Forward()
{
val1 = LOW;
val2 = HIGH;
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Reverse()
{
val1 = HIGH;
val2 = LOW;
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Stall()
{
val1 = LOW;
val2 = LOW;
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Star()
{
go = 0;
setup();
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Stop()
{
go = 1;
val1 = LOW;
val2 = LOW;
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void loop(){

digitalWrite(m1, val1);
digitalWrite(m2, val2);

Serial.println(go);

// Take a reading from the light sensor at the beginning of every loop
val = analogRead(light);
Serial.print(“analog 5 is: “);
Serial.println(val);

if (go == 0){
if (digitalRead(St) == HIGH){
Serial.println(“Stop”);
Stop();
}
else if (val > 500){
if (val2 == HIGH){
delay(250);
}
else{
Serial.println(“Forward”);
Forward();
}
}
else if (val < 500){
if (val2 == LOW){
delay(250);
}
else{
Serial.println(“Stall”);
Stall();
}
}
}
else {
if (digitalRead(St) == HIGH){
Serial.println(“Start”);
Star();
}
else{

delay(250);
}
}
}
[/textbox]

[textbox rows=”3″]// PaperBots Sample Code – 2012-10-26
// Light Sensor Analog Input
// Motor Switches OFF in Darkconst int ledPin = 11;   // Teensy has LED on 11

// Assign Button Input Pins
const int St = 5;

// Assign Digital Input Pins
const int D1 = 7;
const int D2 = 8;

// Assign Analog Input Pins
const int light = 5;

// Assign motor pins
//int motor[] = {1,2};

// Variables for the program loop
// Assign Motor Control Variables
const int m1 = 1;
const int m2 = 2;

int val1 = LOW;
int val2 = LOW;

int val;

int go = 1;

void setup(){
Serial.begin(38400);
pinMode(ledPin, OUTPUT);

// Setup Motor
pinMode(m1, OUTPUT);
pinMode(m2, OUTPUT);

// Setup Button Inputs
pinMode(St, INPUT);

// Setup Digital Inputs
pinMode(D1, INPUT_PULLUP);
pinMode(D2, INPUT_PULLUP);

// Setup Analog Inputs
pinMode(light, INPUT);
}

// Base functions for motor on, off, forward, backward, All stop
void Forward()
{
val1 = LOW;
val2 = HIGH;
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Reverse()
{
val1 = HIGH;
val2 = LOW;
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Stall()
{
val1 = LOW;
val2 = LOW;
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Star()
{
go = 0;
setup();
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Stop()
{
go = 1;
val1 = LOW;
val2 = LOW;
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void loop(){

digitalWrite(m1, val1);
digitalWrite(m2, val2);

Serial.println(go);

// Take a reading from the light sensor at the beginning of every loop
val = analogRead(light);
Serial.print(“analog 5 is: “);
Serial.println(val);

if (go == 0){
if (digitalRead(St) == HIGH){
Serial.println(“Stop”);
Stop();
}
else if (val < 500){
if (val2 == HIGH){
delay(250);
}
else{
Serial.println(“Forward”);
Forward();
}
}
else if (val > 500){
if (val2 == LOW){
delay(250);
}
else{
Serial.println(“Stall”);
Stall();
}
}
}
else {
if (digitalRead(St) == HIGH){
Serial.println(“Start”);
Star();
}
else{

delay(250);
}
}
}
[/textbox]

[textbox rows=”3″]// PaperBots Sample Code – 2012-10-26
// Digital Inputs
// Motor Switches ON or OFFconst int ledPin = 11;   // Teensy has LED on 11

// Assign Button Input Pins
const int St = 5;
const int Sp = 6;

// Assign Digital Input Pins
const int D1 = 7;
const int D2 = 8;

// Assign Analog Input Pins
const int light = A6;

// Assign motor pins
//int motor[] = {1,2};

// Variables for the program loop
// Assign Motor Control Variables
const int m1 = 1;
const int m2 = 2;

int val1 = LOW;
int val2 = LOW;

int go = 1;

void setup(){
Serial.begin(38400);
pinMode(ledPin, OUTPUT);

// Setup Motor
//int i;
//for(i = 0; i<2; i++){
//pinMode(motor[i], OUTPUT);
//}
pinMode(m1, OUTPUT);
pinMode(m2, OUTPUT);

// Setup Button Inputs
pinMode(St, INPUT);
pinMode(Sp, INPUT);

// Setup Digital Inputs
pinMode(D1, INPUT_PULLUP);
pinMode(D2, INPUT_PULLUP);

// Setup Analog Inputs
pinMode(light, INPUT);
}

void Forward()
{
val1 = LOW;
val2 = HIGH;
Serial.println(“Forward”);
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Reverse()
{
val1 = HIGH;
val2 = LOW;
Serial.println(“Reverse”);
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Stall()
{
val1 = LOW;
val2 = LOW;
Serial.println(“Stall”);
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Star()
{
go = 0;
setup();
Serial.println(“Start”);
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Stop()
{
go = 1;
val1 = LOW;
val2 = LOW;
Serial.println(“Stop”);
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void loop(){

digitalWrite(m1, val1);
digitalWrite(m2, val2);

Serial.println(go);

if (go == 0){
if (digitalRead(St) == HIGH){
Stop();
}
else if (digitalRead(D1) == LOW){
Forward();
}
else if (digitalRead(D2) == LOW){
Stall();
}
}
else {
if (digitalRead(St) == HIGH){
Star();
}
else{

delay(250);
}
}
}
[/textbox]

[textbox rows=”3″]// PaperBots Sample Code – 2012-10-26
// Digital Inputs
// Motor Switches Directionconst int ledPin = 11;   // Teensy has LED on 11

// Assign Button Input Pins
const int St = 5;
const int Sp = 6;

// Assign Digital Input Pins
const int D1 = 7;
const int D2 = 8;

// Assign Analog Input Pins
const int light = A6;

// Assign motor pins
//int motor[] = {1,2};

// Variables for the program loop
// Assign Motor Control Variables
const int m1 = 1;
const int m2 = 2;

int val1 = LOW;
int val2 = LOW;

int go = 1;

void setup(){
Serial.begin(38400);
pinMode(ledPin, OUTPUT);

// Setup Motor
//int i;
//for(i = 0; i<2; i++){
//pinMode(motor[i], OUTPUT);
//}
pinMode(m1, OUTPUT);
pinMode(m2, OUTPUT);

// Setup Button Inputs
pinMode(St, INPUT);
pinMode(Sp, INPUT);

// Setup Digital Inputs
pinMode(D1, INPUT_PULLUP);
pinMode(D2, INPUT_PULLUP);

// Setup Analog Inputs
pinMode(light, INPUT);
}

void Forward()
{
val1 = LOW;
val2 = HIGH;
Serial.println(“Forward”);
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Reverse()
{
val1 = HIGH;
val2 = LOW;
Serial.println(“Reverse”);
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Stall()
{
val1 = LOW;
val2 = LOW;
Serial.println(“Stall”);
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Star()
{
go = 0;
setup();
Serial.println(“Start”);
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void Stop()
{
go = 1;
val1 = LOW;
val2 = LOW;
Serial.println(“Stop”);
digitalWrite(ledPin, HIGH);   // set the LED on
delay(250);                   // wait for a second
digitalWrite(ledPin, LOW);    // set the LED off
delay(250);                   // wait for a second
}

void loop(){

digitalWrite(m1, val1);
digitalWrite(m2, val2);

Serial.println(go);

if (go == 0){
if (digitalRead(St) == HIGH){
Stop();
}
else if (digitalRead(D1) == LOW){
Forward();
}
else if (digitalRead(D2) == LOW){
Reverse();
}
}
else {
if (digitalRead(St) == HIGH){
Star();
}
else{

delay(250);
}
}
}
[/textbox]

Here are the pinouts of the module for your own programing.

  • Digital Input 1 – Pin 8
  • Digital Input 2 – Pin 7
  • Analog Input 1 – Pin A5
  • Motor Output 1* – Pin 2
  • Motor Output 2* – Pin 1

* The Motor Outputs go through an H-Bridge – Click for more info on H-Bridge control

Please contact:

Brian O’Connell (Graduate Student)

Ethan Danahy (Professor)
Chris Rogers (Professor)

 

This project part of the Tufts University Center for Engineering Education and Outreach (CEEO). Visit the CEEO at http://www.ceeo.tufts.edu.