Tag Archives: QR Code

Make your own QR Codes

9 Nov

QR Codes are fun – as long as you’re not just taking me to Old Navy to buy a sweater. Want to generate your own? I will show you how in Python.

Note: Python has many modules that make it easy to do almost anything you can think of. Use them. They will make your life easier. To find some go to pypi.

Download and install the QrCode Package. You also need the Python Imaging Library (PIL).

All I did was copy the sample and add a variable to pass the data and a save(). Configure the program to pass a value via the command prompt, QT or the web – give a CherryPy application a shot!

Here is all the code it takes:

import qrcode
import PIL


You can do more by using the QR Code Class – change the version and error correction levels. You can drop the show()too.

Here is my QR Code to Google.


The History of Albuquerque in QR Codes

22 Feb

So I had an idea where I would place QR Codes around Downtown Albuquerque. When you scan the code, you would see a photograph from between 1890 -1927 of the site you are standing on. I even used the New Mexico Centennial logo with my codes. I created a map, using leaflet.js, of where the six codes would be place (2 were placed at 1st and Central). The map is mobile capable and is at http://abq.educationalfacilityplanning.com.The popups show you what photo you would see when you scan the code.

In Albuquerque we have a group called the Downtown Action Team. They clean the City every morning and I must say they do a good job. There is not a single piece of paper attached to any posts in this city. This should have been a clue that my project was doomed to fail. My QR Codes were gone within 2 days.

Well, it was a nice try and a cool project. Here is a sample of my QR Codes – I would like to replace the middle of the code with a Zia in the future.

Why Jon Barocas Doesn’t Understand QR Codes

17 Feb

Mashable ran a piece yesterday by Jon Barocas titled: Why QR Codes Won’t Last. I am not going to argue that QR Codes are going to last, but I will argue that Jon Barocas is blinded by his professions inability to be creative and do anything innovative. Marketers have abused QR Codes. They have turned a potentially useful tool in to nothing more than a URL to their lame website. They also misunderstand what we want from them and from QR Codes. Until marketers stop applying new technology in old ways, QR Codes in marketing is doomed for sure. But for the rest of us, they offer a an innovated way to share information.

Jon starts by saying only 5% of Americans have scanned a QR Code and that this is a problem. 5% is 14 million people. That’s a large number people. But for marketing, they need more scans.  He attributes the low number of people scanning QR Codes to the fact that people “are visual animals..” and that “…a more visual alternative to QR codes would not only be preferable to consumers, but would most likely stimulate more positive responses to their presence. ” A QR Code dropped in to an advertisement in a magazine does not tempt me to scan it. Jon is right about this. But what he is missing, is that when I am reading a magazine, your ad may grab my attention for two seconds, but I am not interested in your product at the moment. I will not put down my magazine and go to your website. I am enjoying my magazine, which your ads are interfering with. Let’s be honest, I am probably reading this magazine in my library – and by library I mean bathroom. I may not even be reading a print copy of your magazine. If I am reading it on my phone or iPad, what am I going to scan your code with?

QR Codes can do much more than take me to your website to buy stuff. Look at any of my past posts to see a QR code link to building models, real time maps, and databases. Do something interesting. I am walking around with a dual core processor and an internet connection in my pocket. If you can only send me to a website to buy cargo pants, you have lost me. You have bored me. You are applying a new technology to your old, tired, marketing methods.

Jon has a solution that will replace QR Codes – MVS (mobile visual search). Yay! I can scan a company logo and it will take me to their website to buy stuff. Because as a human of normal intelligence, I clearly don’t know that mcdonalds.com , walmart.com, dove.com will take me to their sites. URLs are so hard to figure out. Jon, I know how to get to your site. It is not why I would want to scan a QR Code. And I am not scanning your logo to take me there either.

Jon ends by telling you how QR Codes will infect your phone with a horrible virus or a trojan. MVS is much safer, because hackers and malware writers don’t write for MVS….Yet, Jon. Modifying your logo slightly may be all I need to make your MVS as dangerous as a QR Code. Jon is right. QR Codes can be a bit dangerous. Ever used a URL shortener? Bit.ly anyone? These shortened URLs can do exactly the same thing. Who knows where you are clicking. The internet is a dangerous place but I am not giving up on it.

I don’t know what the future of QR Codes will be. But I can tell you that marketers and social media consultants and new media guru seo optimizers and whatever these people decide to call themselves nowadays say, they are missing the boat. Stop forcing your old ways on new technology. Think of new ways to go with new technology. Do something creative. Wow me. But don’t say the sky is falling because nobody is scanning a QR Code to buy garbage from your online store.


It has bothered me that I didn’t include the most obvious response to the dangers of scanning a QR Code. Depending on the application you use – I use RedLaser – it tells you where you are going and asks if you want to go!

Here is a QR Code to http://A-Virus-And-Trojan.com  <—not a real website.


When I scan this QR Code, my app tells me exactly where I am going.

And there you have it. A few simple lines of code that prompt the user to   accept the redirect. Security risk averted.

QR Code Logging

16 Feb

Today someone hit my blog while searching for a way to log QR Code scans. I am going to give a very short explanation on how to do this. This is the simplest way I can think of.

Go to bit.ly.

Get a free account.

Shorten the URL for the page you want the QR Code to link to.

It will be added to your list of URLs. Click “Info Page+”.

The QR Code for your site is in the upper right hand corner. Save image as…

From now on, you can log on to bit.ly and go to the Info Page+ to find out how many scans you have had. Or just type the shortened url with a + after it.

That’s really all there is to it. You know a better way, let me know.

Hacking the City with QR Codes

15 Feb

I got the idea to connect a QR Code to a camera. But I needed something interesting. How about when you scan the code you see a picture of yourself?

I found a live camera from the KOB TV channel in Albuquerque. I extracted the feed from their page and wrote my own website to display their feed.

I then connected the QR Code to my page. I printed the code and laminated it with tape. I went to the location that the camera watches and placed the code on a post.

When you scan the code, you are taken to a website showing you standing at the corner looking at the code! Here I am looking like a fool on my phone.

That is me standing on the corner. Here is the QR Code. It is much more fun if you are at the location.

NOTE: The camera moves during the day. The codes work until about 2:00.

Link a QR Code to a Database

2 Feb

In an earlier post, I showed how to link a QR Code to a map by using PHP _GET. This allowed me to pass variables to a script and have the script run in realtime to update the page. I am going to do the same thing in this post, but the data I pass will be used in a SQL statement to retrieve data from the database.

I think this would be a great tool for a facility to use to inventory their equipment. Lets say I have a swamp cooler on the roof of my building — I live in New Mexico. I am on the roof and I need to know something about this particular unit. I can scan a QR Code on the side of the unit, it will then pull up a website that displays everything about this unit: The manufacturer, when it was installed, when it was last serviced, what was done to this unit during the last service, when it is beyond its useful life. On the same page, I could have a form that allows me to update the data. I can enter todays date  as the new last serviced date and put a description of what I did – changed the pad and oiled motor. The next time the code was scanned, this data would be available.

Since I have a room database from Revit already setup, I am going to show how to connect a QR Code to this database to retrieve the room properties. To modify this to work on any other object, just change the database connection.

I wrote a PHP script called get.php. This script selects all the data from a rooms table in a MySQL database where the room number is from the QR Code: SELECT * FROM rooms WHERE number = $_GET[roomchosen].

_GET[roomchosen] is the PHP call to pull the data from the URL that was sent via the QR Code. Here is he full code:

Now I just need a QR Code that has the URL to the script and sends the room number: http://room.educationalfacilityplanning.com/get.php?roomchosen=3. This URL will select room 3. I have 6 rooms in this database, so feel free to change the URL to any number 1-6. If you don’t know where to make a QR Code just google “QR Code Generator” or go to http://www.qrstuff.com/.

Here is my QR Code for room 3.


To link to any database, you can pass a part or a full SQL statement through a URL using PHP _GET. Assign your swamp cooler and id=12345. Create a QR Code with the url http://YourDomain.com/swampCoolerGet.php?id=12345. In your script have a statement:  SELECT * FROM swampcoolers WHERE id = $_GET[id].

Don’t forget to add a form for updating the data to make this perfect for facility management.


You are Here: Floor Plans, GIS, and QR Codes in the Building

18 Jan

I have started to see several negative posts about QR Codes. I like QR Codes. I have not, however,  seen many good uses of them – yet. I am going to show you how to use a QR Code on the room signage in your building to display a floor plan of the building in GIS with a “you are here” marker. Remember when I said architects should learn to code? This example will require a little PHP and Javascript. But do not turn away. It is VERY simple and I will provide the basic code. You just need to change a few parameters and viola! you will be up an running.

First, I am going to use Leaflet.js as my mapping engine. I am not using Google Maps because I prefer open source and when we get in to paying for Google, I am not having it. Yes, you do legally have to pay for Google when you meet certain requirements. Download and extract Leaflet to a folder on your web server.

Next, I will write the webpage to load my map. Almost all of this code is taken straight from the Leaflet.js examples section.

You will need a developer ID from Cloudmade — it’s free. The magic happens in the PHP that looks like this:

<?php echo $_GET[“lat”]; ?>, <?php echo $_GET[“long”]; ?>

This code allows me to pass data to the script in the URL of the page. The data is the coordinates of where you are standing when you scan the QR Code. So the URL for the page is http://educationalfacilityplanning.com/latlong.php?lat=XXX&long=XXX. The lat= and long = are variables called in the PHP.

Lastly, I will make the QR Codes using the URL of my page. I will grab the Latitude and Longitude of each room in the building and create a QR Code replacing the XXX shown in the URL in the previous paragraph.  My first QR Code will link to the URL: http://educationalfacilityplanning.com/latlong.php?lat=35.0967210997174&long=-106.635601453865

Here is the QR Code:

Generate a code for each room and you are done. In this example I have yet to put the floor plan on the map. There are several ways to do this, so I will leave it up to you to figure out. If you want to do it and need help, leave a comment and I will tell you how I have made it work.

UPDATE: Here is a map with Autocad in Leaflet.js. I used a WMS layer and connected to my geoserver.

To add a WMS Layer

var floorplan = new L.TileLayer.WMS(“http://localhost:8080/geoserver/cad/wms&#8221;, {
layers: ‘cad:AztecHighSchoolCAD’,
format: ‘image/png’,
transparent: true,
attribution: “Paul Crickard”



Any ideas on how to make this work with a 2 story building? Without having 3D GIS capabilities on my phone, my best idea so far is to create 2 base maps, one for the 1st floor and one for the 2nd. If you have a better idea, let me know. I would love to hear it.