Categories
Uncategorized

The Like Tracker Kiosk

Like Tracker Kiosk

You may remember my post about the Sir Like-A-Lot, which was a kiosk to show how many “Likes” your Facebook page has. I built it for an event that z2 Marketing had last fall. Well, with it being Raspberry Pi week over at Make Magazine, I was asked to write up a proper how-to, so there’s now a nice step-by-step description in the Project section titled Build a Raspberry Pi “Like” Tracker Kiosk.

It was a good challenge, as I ended up starting from scratch multiple times, as I wanted to make sure I didn’t miss any steps. Typically, when I build something like this, it’s a bit unstructured, where you install things, configure things, and finally get it working, and then realize your notes are sorely lacking. I also wanted to make things as simple as possibly, and with Perl, that’s not always easy!

Anyway, I hope you enjoy the Project, and hopefully I can contribute more in the future.

Categories
Uncategorized

Sir Like-A-Lot

Sir Like-A-Lot

My latest project was sort of a failure, but I’m going to post about it anyway, because such things are important.

For a recent event I wanted to create a unique way for people to LIKE something, and get a reward for it, so I grabbed a Raspberry Pi and got to work. The idea was pretty simple, a full screen display showing the number of Facebook likes, with the URL for people to visit the page (on their mobile devices) and like it. The display would then update in “near” real-time (Well, every 10 seconds) and there would also be a surprise…

Step #1 is always configuring the Raspberry Pi. I installed Raspbian, had it set to boot to the desktop, and installed the packages I needed, mainly Apache and Chromium, since I’d be using a local web server and web browser for the display.

Getting the Raspberry Pi to work as a kiosk display was next. I didn’t want any menus or OS parts showing, so I used Chromium running in kiosk mode. My /etc/xdg/lxsession/LXDE/autostart file looked like this:

# config to launch Chromium in kiosk mode and load our application
@xset s off
@xset -dpms
@xset s noblank
@chromium --kiosk --incognito http://127.0.0.1/likealot/

We got rid of the part that lets a screensaver run, and added in the bits to fire up Chromium in full-screen kiosk mode. (Oh, one note about Kiosk mode, it does not hide the mouse pointer, but we’ll deal with that later.)

LIKES

The results on the screen looked like this. Full screen, no browser or OS bits showing. I like this solution as it can be used for pretty much anything you can code up as a web page.

The display is set to refresh every 10 seconds, so it’s pretty up-to-date, and you’re really only limited by what you can display in a browser (Chromium) running on Linux (on a Raspberry Pi, in this case.)

As for the code, it’s less than 50 lines of Perl running as a CGI, and about a dozen lines of HTML in an HTML::Template file. There’s also a little CSS and an image.

Speaking of the CSS, it was the solution to hiding the mouse pointer for Chromium running in kiosk mode. I just added this bit:

/*
 * using CSS to hide the pointer
 */
* { cursor: none !important }

For an informational kiosk you just want people to look at and not have to interact with using a mouse or keyboard, this solution works well.

JSON

You might be saying “Hey! How do you get the number of likes!?” Well, you just ask JSON, or http://graph.facebook.com/?ids=z2marketing to be more precise. Facebook Graph API data holds the key, you just need the value.

Oh, there was one more really fun bit! When someone liked the page and the page refreshed and the number increased, you’d hear applause!

The original idea was to just have the CGI do a system call to play the file using aplay. That did not work. I also tried mpg321 and that didn’t work. In the end I went the other way around and added… another Perl script! There’s a cron job that runs on startup, which launches a Perl script, which loops forever and looks at the counter file that the CGI uses. Every time the counter file changes (due to the CGI updating the number) the Perl script uses aplay to play the applause file.

The end result is pretty good. A person sees the display, goes to Facebook, likes the page, and within 10 seconds the display updates and you hear some applause!

I planned on making a sign or adding some text to entice people take action and get a “reward”. And of course the URL isn’t as helpful on a mobile device where you probably use an app instead of a browser, but this is all a good start.

Now, I mentioned a failure, so I should explain that part. For anything like this, where it needs to run for hours reliably and not just be a quick technology demo, you need some burn-in time. I had this running for a week with no issue. The first issue that came up was, what to do if you lose the Internet connection. (Hey, we use Time Warner, it happens!) You really don’t want to see a default Apache 500 error page, so the error page looked just like the main page, but with a message that said ‘Please stand by…”. That 500 page was set to redirect to the main page after 10 seconds, which would deal with occasional Internet or network outage situations. Since we were also using a WiFi connection with the Raspberry Pi, there’s always the chance of losing the WiFi connection. This didn’t seem to happen much, but it’s something you may need to deal with.

I also set Apache to not do any logging, as there’s really nothing valuable gained from logging after you’ve got everything running. It also helps to write less data to the SD card that holds the system because… corruption.

Oh yes, corruption! Every now and then I would reboot the system to make sure it would start up properly. It almost always did. Except when it didn’t. Once the Pi booted and there was a warning that the file system needed repair, so I repaired it, and all seemed well. I tested again for another week, and things seemed good. But then…

The day of the event, I had to move the system into place, and when I did that, and started it up, Linux would not boot. Even after 13 years I am still not enough of a Linux expert to fix every problem it throws at me, and I was stuck, and had a dozen other things to do, so it was dead.

I did the dozen other things and then ended up reinstalling Raspbian and trying to quickly reconfigure it, and get all my files in place, and got everything working except the audio… and the WiFi. There are a few tricks to getting audio working properly on the Raspberry Pi. I eventually got it working, but it was too late to deploy it. Oh well…

So next time, I will have a BACKUP SD card ready to put in place when the first one destroys itself. Or maybe I’ll just build two complete Raspberry Pi systems. Backups are good. Backups are good. Backups are good.

But don’t worry, I’ll take all the successful bits of this project and re-implement it in some other way in the future.

Categories
Uncategorized

Facebook vs. Google (Maker Prespective)

Make

I’ve had at least one person say “Hey Pete! I thought you didn’t like Google?” and if I can clarify, there are things about Google I don’t like, just as there are things about Apple I don’t like, and (many) things about Facebook I don’t like, and throughout my travels in the tech world, I’ve been lucky that I haven’t worked for any of these companies, so I can feel free to speak about the things I don’t like.

Don’t get me wrong, there are a lot of things about Google, and Apple, and Facebook that are good, but I try to be critical, and not give any company a free pass.

With that said, I am definitely a fan of Google+ so far, and as far as being better than Facebook? Well, in many ways it is better for me, while in some ways it still needs to catch up.

But as a maker, what company does more to help improve the world for makers? Phillip Torrone’s recent post had this to say:

I’m glad there’s an alternative for sharing and collaboration now with more features that seem to be interesting to makers. Historically Facebook hasn’t done much in the Maker community, I’ve tried to get them to participate in Maker Faire each year (and would still love to have them, there are a lot great ideas for Facebook + Maker Faire). While it would be impossible to be a fan of everything Google does, they’ve been part of Maker Faire many many times, they’re doing a Science Fair, they have a hacker space for employees, they’ve adopted Arduino for Android, lots of good OSS efforts and the tools they’re creating with more control and ownership seems to fit the maker mindset better – it does feel like they’re listening, I hope they keep it up.

Phillip sums it up pretty well. Google may not do everything right, and they may still do things I don’t agree with…. but at the end of the day, they’re probably doing a lot more for maker culture than Facebook is, and that counts for something in my book.

Categories
Uncategorized

More fun with captchas

I’ve been known to deal with captchas over the years, but today while posting something on Facebook, I got one that made me pause…

captcha

Well that’s new! I’ve never had one with the text flipped upside down before… but in the world of captchas, there’s always room for improvement.

Being a smart-ass literal person, I headed over to fliptext.org to make sure I got it right. I mean, I didn’t want to just type in “they” right-side up, as that wouldn’t be correct. (Right?)

There we go… Confident I successfully entered the words in the captcha, I hit submit.

And it worked.

I wasn’t sure whether to be surprised or satisfied.

But I was left wondering if just typing in “they” right-side up would have worked.

Categories
Uncategorized

Change and Reputation

Contemplating the Vortex

I keep hearing about how Facebook and Twitter are changing the way things are done. From drafting a constitution to fixing Summerfest, these “new” sites are making new things possible… sort of.

But really, this is nothing new as far as the web is concerned. A typical web site from 2002 could easily have solicited feedback on how to improve things within a country, or a festival, or your own home town. In fact, some did, but there were some crucial elements missing, including critical mass, and reputation.

Critical mass in that there’s more people online now, being more engaged, thanks to sites like Twitter and Facebook. For the typical non-nerdy type, Facebook is the simple way to be online and connect with friends, and family, and brands. Twitter is pretty similar nowadays, though maybe slight nerdier, and even that is debatable now.

When I talk about reputation, I’m talking about the fact that with Twitter, and Facebook, you very often have a well formulated idea of who someone is. It’s typically built by looking at what the person has to say, and to who, and who has things to say to them. Their reputation. Their identity.

In the olden days (1997-200?) reputation was often tied to your blog, where you did your talking and where people talked back to you. (I’m sure similar things could be said of forums, etc. but I’m not convinced it’s the same thing.) I know there have been anonymous bloggers, but if I look back at the people who were blogging at the same time I started, I knew those people, and I trusted those people. I read their blogs daily, and they read mine, and we commented on each others posts, and we had conversations. It may have been a fixed point in time which created this situation, and perhaps it is an illusion… I don’t know for sure.

But the point is, I think what Twitter, Facebook, LinkedIn, Quora, and other sites have going for them nowadays is this element of trust and reputation they give to the users. These elements (should) allow a conversation to happen without the doubt that can often exist online, where you don’t know if a dog is a dog or a guy pretending to be a dog.

I’m still thinking through this whole idea… but would love some feedback on it.