Use PHP and MySQL to control a machine that will retrieve parts so you no longer have to dig for that 330 ohm resistor!
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
StepperDriver-master.zipx-zip-compressed - 29.12 kB - 01/27/2018 at 02:52 |
|
|
cnc_part_picker_server.pyplain - 1.18 kB - 01/27/2018 at 02:52 |
|
|
cnc_part_picker_code2.inoino - 3.52 kB - 01/27/2018 at 02:52 |
|
|
cnc_part_picker_machine_sidev2.ncNetwork Common Data Form (NetCDF) - 6.21 kB - 01/27/2018 at 02:31 |
|
|
cnc_part_picker_machine_bed.ncNetwork Common Data Form (NetCDF) - 2.37 kB - 01/27/2018 at 02:31 |
|
The basis of this system is to keep track of inventory. For example, if someone buys 20 Arduino Uno boards they could easily add that amount to a database table. The category would be "Arduino", name of "Uno", and a quantity of 20. For multiple people, the owner of that part would be the username of the person who added it. The part would also include data about the it's location on a grid. Whenever the part amount changes the CNC machine would then select that part and give it to the user.
I needed a ubiquitous database that could be accessed by both Python and PHP. It also had to be easy to use with plenty of support, making MySQL the perfect database server. I began by downloading the mysql installer from https://dev.mysql.com/downloads/windows/installer/ and then ran it. I chose to install the server (of course), and also the workbench, shell, and utilities. When you choose a username and password make sure to remember it, as those same credentials are needed in all of the PHP files and the Python script. After starting the server enable it to run as a background process so it will always be active.
From here on in everything must be spelled and in the exact same order as I have it.
Next, create a new database (schema) called "components". Then add the following tables: "categories", "parts", and "users".
In the categories table add the following columns in this exact order: "id" -int(11), PK, AI; "name" -varchar(45); "owner" - varchar(45).
In the parts table add the following columns in this exact order: "id" -int(11), AI, PK; "category" -varchar(45); "name" -varchar(45); "quantity" -int(11); "owner" -varchar(45); "locationX" -int(11); "locationY" -int(11);
In the users table add the following columns in this exact order: "id" -int(11), AI, PK; "username" -varchar(45); "password" -varchar(128);
The webpages I have created utilize HTML, CSS, Javascript, and PHP. Start by downloading the latest apache version from http://www.apachelounge.com/download/ and unzip it, moving the folder to the C:\ directory. Next, download PHP from http://windows.php.net/download#php-7.2 and make sure it is the Thread Safe version. Unzip it, rename it to "PHP", and move it to the C:\ directory. Then go into C:\Apache24\conf\httpd.conf and edit it. Add the following lines right below the <IfModule headers_module>
section:
LoadModule php7_module C:/PHP/php7apache2_4.dll <IfModule php7_module> DirectoryIndex index.html index.php AddHandler application/x-httpd-php .php PHPIniDir "C:/PHP" </IfModule>
Then test your server by running httpd.exe located in the bin folder. Head to "localhost/" in your browser and see if the hello world page comes up. If it does, hurray, you now have a local webserver.
Create an account to leave a comment. Already have an account? Log In.
Become a member to follow this project and never miss any updates
One of the core services offered by PTI Digital is web design and development. https://optidigital.ca/