Presentation: The Twittering Part Chair

The Twittering office chair "tweets" (posts a Twitter update) upon the detection of gas so much as that produced by human flatulency. This is part of my loyalty to accurately document and share my life as it happens.

For much in depth possibility, delight get word the next footprint entitled Theory.

See the results of the toots of your on labor on Twitter.

Footstep 1: Possibility

According to my coworker, Twitter is so-called to happen in that space between Flickr posts and Facebook updates, in the space when spirit in reality happens. Well, in the space of clock "when life actually happens," life history actually happens. It is neither pretty nor ugly. IT is just lifetime. If Twitter is improbable to be a document of life as it happens, then it should rattling document life, indiscriminately, as it happens without interference. If information technology fails to do this, then life then becomes the space between "tweets" (Twitter posts).

Therefore, it is of the utmost importance, to be able to update Twitter with life-time events without really interfering with the event themselves. The documentation of sprightliness, henceforth, needs to be automatic.

That said, I definite the basic part of life that needed to be documented was my daily turgidness at work. I am non going to prevarication, I am a unhealthy individual. Since my flatulence is a part of life, information technology would be fraudulent of Maine to document life as IT happens without documenting these occurrences.

In guardianship with the process of non-interference in daily activity, I have created an spot chair to some find and Twitter my flatulence without having to bother Maine to update information technology myself.

Step 2: Go Start out Poppycock

You will take:

- Office hot seat
- Squidbee TX/RX pair
- 1/8" patch of acrylic
- 50K trimpot
- Natural gas sensor
- Solid hookup wire
- Soldering setup
- Laser cutlery (or saw and drill)
- Razor blade
- Screwdriver go down
- Drill
- Nuts and bolts (or screws)
- Pliers
- A staple gunman
- Python
- A Chitter account


(Note that some of the links on this page are assort links. This does not change the monetary value of the item for you. I reinvest whatever proceeds I receive into making new projects. If you would like any suggestions for alternative suppliers, delight let ME know.)

Step 3: Make a Sensor Mount

Make a sensor mount by downloading the related to Corel file and laser cutting your 1/8 piece of acrylic using your awesome Epilog laser cutter.

Did I mention how awesome Epilog laser cutters are?

Anyhow... If, unlike us at Instructables, you do not induce a laser stonecutter, you rear end download the file and print information technology to composition. Cut out the circular precis from the sheet of paper and tape this to your acrylic as a guide. Where necessary, drill holes through the acrylic resin using a power recitation and cut around the outline with a jigsaw (or similar).

Step 4: Bond the Sensor

Attach the sensor to the mounting bracket by follow the wiring in the schematic portrayed. If you put on't have a trimpot, you can insert a resistance value between 22K and 47K (a trimpot is advisable).

When the components are inserted, solder them in situ. You English hawthorn want to first cut off any extra leads that Crataegus oxycantha confuse you.

Date the datasheet present.

Step 5: Wa It In

Open your Squidbee (presumptuous you didn't make one yourself) and detach all of the useless sensors. Plug in your natural gas detecting sensor such that the power goes to the power socket and the data line goes to pin 2 (as shown).

Step 6: Political program the Squidbee

Now is the fourth dimension to syllabu your Squidbee with the code to read the analog sensor.

First things first, unplug the Xbee screen from the Arduino (the depart of the Squidbee the sensor is obstructed into). Likewise, change the power pinafore from battery to USB power.

Close, plug the Arduino into your USB port.

Open the Arduino programmer.

Set the Sequential port (usually looks like /dev/tty.usbserial-A70048pF). Put down the serial port address for future book of fact.

Download, open and hit the "play" button to amass the code (download below). Upload the code to your Arduino.

Unplug the Arduino from your figurer. Switch the jumper back to battery power and put the Xbee shield back along.

Step 7: Connect to the Computer

When you are ready to start taking sensor readings, plug your 9V battery into the Squidbee vector and link up the receiver to the computer.

You can buoy see the elect stream of data by watching the sequent monitor in the Arduino interface on your computer.

Measure 8: Python

Earlier you can go any farther, you need Python.

If you are using a Mac with a recent version of OS X, you should have Python already.

Open the Terminal, type into the command prompt "Python" and dispatch "enter."

This should pioneer Python.

To see Python do its thing type:
print 'hello universe' (and collision Enter)

This will deliver "Hello World" in the prompt.

To quit Python striking "control-D".

If you don't have Python, you can go download it here and set up it away following the instruction manual listed.

Step 9: Dependencies

Thither are a number of basketball you have to jump done before you can run the Python code in the adjacent step.

The first thing you deman is the setuptools case script. Open terminal and change your working directory to the directory setuptools is in. You can modify directories by typing "cd nameofdirectory" and hitting "enter". and you can take what directories are in your current location by typing in "ls" and hitting "enter".

At one time you are in the correct directory, install the shell script by typing chmod setuptools.egg (or whatever the exact name of the file cabinet is. Do not rename the Indian file). This may involve entering your executive password. Do thusly when prompted and hit "enter".

You should now be able to use Easy Install, which, happens to be one of the sterling pieces of code ever so printed. In one case you have Easy Install you just call for to type into the bid prompt "easy_install" followed by the name of the package you are trying to download and score "enter." For example, "easy_install greatcode" (not a historical example). Next thing you bang, you have downloaded and installed the entire "greatcode" package for expend in your ain code.

Open your prompt and typecast each line below and hit enter. This bequeath instal the Simple Json, Twitter, Meter and advanced Math (numpy) packages.

easy_install simplejson
easy_install pyserial
easy_instally numpy
easy_instally prison term

Download and install Python Twitter by following the directions on the page (you might straight just try "easy_install chirrup").

Step 10: Code

This project was a great apologize for me to start to learn Python. Equally a novice, this code is not perfect tense, but information technology gets the business done. If you any have suggestions as to how this may be reinforced, please let Maine know.

That said, or s helpful things I learned about Python include:
One of Python's greatest features (or possibly the worst?) is its lack of syntax. You rarely need to remember a culmination or opening tag. You can just keep typing out lines of encrypt and Python wish essay its best to process it.

Python processes blocks of code based on their indentation. Improper indentation can result in disaster. For instance, the only way the code knows that something is part of a for loop is because it is indented the same American Samoa everything other that is besides part of that loop. This can start to get tricky with nested loops (loops inside of loops) and tip to confusion and bad code.

Python's function system is confusing on a number of levels (for instance some variables are mutable and some not). I don't fully understand the complexities of functions, but if you are interested, you should definitely look it up.

The code we are going to use includes a numeral of packages, a collection of functions that can be invoked at will (picture last step for many information about installing packages).

We are importation the following packages:
- Python Chirrup
- PySerial
- Numpy
- Time
- Random

The cipher is as follows:

#!/usr/bin/python #Filename: TwitterChair.pyimport twitterimport serialimport numpyimport timeimport unselected## Your username and password present#api = chirrup.Api(username='yourusername', password='yourpassword')## Change this to match your serial port#ser = ordination.Serial('/dev/tty.usbserial-A70063pF', 19200)serialArray = []world-wide gassygassy = 0def checkokay():	ser.flushInput()	time.sleep(3)	line=ser.readline()	clip.kip(3)	if product line == ' ':		line=ser.readline()	print 'here'def startvalues(i):	while i <= 50:		#time.sleep(.25)		line=ser.readline()		serialArray.append(int(line))		ser.flushInput()		i=i+1	print serialArraycheckokay()startvalues(0)def main(i, i1):	ArrayTransfer = numpy.range(i)	ComparatorValue = int(numpy.mean(ArrayTransfer))		impress ComparatorValue	lastReading = ComparatorValue	print lastReading		loopy = i1	mark around the bend	y = 0	x = 0	while y < 10:		while x < 5:			line of credit=ser.readline()			currentReading = int(line)           			if currentReading > lastReading:				lastReading = currentReading				print lastReading			print currentReading			time.sleep(6)			ser.flushInput()			x=x+1		print 'half minute'		x=0		y=y+1	if lastReading > (ComparatorValue + 50):		i1 = 1        	if i1 == 1:		sayings = ["He farted again successfully and dynamism. Woest me.", "Pfffffffffft", "Ugh. That was a gross one", "Someone please disassemble me", "If I could puke my foam stuffing, I would", "I wish I were some other chair",  "Helium farted right on me again", "Didn't hear that coming", "allow Pine Tree State to reduplicate... ppppfffffffffftttttttttttt", "Information technology wasn't always like this."]		pickSaying = random.randint(0,9)		print pickSaying		status = api.PostUpdate(sayings[pickSaying])	nuts = 0	impress 'done'	if __name__ == "__main__":		main(serialArray, loony)main(serialArray, gassy)

Step 11: Disassemble the Chair

Stigma on the seat of the hot seat the space between your rear end and the bottom of the angel. This is the space in which you want to install the sensor.

Remove the seat from the chair assembly and undo the upholstery until you bathroom access the foam in the surface area in which you marked.

Step 12: Undo the Upholstery

The fabric on your chair is belik held on with staple fiber.

Take away the staples from the back side of the seat much that you can straighten up a little of the fabric.

Step out 13: Alter the Cushion

Shred the froth so that there is a pocket in which the sensor can be inserted into the chair. I ground using a razor leaf blade to get the hole started, made it slimly easier.

Step 14: Insert the Sensor

Insert the sensor into the hole you just made in the cushion of the chair's prat. If possible, angle the sensor slightly towards where your rear will be.

Step 15: Reassemble

Put the chair cover together. This means reupholstering it with a staple gun and refastening any nuts and bolts.

Pace 16: Bottoms Up

Somehow, tighten the transmitter box to the bottom of the president's seat in a manner that you derriere still unfold and close the case.

I chose to confiscate mine using fervent glue. You can also use things equivalent nuts and bolts.

This May require first evacuation the case.

Stride 17: Turn It On

Plug the barrage into the transmitter attached to the chairperson and close the display case.

Plug the telephone receiver into the computer.

Tone 18: Run the Code

Head for the hills the inscribe by chess opening the terminal, navigating to the directory the register is set in and typing in python TwitterChair.py

If you didn't download the Python file thus far from the "code" step, download it from this footstep!

Step 19: Tweet

Twinge when you toot. Gayly let people know that you are engaging in life as information technology happens.

Did you find this useful, fun, surgery entertaining?
Follow @madeineuphoria to see my latest projects.

Be the First to Share

Recommendations