• No results found

TUTORIAL 3 :: ETHERNET SHIELD AND TWITTER.COM

N/A
N/A
Protected

Academic year: 2021

Share "TUTORIAL 3 :: ETHERNET SHIELD AND TWITTER.COM"

Copied!
5
0
0

Loading.... (view fulltext now)

Full text

(1)

TUTORIAL 3 :: ETHERNET SHIELD AND TWITTER.COM Pachube.com orchestrates a global, open-source network of Inputs and Outputs. However, as an infrastructure it is lim-ited in two major ways: 1) you can’t carry it with you. 2) it is not culturally imbedded. We will overcome these limitations through the use of cellphones and Twitter.com. We’ll also remove our dependence on the computer’s internet connec-tion by integrating the Ethernet Shield with Arduino.

Among other things, Twitter.com allows users to send SMS commands from their cellphone to a Pachube.com feed. Practically everyone has a cellphone; cellphones are practi-cally everywhere. Although our Arduino projects are not everywhere, we can harness the cellphone so that we might reach beyond the local toward the global remote, thereby broadening the potential of Inputs and Outputs to bring Architecture to life.

PART 1 :: TWITTER.COM QUICKSTART

1. Create a new Manual Feed in your Pachube.com account. Take note of the feed ID - we will use it later.

2. Create a new account on Twitter.com.

3. From your Twitter.com account, tweet the message follow pachtweet

using the text entry box. This is called a public tweet. You can also send Direct Messages (DM), which are private. The user pachtweet acts as a courier, delivering your commands from Twitter.com to Pachube.com.

4. Tweet the message

@pachtweet connect

into the text entry box. “@pachtweet” designates the recipi-ent, “connect” is the message. Wait for the user pachtweet to send you a DM. Direct Messages can be found under the menu list on the right.

(2)

5. Reply to pachtweet’s DM with the message

key YOUR_PACHUBE_KEY

This is a one-time authentication process, allowing only your Twitter.com account to access your Pachube.com feeds. YOUR_PACHUBE_KEY is also called your API Key, and you can fi nd it under Settings inside your Pachube.com ac-count.

You are now ready to send commands to your Pachube feed by using Direct Messages in Twitter.com.

6. To begin controlling your Arduino project, send a DM to pachtweet that follows this format:

set FEED_ID STREAM0,STREAM1,STREAM2, . . . “set” is a prefi x that tells pachtweet you want to enter new data into a feed. “FEED_ID” designates the feed ID where you want to send the data. “STREAM” designates the data to be sent. Streams are ordered sequentially by commas with no spaces. You may have multiple Streams in a single Pachube.com feed. Streams will be listed on your feed in the same order you enter them here.

7. Add the option to send DMs using your cellphone. From your Twitter.com account, click “Settings” in the upper right.

Click “Devices”, and follow the on screen instructions to set up your cellphone.

Note that updates should be sent to 40404 while in the United States. See the Twitter Phone FAQ for dialing Twitter from other countries:

http://help.twitter.com/forums/10711/entries/14014 Cellphone DMs follow a similar format when updating a Pachube.com feed:

d pachtweet

set FEED_ID STREAM0,STREAM1,STREAM2, ... “d” is a prefi x that tells Twitter.com that you want this to be a Direct Message. “pachtweet” designates the user to send the DM to. The rest is the same as Step 6.

8. DMs from Twitter.com or your cellphone will update your Pachube.com feed. We still need to set up the Arduino in order for those DMs to be read as commands.

(3)

PART 2 :: ETHERNET SHIELD QUICKSTART

1. Purchase an original Arduino Ethernet Shield if you have not already done so:

http://www.sparkfun.com/commerce/product_ info.php?products_id=9026

2. Attach the Ethernet Shield on top of the Arduino. You will probably need to detach your Breadboard/LEDs.

The Shield replicates all pins on the Arduino, however it uses pins 10, 11, 12, and 13, for it’s own purposes. Relocate your Breadboard/LEDs so they do not use pins 10, 11, 12, and 13.

Remember to update your sketch accordingly.

3. Identify the IP address of a GSAPP computer. Use the fol-lowing web address to fi nd your IP address. Take note - we will use it later:

http://whatismyip.com/

4. Carefully detach your GSAPP computer’s ethernet cable and attach it to your Arduino Ethernet Shield.

5. Open the “WebClient” sketch in the Arduino 12 environ-ment: Open > Examples > Library-Ethernet > WebClient Ethernet Shield (top) Arduino USB Board (bottom)

(4)

6. Look to the sketch and update it with your IP address. Add a Gateway and Subnet array immediately following the IP array. You do not need to change your MAC address. IP addresses should be formatted with a comma followed by a space, like this: 100, 20, 300, 40

byte ip[ ] = { YOUR_IP_ADDRESS_HERE }; byte gateway[ ] = { 128, 59, 128, 1 }; byte subnet[ ] = { 255, 255, 252, 0 };

Your IP address is a set of four unique numbers just for you. If you have problems, try changing the last number to some-thing higher, but leave the other numbers alone.

Gateway and Subnet are specifi c addresses associated with Columbia University. They allow you to use Columbia’s network.

7. Update Ethernet.begin() so it reads as follows: Ethernet.begin(mac, ip, gateway, subnet);

8. Upload the sketch to your Arduino. When the upload is complete, press the “Serial Monitor” button next to “Upload to I/O Board”.

You should see a large stream of HTML from Google.com. Your Arduino and Arduino Ethernet Shield are now capable of accessing the internet.

(5)

PART 3 :: ETHERNET SHIELD, PACHUBE, and TWITTER 1. In the Arduino 12 environment,

open the “Tutorial3_twitter” fi le emailed to you. Take a minute to review the sketch. You’ll notice many familiar pieces of code, some of it slightly altered, some of it entirely new.

It’s been adopted from the “Arduino Ethernet Pachube Input Output” sketch, found here:

http://community.pachube.com/fi les/ ethernet_Pachube_input_output.zip

Note the three tabs. Tabs are essentially one very long sketch split into three pages for ease of viewing.

2. Create a new Manual Feed in Pachube.com. Take note of the feed ID.

3. Look to the sketch, and set “SHARE_FEED_ID” to the new feed ID you just created.

4. Set the “REMOTE_FEED_ID” to the feed ID that you want to access. Any Pachube.com feed ID is possible, but for this example we will access the feed ID you created for Twitter. com in Part 1.

5. Set the “REMOTE_FEED_DATASTREAMS” to the total num-ber of streams you want to connect to. For example, if you want to connect to STREAM0, STREAM1, and STREAM2, set this value to 3.

6. Set the “PACHUBE_API_KEY” to your Pachube Key.

7. Enter your Mac, IP, Gateway, and Subnet addresses from Part 2. Upload the sketch to Arduino.

8. Part 3 is now complete.

HOW IT WORKS:

Using your cellphone, send an SMS to 40404: d pachtweet set FEED_ID A,B,C

‘FEED_ID’ is the REMOTE_FEED_ID from Part 3

‘A’ is how long the LED will fl ash (try 55, then try 200 to compare) ‘B’ turns the inside red LED on or off (try 1 for on, and 2 for off ) ‘C’ sets the brightness for the inside red LED (1 thru 255)

Prepared by KEVIN WEI

References

Related documents

Pair of fallout new mods recommended vidya wiki is an interface in new vegas, but unique series of the install instructions for installing. Updated but unique and new vegas

Sin embargo, después de casi cincuenta años, buena parte de aquellos militantes del movimiento obrero que participaron en las protestas que paralizaron las fábricas desde comienzos

1) Twitter: Tweet your Submission via your Twitter account using the hashtag #Reflectie and @TurtleWax (the “Twitter Hashtag”). You must also be following Sponsor’s Twitter feed,

So send your crush for you have to sending the best to do it might need a cute good night my love.. These cute text message is texting your crush, this is so good morning, i am

To configure the shutdown of a module or the entire switch due to an overbudget power condition when an Embedded Event Manager (EEM) applet is triggered, use the action

For servlets not implementing the SingleThreadModel interface, if the service method (or methods such as doGet or doPost which are dispatched to the service method of the

In order to be able to send a text message directly to a person from the Shelby v.5 software, that person must have both a cell phone number and the corresponding cell carrier listed

• Then you click a button on our members website (under Create Newsletter tab) to PUSH a “merged” email template into your Online Marketing Center.. Then you have to visit the