Mini Mars Rover

rover1

The Mini Mars Rover was built for NASA’s International Space Apps Challenge by Mike, Tom and Ali. The Mini Mars Rover will move in the exact same pattern as his big brother on Mars. It will also display some other live data such as sound and images. The Mini Mars rover was built to roam around the home environment allowing the users to have a connection to the Mars Rover as it explores alone. We want to take boring data and make it tangible and exciting.

The Mini Mars Rover is an internet controlled robot. He comprises of a Wild Thumper chasis, an Arduino and an Electric Imp.

rover2

The Mini Mars Rover began life by building a new laser cut acrylic body onto the Wild Thumper 6WD chassis, and adding some more suitable wheels.

rover3

The Mini Mars Rover has just come back from an eventful time at SXSW Interactive in Austin,Tx. Not only was he found driving around the Space Meet Up event but he also featured on the Making Space Data Real on Earth panel. This panel was hosted by Ali Llewellyn from the NASA Open government initiative, David McGloin and Jon Rogers from the University of Dundee and Jayne Wallace from Northumbria University.

Below are some videos of the rover in action….

On Mashable – http://mashable.com/2013/03/10/sxswi-day-3/

On the Global Post – http://www.globalpost.com/dispatch/news/regions/americas/united-states/130311/sxsw-interactive-video

rover4

The Mini Mars Rover can be controlled from this url:

socialdigital.dundee.ac.uk/~ali/php/rover/ 

rover5
Team NASA (including an astronaut) get behind the Mini Mars Rover

Here’s is some code for you….

Squirrel for imp (adapted from an online source which I can no longer find…) :

 

================================================

server.show(“”);

// remote control for rover
ledState <- 0;

function blink()
{
// Change state
ledState = ledState?0:1;
server.log(“ledState val: “+ledState);
// Reflect state to the pin
hardware.pin9.write(ledState);
}

// input class for LED control channel
class inputHTTP extends InputPort
{

name = “power control”
type = “number”

function set(httpVal)
{
server.log(“Received val: “+httpVal);

if(httpVal == 1) {

hardware.pin9.write(1);
imp.sleep(0.1);
hardware.pin9.write(0);
}

else if(httpVal == 2) {

hardware.pin8.write(1);
imp.sleep(0.1);
hardware.pin8.write(0);
}

else if(httpVal == 3) {

hardware.pin2.write(1);
imp.sleep(0.1);
hardware.pin2.write(0);
}

else if(httpVal == 4) {

hardware.pin1.write(1);
imp.sleep(0.1);
hardware.pin1.write(0);
}

else{
;
}
}
}

function watchdog() {
imp.wakeup(60,watchdog);
server.log(httpVal);
}

// start watchdog write every 60 seconds
//watchdog();

// Configure pins as an open drain output with internal pull up
hardware.pin9.configure(DIGITAL_OUT_OD_PULLUP);
hardware.pin8.configure(DIGITAL_OUT_OD_PULLUP);
hardware.pin2.configure(DIGITAL_OUT_OD_PULLUP);
hardware.pin1.configure(DIGITAL_OUT_OD_PULLUP);

// Register with the server
imp.configure(“Reomote Control for Rover”, [inputHTTP()], []);

================================================

Arduino code (thanks Chris Martin!)…

================================================

 

/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the serial monitor.
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

This example code is in the public domain.
*/

int pinf=2;
int pinl=12;
int pinr=10;
int pinb=9;

 

#define LmotorA 3 // Left motor H bridge, input A
#define LmotorB 11 // Left motor H bridge, input B
#define RmotorA 5 // Right motor H bridge, input A
#define RmotorB 6 // Right motor H bridge, input B
#define v 255

 

#include <Servo.h>
//Servo myservo;
//int led = 12;
int pos = 0;
// the setup routine runs once when you press reset:
void setup() {
//myservo.attach(9);
// pinMode(led, OUTPUT);
pinMode(pinf,INPUT); // initialize serial communication at 9600 bits per second:
pinMode(pinl,INPUT);
pinMode(pinr,INPUT);
pinMode(pinb,INPUT);
Serial.begin(9600);

digitalWrite(pinf,LOW);
digitalWrite(pinl,LOW);
digitalWrite(pinr,LOW);
digitalWrite(pinb,LOW);

 

//288000
// this is different on the serial monitor not sure if it is up or down
// Serial.begin(14400);
}

int lls=0;
int rls=0;
int al=0;

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue1 = digitalRead(pinf);
int sensorValue2 = digitalRead(pinl);
int sensorValue3 = digitalRead(pinr);
int sensorValue4 = digitalRead(pinb);
// print out the value you read:
Serial.print(sensorValue1);
Serial.print(” : “);
Serial.print(sensorValue2);
Serial.print(” : “);

Serial.print(sensorValue3);
Serial.print(” : “);
Serial.println(sensorValue4);
delay(25); // delay in between reads for stability

 

if (sensorValue1 == 1) {

analogWrite(RmotorA,0);
analogWrite(RmotorB,120);
analogWrite(LmotorA,0);
analogWrite(LmotorB,120);
delay (500);
analogWrite(RmotorA,0);
analogWrite(RmotorB,0);
analogWrite(LmotorA,0);
analogWrite(LmotorB,0);
// myservo.write(10);
// delay (500);
}

else{
analogWrite(RmotorA,0);
analogWrite(RmotorB,0);
analogWrite(LmotorA,0);
analogWrite(LmotorB,0);
}

if (sensorValue2 == 1) {
// digitalWrite(led, HIGH);
analogWrite(RmotorA,0);
analogWrite(RmotorB,250);
analogWrite(LmotorA,250);
analogWrite(LmotorB,0);
delay (100);
analogWrite(RmotorA,0);
analogWrite(RmotorB,0);
analogWrite(LmotorA,0);
analogWrite(LmotorB,0);
// myservo.write(10);
// delay (500);
}
else
{
analogWrite(RmotorA,0);
analogWrite(RmotorB,0);
analogWrite(LmotorA,0);
analogWrite(LmotorB,0);

}

if (sensorValue4 == 1) {
// digitalWrite(led, HIGH);
analogWrite(RmotorA,250);
analogWrite(RmotorB,0);
analogWrite(LmotorA,0);
analogWrite(LmotorB,250);
delay (100);
analogWrite(RmotorA,0);
analogWrite(RmotorB,0);
analogWrite(LmotorA,0);
analogWrite(LmotorB,0);
// myservo.write(10);
// delay (500);
}
else
{
analogWrite(RmotorA,0);
analogWrite(RmotorB,0);
analogWrite(LmotorA,0);
analogWrite(LmotorB,0);

}
if (sensorValue3 == 1) {
// digitalWrite(led, HIGH);
analogWrite(RmotorA,120);
analogWrite(RmotorB,0);
analogWrite(LmotorA,120);
analogWrite(LmotorB,0);
delay (500);
analogWrite(RmotorA,0);
analogWrite(RmotorB,0);
analogWrite(LmotorA,0);
analogWrite(LmotorB,0);
// myservo.write(10);
// delay (500);
}
else
{
analogWrite(RmotorA,0);
analogWrite(RmotorB,0);
analogWrite(LmotorA,0);
analogWrite(LmotorB,0);

}

}

================================================

 

Supported by New Media Scotland’s Alt-w Fund

Alt-w Square k

 

Leave a Reply

Your email address will not be published. Required fields are marked *