Bottoms Up
By Johnny, Soojin, Sujay
Overview
Bottoms Up is an installation that showcases Pittsburgh’s beer locations. It retrieves a list of beer locations from a beer mapping API (https://beermapping.com/api/) and filters out the phone numbers. It randomly selects a phone number every 15 seconds, and plays a chime according to each digit of the number. The chimes are driven by solenoids, and an LED in the middle of the beer bottle lights up after every phone number finishes.
Motivations
By choosing a beer mapping API, we believe will provide a novel way for local micro-breweries in Pittsburgh to connect with visiting as well as native travelers passing across the airport terminal. This will also help generate an additional revenue model for the airport authority from the advertising fee paid by the breweries. The information value generated by the installation will targeted for 21+ demographic, however, young travelers are expected to be able to experience and enjoy the soothing sounds generated by the installation. Maintenance costs is likely to be incurred for the solenoids but the independently controllable design for the solenoids should permit ease of replacement.
Photos
Video
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
var five = require("johnny-five"); var request = require("request"); var parseString = require('xml2js').parseString; var board = new five.Board({ port: "COM14" }); var url = "http://beermapping.com/webservice/loccity/3c22855e0a2202cac82d92bd2ea2b149/pittsburgh"; var phoneList = []; request(url, function(error, response, body) { parseString(body, function (err, result) { json = JSON.parse(JSON.stringify(result)); locations = json["bmp_locations"]["location"]; for (i = 0; i < locations.length; i++) { phone = locations[i]["phone"]; if (phone != "") { phoneList.push(phone[0].replace(/\D/g,'')); } } }); }) function playPhone() { var led = new five.Led(5); var led1 = new five.Led(6); var led2 = new five.Led(7); var led3 = new five.Led(8); selected = phoneList[Math.floor(Math.random() * phoneList.length)]; for (var i = 0, len = selected.length; i < len; i++) { (function(ind) { setTimeout(function() { if (selected[ind] == "0" || selected[ind] == "1") { led.on(); setTimeout(function() {led.off()}, 100); } else if (selected[ind] == "2" || selected[ind] == "3" || selected[ind] == "4") { led1.on(); setTimeout(function() {led1.off()}, 100); } else if (selected[ind] == "5" || selected[ind] == "6") { led2.on(); setTimeout(function() {led2.off()}, 100); } else { led3.on(); setTimeout(function() {led3.off()}, 100); } console.log(selected[ind]); }, (1000 * ind)); })(i); } } // The board's pins will not be accessible until // the board has reported that it is ready board.on("ready", function() { console.log("Ready!"); playPhone(); setInterval(playPhone, 15000); setTimeout(function() { var led4 = new five.Led(13); led4.on(); setTimeout(function() {led4.off()}, 3000); },11000); setTimeout(function() { setInterval(function() { var led4 = new five.Led(13); led4.on(); setTimeout(function() {led4.off()}, 3000); }, 15000); },10000); }); |