Martino

Martino is a robot that detects the pressure applied to his hand and outputs a response to yes or no questions by the user. I wanted to create a sort of character out of the Magic 8 ball idea, where the user interacts with this character to get a response. The pressure applied changes the output of the message too, so the harder someone presses, the more likely they’re going to get a negative response.

I actually used Martino all weekend with different friend groups, and we’d program different games and things and outputs with new sensors as well as randomized messages. The coding for this below is the simple Magic 8 ball trick with 11 responses based on the pressure of holding his hand. The coding itself is so basic that it can be easily manipulated for a much wider variety of cases, and I focused on keeping everything on the breadboard because it allows for a wider variety of opportunities with new analog inputs and changing the messages. By limiting the size, it was easier for me to bring Martino and change his functions in different scenarios.

I’m still developing the idea, because the soft potentiometer is unstable in its output ranges. I remapped the ranges to between 0 – 250, so the user is more likely to get a randomized response. I coded 11 messages in between increments of 25 in the range. Right now I’m also adding trials, so that after several trials, the answers become less informative if the user asks too many questions.

I added a potentiometer to adjust the brightness of the screen, and added the Liquid Crystal library into the coding to print out the messages. There’s a gap of 24 spaces in my messages in order for the message to print on both lines. I also have the delays to give the user time to ask the question before the answer is given. Below is a quick video, where I change the pressure when I’m holding Martino’s hand to change the output, and also the additional coding.

Martino_Diagram

#include <LiquidCrystal.h>

LiquidCrystal lcd(12,11,5,4,3,2);
const int potentiometer = 0;
void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
lcd.begin(16,2);
}

void loop() {
  // put your main code here, to run repeatedly:
int pressure = analogRead(potentiometer);
pressure = map(pressure,0,1023,0,300);
delay(2000);
Serial.println(pressure);
delay(1000);

if (pressure < 25){
  lcd.print("Yes, obviously.");
  delay(25000);
  lcd.noDisplay();
}
if (pressure > 25 && pressure <50){
  lcd.print("Why do you wanna                         know?"); 
  delay(25000);
  lcd.noDisplay();
}
if (pressure > 50 && pressure <75){
  lcd.print("Call your mother                         and ask her.");
  delay(25000);
  lcd.noDisplay();
}
if (pressure > 75 && pressure <100){
  lcd.print("*shrugs*");
  delay(25000);
  lcd.noDisplay();
}
if (pressure > 100 && pressure < 125){
  lcd.print("It's worth a                            shot.");
  delay(25000);
  lcd.noDisplay();
}
if (pressure > 125 && pressure <150){
  lcd.print("#don'tcountonit");
  delay(25000);
  lcd.noDisplay();
}
if (pressure > 150 && pressure <175){
  lcd.print("Take a walk and                          try again");
  delay(25000);
  lcd.noDisplay();
}
if (pressure > 175 && pressure <200){
  lcd.print("Probably no...                           yeah no.");
  delay(25000);
  lcd.noDisplay();
}
if (pressure >200 && pressure <225){
  lcd.print("You ask dumb                            questions.");
  delay(25000);
  lcd.noDisplay();
}
if (pressure > 225 && pressure <250){
  lcd.print("You don't wanna                         know my answer.");
  delay(25000);
  lcd.noDisplay();
}
if (pressure > 250){
  lcd.print("...NO. Why would                        you even ask?");
  delay(25000);
  lcd.noDisplay();
}
}

 

 

Leave a Reply