Project tutorial
Hospitality HAL

Hospitality HAL © CC BY

Friendly, talking, robot door greeter for your maker space.

  • 1,096 views
  • 0 comments
  • 15 respects

Components and supplies

About this project

Hospitality HAL was born out of necessity. The MakerHive had a serious lack of friendly robot voices greeting makers and visitors at the door. While everyone recognized the problem, no one was willing to put in the time to develop the various parts required for a welcoming robotic experience. 


With the addition of the OneSheeld, the project was too easy not to complete. Using the Voice Recognition, Twitter, Camera, and Text-to-Speech shield Hospitality HAL was created in short order.

Hospitality HAL: Live at the MakerHive


The Hardware is simply an Arduino Uno (Sparkfun RedBoard) and a OneSheeld connected to a Big Red Dome button from Sparkfun (COM-11960). The button is only used for the LED, which is connected to pin 9 and GND on the Arduino. 

Code

Untitled fileArduino
/* Hospitality HAL code using 1Sheeld and Arduino Uno

By Michael Sizemore
5/14/2015

Hardware consists of Big Red Dome Button from sparkfun and a box of your choosing
Arduino simply controls the LED in the Big Red Dome Button to make it look like 
HAL is talking

*/

#include <OneSheeld.h>

const int pinLED = 9;

bool isConnected = false;
bool buttonPressed = false;

String name = "";

void setup()
{
	OneSheeld.begin();
	pinMode(pinLED, OUTPUT);
	
	randomSeed(analogRead(0));
}

void action()
{
	TextToSpeech.say("Welcome");
	HALspeaks(1000);
	OneSheeld.delay(1000);
	TextToSpeech.say("Okay, switch to the Voice Recognition shield and tell me your name");
	OneSheeld.delay(500);
	HALspeaks(3400);
	
	while((!VoiceRecognition.isNewCommandReceived()) && (OneSheeld.isAppConnected())){
		OneSheeld.delay(10);
	}

	name = VoiceRecognition.getLastCommand();
	
	TextToSpeech.say("Good to see you" + name + ", Are you arriving or leaving?");
	HALspeaks(3000);
	
	while((!VoiceRecognition.isNewCommandReceived()) && (OneSheeld.isAppConnected())){
		OneSheeld.delay(10);
	}

	if (!strcmp("arriving",VoiceRecognition.getLastCommand()))
	{
		TextToSpeech.say("Great! Welcome to the MakerHive");
		HALspeaks(2000);
		Camera.frontCapture();
		OneSheeld.delay(3000);
//		Twitter.tweetLastPicture(name + " just got to the MakerHive!", 0);
		Twitter.tweetLastPicture(name + " just got to the MakerHive!", 0);
		
	}
	else if (!strcmp("leaving",VoiceRecognition.getLastCommand())){
		TextToSpeech.say("Ok " + name +", see you next time!");
		HALspeaks(2000);
		Camera.frontCapture();
//		Twitter.tweetLastPicture("L8RS", 0);
		OneSheeld.delay(3000);
		Twitter.tweetLastPicture("Thanks for coming " + name, 0);
	}
	else TextToSpeech.say("I didn't catch any of that. Disconnect and try again.");

}

void HALspeaks (unsigned long duration)
{
	// Make the button LED pulse as if it were talking
	unsigned long startTime = millis();
	
	while ((millis()-startTime)<duration)
	{
		//HAL is talking
		int attackTime = random(0,300);
		int fadeTime = random(0,200);
		
		// ramp LED up
		for (int i = 0; i<attackTime; i++)
		{
			int j = map(i, 0, attackTime, 0, 255);
			analogWrite(pinLED, j);
			OneSheeld.delay(1);
		}
		
		// ramp LED down
		for (int i = fadeTime; i>1; i--)
		{
			int j = map(i, 0, fadeTime, 0, 255);
			analogWrite(pinLED, j);
			OneSheeld.delay(1);
		}
	}
	
	analogWrite(pinLED, 0);

}

void HALwaits ()
{
	// Make the button LED pulse as if it were talking
	int attackTime = 500;
	int fadeTime = 500;
	
	unsigned long startTime = millis();
	

	// ramp LED up
	for (int i = 0; i<attackTime; i++)
	{
		int j = map(i, 0, attackTime, 0, 120);
		analogWrite(pinLED, j);
		OneSheeld.delay(1);
	}
	
	// ramp LED down
	for (int i = fadeTime; i>0; i--)
	{
		int j = map(i, 0, fadeTime, 0, 120);
		analogWrite(pinLED, j);
		OneSheeld.delay(1);
	}

	
	//HAL fades out
	analogWrite(pinLED, 0);
	
}

void loop()
{
	if (OneSheeld.isAppConnected())
	{
		if (!isConnected){
			isConnected = true;
			OneSheeld.delay(5000);
			action();
		}
	}
	else
	{
		isConnected = false;
		HALwaits();
	}
}
Hospitality Hal
Welcoming robot for the MakerHive using OneSheeld

Comments

Similar projects you might like

Control your Light System Using Smart Phone

Project tutorial by Ahmed Yassin

  • 35,277 views
  • 4 comments
  • 55 respects

Cab Safety System (Cabs4Cabs)

Project in progress by Aditi Ja and Drishti Kanjilal

  • 4,327 views
  • 6 comments
  • 18 respects

Bluetooth Steering wheel for a robot using 1Sheeld

Project tutorial by Kristian Blåsol

  • 2,633 views
  • 1 comment
  • 13 respects

Smart Selfie Stick

Project tutorial by yasser saber

  • 2,010 views
  • 0 comments
  • 7 respects

Smartwatch car remote

Project tutorial by Mika Wee

  • 16,828 views
  • 20 comments
  • 83 respects

Tweet from Arduino through your smartphone

Project showcase by Amr Saleh

  • 428 views
  • 0 comments
  • 2 respects
Add projectSign up / Login