Qeros posting on Facebook

A Qero is a sacred vessel of the Inca Empire. It was used for religious ceremonies and rituals.  In this post I will explain how I – eventually – will work on a project where a vessel posts on Facebook. This research is part of my final project for school following my experience at ITP Camp. Because of the time frame I have to submit the project, I will articulate my research for the Facebook Qero, while hoping to make it in the future.

Some initial concerns were, firstly, when should this vessel post, and secondly where should I put the Arduino within the vessel. You’ll see what I decided to do and why by the end of this post

Here are the steps I would need to follow:

Step 1: Find the required materials

For this project I will need to use the following materials:

  • Arduino Yun (as I explained in a previous post, it supports Linux and allows WIFI connection)
  • A mug (for the initial prototype I will use a regular mug, then I will replace it with an actual ceramic vessel)
  • Duct tape
  • Fabric (I would use felt because it’s easier to sew)
  • Carton
  • Glue (that could paste fabric onto carton)
  • Scissors and pen
  • A facebook account
  • A temboo account (click here). This website provides information and libraries of different kinds of coding, like libraries for applications in social media, which is what I need to use for this project. I’m sure there are other websites like this but after doing some research, I found that using Temboo’s libraries is simpler than others.

Step 2: Setting up accounts

As I mentioned in the previous step, I would need a temboo account as well as a Facebook account. Then I would need to register an application using Facebook dev console.

Step 3: Connecting the Facebook app with the Facebook account

To make the application post on the Facebook account, I need to use an OAuth Choreos from Temboo as well. Here it is the link , which includes a video explaining this part of the process.

Step 4: Coding (part 1)

I have to create a header file named TembooAccount.h wherein the information on my Temboo account is stored. On the Arduino INO (Arduino’s coding platform) I should copy the following code and then add it as a library by going to Sketch > Import libraries > Add library > Select the folder where this file has been saved.

#define TEMBOO_ACCOUNT “accountName”  // my Temboo account name
#define TEMBOO_APP_KEY_NAME “myFirstApp”  // my Temboo app key name
#define TEMBOO_APP_KEY  “abc123xxxxxxxxxxxxxx”  // my Temboo app key

Step 5: Coding (part 2)

Once I turn on the Arduino Yun and make sure it is connected to the WIFI, I have to replace some information from this code with my own information. So far I have only changed the Facebook message. Then I need to upload this code to the Arduino Yun. (I got this code from Temboo’s website therefore comments in this code are written by the author of the code and not by me):

/*
UpdateFacebookStatus

Demonstrates sending a Facebook status update using the Temboo Arduino Yun SDK.

This example code is in the public domain.
*/

#include <Bridge.h>
#include <Temboo.h>
#include “TembooAccount.h” // contains Temboo account information

/*** SUBSTITUTE YOUR VALUES BELOW: ***/

// Note that for additional security and reusability, you could
// use a #define statement to specify this value in a .h file.

// the Facebook Access Token, which can be obtained using the Temboo OAuth Choreos
const String FACEBOOK_ACCESS_TOKEN = “xxxxxxxxxx”;

int numRuns = 1;   // execution count, so this sketch doesn’t run forever
int maxRuns = 1;  // the max number of times the Facebook SetStatus Choreo should run

void setup() {
Serial.begin(9600);

// For debugging, wait until a serial console is connected.
delay(4000);
while(!Serial);
Bridge.begin();
}

void loop() {
// while we haven’t reached the max number of runs…
if (numRuns <= maxRuns) {

// print status
Serial.println(“Running UpdateFacebookStatus – Run #” + String(numRuns++) + “…”);

// Define the status message we want to post on Facebook; since Facebook
// doesn’t allow duplicate status messages, we’ll include a changing value.
String statusMsg = “Between the past and future through this sacred vessel”;

// define the Process that will be used to call the “temboo” client
TembooChoreo SetStatusChoreo;

// invoke the Temboo client
// NOTE that the client must be reinvoked and repopulated with
// appropriate arguments each time its run() method is called.
SetStatusChoreo.begin();

// set Temboo account credentials
SetStatusChoreo.setAccountName(TEMBOO_ACCOUNT);
SetStatusChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
SetStatusChoreo.setAppKey(TEMBOO_APP_KEY);

// tell the Temboo client which Choreo to run (Facebook > Publishing > SetStatus)
SetStatusChoreo.setChoreo(“/Library/Facebook/Publishing/SetStatus”);

// set the required choreo inputs
// see  https://www.temboo.com/library/Library/Facebook/Publishing/SetStatus/
// for complete details about the inputs for this Choreo

SetStatusChoreo.addInput(“AccessToken”, FACEBOOK_ACCESS_TOKEN);
SetStatusChoreo.addInput(“Message”, statusMsg);

// tell the Process to run and wait for the results. The
// return code (returnCode) will tell us whether the Temboo client
// was able to send our request to the Temboo servers
unsigned int returnCode = SetStatusChoreo.run();

// print the response code and API response.
Serial.println(“Response code: ” + String(returnCode));

// note that in this case, we’re just printing the raw response from Facebook.
// see the examples on using Temboo SDK output filters at http://www.temboo.com/arduino
// for information on how to filter this data
while(SetStatusChoreo.available()) {
char c = SetStatusChoreo.read();
Serial.print©;
}

SetStatusChoreo.close();
}

Serial.println(“Waiting…”);
Serial.println(“”);

delay(30000); // wait 30 seconds between SetStatus calls
}

Step 6: Attaching the Arduino to the vessel

I decided to create an independent piece that I could attach but also take out from the vessel. I did this for two reasons: First it is easier to work with a more malleable and less delicate piece; and secondly, I could wash the vessel without damaging the arduino yun. That being said, these are my drawings for the vessel (exact sizes will be defined once I have all the materials):

Step 7: Defining some issues

So far the code only initiates the Arduino Yun to post on Facebook once but I’ll leave it this way for now. Eventually I would like to make it post automatically more than once a day, but I need to improve my coding skills.

 



Leave a Reply