Implementing a Raspberry Pi into a small business

Abstract:

Technology has become a complex beast for businesses to handle in the modern age. Especially small businesses that rely on technology for their daily workday. Businesses tend to think that complex systems are better than a simple solution. That is not always the case; often simple solutions can cut costs and produce benefits. A great example of this would be a Raspberry Pi computer. Utilizing a Raspberry Pi as a database and web server for a small business is a simple solution that has greater benefits than trying to run a complex solution where other companies are required to provide a service. Such benefits include the low cost of operation, control, and security of business information.

To be able to build a Raspberry Pi capable of this task will require a LAMP (Linux, Apache, MySQL, PHP) software stack. Once configured to the specific business needs the outcome will be a fully functioning web server graphical user interface (GUI) that will be connected on the back end to a MySQL database.

 

 

 The Project

As technology evolves, businesses continue looking for new ways to provide benefits at cheaper costs. Small businesses typically have a major disadvantage compared to corporations because of their lack of capital to invest in new technology. If a small business needs to have an operating database or server, they could be looking at spending thousands of dollars, if not more, to pay for a service company to create and support their database.

The Raspberry Pi computer could eliminate the need for an outside company, and in doing so could help a business to save on expenses. In recent years, the security of some of the world’s biggest companies has been breached. In this new era of business, a major concern is the security of the company’s information, as well as the customer’s information. For small businesses, this is especially complicated, because unlike major corporations, they don’t have the same resources to fight or fix any security issues. Thinking in these terms, running a Raspberry Pi is a great way to ensure that the company is secure because it holds all of its information on site.

*The small business that will be the focus of this project is a local lacrosse equipment store in a typical suburban town. This business is looking to get away from paper files, files that include information on employees, customers, and products. They would like everything to be in one place in order to reduce time spent searching for documents. Previously, They have looked into buying cloud-based databases as well as storage services from a corporate company, but the expenses are too high for the business to absorb.*

What is a Raspberry Pi Computer?

A Raspberry Pi computer is a single-board computer that is about the size of a deck of playing cards. Inside this small board is everything necessary for a computer, even including an HDMI port for display and USB ports for peripherals. There are many benefits to using a Pi computer instead of just an ordinary desktop. First, Raspberry Pi computers are very inexpensive; prices range from five to thirty-five dollars. Various attachments and configurations, though not needed, can be purchased for additional costs. For this project, the basics of the Raspberry Pi 2 model B, and a case for the card were used. This put us at a total cost of approximately forty dollars. Raspberry Pi computers are often programmed to run autonomous programs; here we will be using software to turn the Pi into a small database and web server.

The objective of the Project:

The objective of this project is to provide a new cost-efficient way for smaller businesses to manage their own databases while still having complete control. The Raspberry Pi will be a headless unit that is able to run a database and can be accessed by any computer on the network. There will also be a web server connected to the database through a local website, making it simpler to use. This will allow employees with no knowledge of SQL to easily add, delete, or search the database.

Scope and Limitations:

Scope:

The Raspberry Pi computer is designed to benefit smaller businesses by fulfilling the roles of both a database and a web server. It is great for a business that wants a low overhead, or one that is low on space. A larger company could also use Raspberry Pi computers, as each one could be designed for a small project, and then connected with others. For this specific project, a low cost and secure device is a perfect fit for the business.

Limitations:

A business would need an employee that knows how to set up the device, and knows MySQL language. Or, a contractor would need to be hired to come in and set up the system. The major limitation of using a Pi computer is that the processing power is lower than that of a normal computer. This means that the database cannot handle a lot of people using it at the same time. User overload could become problematic.

Requirements:

• At least an 8GB SD card (can be larger)

• Raspberry Pi 2 B Computer

• A case for the Pi (Not Required but highly recommended)

• USB WiFi stick or an Ethernet connection

Software:

Operating System: Raspbian (Kernel version 4.4)

Database Software: MySQL (Version 5.5)

Server Software: Apache (Version 2.4)

PHP (Version 5.6)

 

Hardware:

 

Raspberry Pi: Raspberry Pi 2 Model B

Pi Case: Raspberry Pi Case (Black) fits Raspberry Pi 3, 2 and B+

Wi-Fi USB adapter: CanaKit Raspberry Pi WiFi Wireless Adapter / Dongle (802.11 n/g/b 150 Mbps)

SD Card: Lexar microSDHC 16GB

 

The Raspberry Pi was built using a 16GB SD card; you can upgrade all the way up to a 64 GB, but for this build a 16GB was sufficient. The first task was to install an operating system on the SD card. In order to do this, the SD card was plugged into the SD reader on my Mac. Then the operating system (OS) Raspbian was installed. Raspbian is similar to most Linux operating systems but is specific to Raspberry Pi.

Once the OS was installed on the SD card, it was then plugged into the Pi and turned on. Once turned on, it was time to install updates in order to ensure that software running was the newest version.

Since this Pi will be running off WiFi, you will need to manually change the network configuration files to allow this. At this time,  it would be best to give the Pi a static IP address, so that anytime it is restarted, it would still be found under the same IP.

The last thing physically done at the Pi when connected to a monitor and keyboard was to enable SSH. Once enabled, I could then continue building the project from any computer on the same network.

Database Design:

Raspberry Pi MySQL Database Example

 

• An admin table only non-connected table used to login to the web server to make changes to the database.
• The employee table is connected to transaction with Employee_ID.
• Customer is connected to Transaction with Customer_ID.
• Product is connected to both Transaction and Supplier by Product_ID.

 

Building the database using MySQL.

First, the structure of the database was built, including the tables that were going to be used. Then deciding on the primary keys and foreign keys, which allow the tables to be connected and have relations with each other. Lastly, the database was filled with data in order to do some testing, checking to make sure that everything was working in the correct way. Testing was conducted by running queries and making sure that the information that came back was as expected and that the primary and foreign keys were working properly.

After building the database

It’s time to build a web server that would have the MySQL database incorporated into it and could run from the Raspberry Pi. The server will be running Apache server and will be using both HTML and PHP code. The server will also be secured by having employees log in with their given username and password.

Prototype

The finished prototype is a functioning server that will house the company’s database and the web GUI used to access and edit the database. The Pi will already have a LAMP stack installed. The actual physical product will be a simple Raspberry Pi card, housed in a case for safety. Attached to the device will be either an Ethernet cord or a WiFi USB adapter, depending on what works best in the specific environment. The device will then have a micro USB power cord connected.

Implementation Plan

The first step to actually implementing the device is to gather information beforehand. I want to find out if the device will be connected with Ethernet or WIFI; if WIFI is chosen, then we must change the networking configuration and will need a USB WIFI adapter
Once the hardware is all set we can move on to the software necessary. On the Raspberry Pi should be a LAMP stack already installed and ready to begin. We will need to make some changes to the Apache configuration files to make sure the web server works correctly. We will need to set the IP address and create the root user.

Next, create the MySQL database structure that will be used and then connected when we are finished to the local web server. First, we log into MySQL through our terminal as the root user, and then we need to make the database, which for this project will be named Capstone. Now we will build our database structure and relations that we will be able to populate with data through the web server. The tables that we will create are Employee, Customer, Supplier, Product, Transaction, and admin. The admin table will be where we create users that can interact with the database by logging into the web page.

Once the database structure is all set we can move onto creating the local web page that employees can log into from any computer or device while on the same network. We will start by making a directory that will house the files that will become our web page. Within this directory, there will be subdirectories for each table and an option to search, insert, or delete from the database. We will also need to create files that connect us to the database and a way to secure the site by utilizing an employee’s login page.

 

Recommendation:

After completing the project, you can see how a Raspberry Pi can successfully be implemented in a business setting. Doing so can benefit a business in ways that the typical route of paying a company for a service can’t. The biggest benefit is the affordability of the Pi device.

If you had gone with a professional service, your information would more than likely be stored in a cloud setting. Information in a cloud storage setting has already had a history of being breached. My recommendation for other businesses is that this type of device is more suited for a smaller company. One that might not have the room and overhead to run another type of local server. I would look into how many employees would actually be accessing the device at once. How much processing power and storage your business would need.  A bigger company could also go this route by running multiple Pi devices as almost a small supercomputer.

Terry

Tech Enthusiast with a passion for teaching others new technology.

Leave a Reply

%d bloggers like this: