Pages Menu
TwitterRssFacebook
Categories Menu

Posted by on Aug 5, 2016 in News, Uncategorized | 0 comments

Pi QR Kid Up

Pi QR Kid Up

Files Needed

Workflow:

workflow

QR Code Generation:

Google Form -> Google Apps Script ->Email

 

The system itself is fairly complicated. Nearly all the processing is done by a Python web server. The database is a MS Access database since we assumed that there wouldn’t be many users trying to access the database at once and it was the easiest solution to go with.

 

First setting up the server:

IMPORTANT: DOWNLOAD THE FILES FOR YOUR CORRESPONDING ARCHITECTURE (x64 must download x64, x86 must download x86 programs)

First, download the attached ZIP file with all the code and extract the files into a folder on your computer.

You’ll need to download the following drivers from Microsoft so that you can use MS Access databases. https://www.microsoft.com/en-us/download/details.aspx?id=13255. (Download the version for your architecture!)

You’ll also need to install Python 3 here: https://www.python.org/downloads/

After you install it run the following line of code:

pip install pypyodbc

This installs the python libraries needed to run the code on your server.

Next, open an executable on your computer called “ODBC Data Sources”. Make sure that you open the one that corresponds to your architecture. Under the System DSN tab, add a new database with the default MS Access Driver. (If this driver is missing, check to make sure you did the last step correctly)

Make sure you set the Data Source Name to be “PickupDB” and select the db_be.accdb from the files you extracted. You can set the description to whatever you want. After you add it, try running the server through Python and go to localhost:9000/test to see if the page displays TEST. If not, check the errors for more information, then fix those before moving on.

 

Then, forward a port to your server computer’s local ip address and run the webserver python script under that port (option on top of the server.py file). Google “ip address” to get your public ip address.

ip address

To test out your server, open up your browser and go to:

http://your.public.ip.here:port/test

 

Again, it should say TEST.

 

The webserver is now set up, now it’s time to set up your pi. Download an operating system for your pi (we used NOOBS) and open up the terminal.

Type the command:

sudo apt-get install iceweasel

This will install firefox on your computer (Iceweasel is firefox for Raspberry Pi).

Plug in your USB webcam. Get the scanner code on your pi (we just used email) and open it using firefox.

 

If issues with webcam:

Run:

sudo apt-get install fswebcam

(During development, we were having trouble getting the webcam to work, so we tried to install different libraries to get it to work. We didn’t really end up using it, but it may have done something)

 

Finally, to have the google form generate and email QR codes, make a copy of this form:

https://docs.google.com/a/pingry.org/forms/d/1QpLDEb4Bq-JytbkUvn-fmV0VUXPltIM8e04bRaVEpCE/copy

And tell the form to store the responses in a spreadsheet.

In the spreadsheet, click tools -> script editor.

Paste in the attached code in the “GoogleSheetsCode” file and go to resources -> Current Project’s triggers and add a new trigger that runs the onFormSubmit function on form submit. You should be prompted to review permissions. Allow the script to do what it wants.

 

Final Steps:

In all files, replace “x.x.x.x:port” with your ip and port

 

It should be all set up!

Make sure the webserver stays running and that the pi doesn’t overheat and you should be fine.

 

In the top of the server.py file, there are a few options for you to configure timeout periods (in seconds) and ports.

 

Original Qr Scanner Github

Post a Reply

Your email address will not be published. Required fields are marked *