Tag: raspberry pi

Life With Pi: Microcomputing in Academia

Microcomputing in AcademiaPresentation given December 6, 2013, as part of the CUNY IT Conference held at John Jay College of Criminal Justice.

Co-presenters and fellow librarians:
Allie Verbovetskaya
Stephen Zweibel
Junior Tidal

 

Slides (online)
Handout (PDF)


Outline of presentation:

  • Brief introduction to consumer microcomputers and microcontrollers (Allie) — see writeup
  • Microcomputers & pedagogy (Junior)
  • Microcomputers in scholarly research (me)
  • Computational & digital literacy (Stephen)
  • Demonstrations of projects built by presenters
    • LibraryBox: repository available via its own wifi signal (Stephen)
    • OwnCloud: Dropbox-like cloud storage (Allie)
    • Scan a book or enter ISBN, get an auto-citation (Junior)
    • Twitter bot: @mechanicalpoe (me)
    • Light level logger: demo of a 95¢ sensor wired on a breadboard (me)

My part of the presentation follows.

Microcomputers in scholarly research

raspberry pi schematic

Microcomputers come, of course, from computer science research, but they have research applications across just about every discipline — every instance where you might need to do computational work for cheap and don’t mind getting your hands a little dirty setting up these small computers. Scientists, humanists, and artists have all found uses for microcomputers in their work.

A few examples

Applications in the lab & studio

  • Cheap, disposable computing
    • The big draw, of course, is that these are very moderately priced, so cheap that they can be thought of as disposable — and definitely re-purposable. Project pivot? Or something went wrong? No problem — just wipe the computer, reinstall the disk image, and you’ve got a clean slate, no problem.
  • basic sensorsSensors!
    • In my survey of how consumer microcomputers like the Raspberry Pi, Arduino, and BeagleBone are used, many projects used them to log data using sensors. As we’ve seen in the past five years, all kinds of sensors have dropped massively in price, making them easy to integrate into your project. Sensors log data like temperature, humidity, radioactivity, motion, light, sound, GPS, velocity, and so on — any measure of your environment. Many of these sensors can be purchased for $10 or less by now.
  • Clusters!
    • Because they’re cheap to buy and can play nice together, some researchers have hooked microcomputers together to form a cluster or a supercomputer. This means that you can scale your computational power.
  • Prototypes!
    • Small, cheap computers can be used to throw something together that you might then build out with better materials. The Raspberry Pi, for example, is meant to be tinkered with — so you can wire and rewire sensors to a breadboard and write programs to put together a proof of concept before you even think about a soldering iron, and before bringing out the big guns of pricier computers.
  • Integration with other machines!
    • Like any computer, they can be hooked up to power or control other machines, like 3D printers or digital signage or quadrocopters. All of these cool things are now within the reach of both hobbyists and researchers alike.

Advantages

  • Low-cost (stretch that grant!)
    • We all feel the constraints of our budget, whether we’re working within a department that’s had to cut back or we’re trying to stretch out grant money. With some elbow grease, you get a lot of bang for your buck with these low-cost, low-power machines.
  • Tight control over your machines
    • Moreover, because these are simple computers and are designed to be opened up and built on top of, your understanding of your machines can get very deep and technical. With an open source operating system, and using open source software, you can know your machines inside and out. For projects that might involve sensitive data or for which you might otherwise need tight control over, these small, easy-to-handle machines are a good option.
  • Build on code others in the community have contributed
    • On the one hand, having to write or configure your programs at the code-level might be daunting and time-consuming — but the good news is that so much of what has already been done is out there, open and available for you to build on. You might find that someone has already done half the code you need for your research project, and all you have to do is change the variables.
  • Publish & brag
    • These consumer microcomputers are pretty recent, and in my survey, most papers I looked at were published in the last year or two. So it’s a hot topic!

Sample scholarly publication titles

  • Nagy, T., & Gingl, Z. (2013). Low-cost photoplethysmograph solutions using the Raspberry Pi.
  • Petteri, T., Raymond P., N., Hemi, M., Kenneth, K., Dominique, D., Claude, G., & Howard M., C. (n.d). Basic Neuroscience: An inexpensive Arduino-based LED stimulator system for vision research. Journal Of Neuroscience Methods211227-236. doi:10.1016/j.jneumeth.2012.09.012
  • Kale, N., & Malge, P. (2013). Design and Implementation of Photo Voltaic System: Arduino Approach. International Journal Of Computer Applications76(1-16), 21-26.
  • D’Ausilio, A. (2012). Arduino: A low-cost multipurpose lab equipment. Behavior Research Methods44(2), 305-313. doi:10.3758/s13428-011-0163-z
  • ElShafee, A., El Menshawi, M., & Saeed, M. (2013). Integrating Social Network Services with Vehicle Tracking TechnologiesInternational Journal Of Advanced Computer Science & Applications4(6), 124-132.
  • Leeuw, T., Boss, E. S., & Wright, D. L. (2013). In situ Measurements of Phytoplankton Fluorescence Using Low Cost ElectronicsSensors (14248220)13(6), 7872-7883. doi:10.3390/s130607872
  • Awelewa, A., Mbanisi, K., Majekodunmi, S., Odigwe, I., Agbetuyi, A., & Samuel, I. A. (2013). Development of a Prototype Robot Manipulator for Industrial Pick-and-Place OperationsInternational Journal Of Mechanical & Mechatronics Engineering13(5), 20-28.
  • Alves, N. (2010). Implementing Genetic Algorithms on Arduino Micro-Controllers. [working paper, arXiv]
  • Jha, N., Singh Naruka, G., & Dutt Sharma, H. (2013). Design of Embedded Control System Using Super-Scalar ARM Cortex-A8 for Nano-Positioning Stages in Micro-Manufacturing. Signal & Image Processing: An International Journal4(4), 71-82. doi:10.5121/sipij.2013.4406

Plus you’ll find lots of art installations!  See this great list of installations using Arduino, for example.

P.S.

We put together our presentation using Github as a collaborative writing tool: github.com/szweibel/CUNY-IT-Presentation It was the first time any of us had used Github in this way before. I think it worked well, although there was no built-in way for Github to then display the webpage (had to move our working copy onto another website).

Cross-posted on my personal website

Python + BeautifulSoup + Twitter + Raspberry Pi

In my ongoing experiments with my Raspberry Pi, I’ve been looking for small ways it can be useful for the library. I’ve been controlling my Pi remotely using SSH in Terminal (tutorial — though you’ll have to note your Pi’s IP address first). As I noted yesterday, I’ve been making it tweet, but was looking to have it share information more interesting than a temperature or light reading. So now I have the Pi tweeting our library’s hours on my test account:

Tweeting library hours

To do this, I installed BeautifulSoup, a Python library for working with HTML. My Python script uses BeautifulSoup to search the library’s homepage and find two spans with the classes date-display-start and date-display-end. (This is looking specifically at a view in Drupal that displays our daily hours.) Then it grabs the content of those spans and plunks it into a string to tweet. Here’s the script:

#!/usr/bin/env python
import tweepy
from bs4 import BeautifulSoup
import urllib3

CONSUMER_KEY = '********************' #You'll have to make an application for your Twitter account
CONSUMER_SECRET = '********************' #Configure your app to have read-write access and sign in capability
ACCESS_KEY = '********************'
ACCESS_SECRET = '********************'

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)

http = urllib3.PoolManager()

web_page = http.request('GET','http://www.lib.jjay.cuny.edu/')
web_page_data = web_page.data

soup = BeautifulSoup(web_page_data)
openh = soup.find('span','date-display-start') #spans as defined in Drupal view
closedh = soup.find('span','date-display-end')
other = soup.find('span','date-display-single')

if openh: #if library is open today, tweet and print hours
openh = openh.get_text() + ' to '
closedh = closedh.get_text()
api.update_status("Today's Library hours: " + openh + closedh + '.')
print "Today's Library hours: " + openh + closedh + '.'
elif other: #if other message (eg Closed), tweet and print
other = other.get_text()
api.update_status("Today's Library hours: " + other + '.')
print "Today's Library hours: " + other + '.'
else:
print "I don't know what to do."

Python libraries used:

I’ve configured cron to post at 8am every morning:

sudo crontab -e
[I added this line:]
00 8 * * * python /home/pi/Projects/Twitter/libhours-johnjaylibrary.py

Notes: I looked at setting up an RSS feed based on the Drupal view, since web scraping is clunky, but no dice. Also, there’s no real reason why automated tweeting has to be done on the Pi rather than a regular ol’ computer, other than I’d rather not have my iMac on all the time. And it’s fun.

Librarify it! Considering Raspberry Pi and Arduino projects

Recently, I’ve been struggling to come up with a project to pursue using my Raspberry Pi and/or Arduino (assembled at an NYC Resistor class over the weekend). Because I’m quite the tyro and need a lot of handholding before striking out on my own, I have been browsing many inspirational step-by-step tutorials and thinking, How can I librar-ify this? And no, not just for an excuse to tinker during work hours, but also because I know that there are a million and one uses for a baby computer or microcontroller in the context of an academic library — if only I could dream them all up!

Here are a few I’ve been mulling over:

Lobbyist counter

At the Sunlight Foundation, a vintage voltmeter is repurposed to count how many lobbyists are registered each week using a Raspberry Pi. (I particularly like the vintage-inspired meter face.)

Librarify it! Using a reference interaction tracker that we aspire to implement and test this summer, we could get a quick visualization of how busy the library or reference desk or computer lab is.

 


A Raspberry Pi and Arduino UNO power a server room monitor that tracks temperature, humidity, and light.

Librarify it! The same thing, but in our server room, not that guy’s.


sudoku

Adafruit’s “internet of things” little printer uses a thermal receipt printer for whatever you please.

Librarify it! Search or scan a book, get a printout of information using an API from CUNY+ or LibraryThing or Google Books?

 


The “Tabulatron,” which uses the Arduino microcontroller, is an easy way to count patron interactions with the push of a button, sending the results to a Google Drive spreadsheet instantly. Tim Ribaric and Jonathan Younker at Brock University created this and wrote a tutorial for the Code4Lib journal.

Librarify it! Already librarified!! Perhaps the counter could include a “low-level panic” button, for when a librarian at the reference desk is overwhelmed with patrons and needs back-up.

 


What else can we think of? What frontiers have I completely missed?