Arduino and AI (Artificial Intelligence) Even you can program it

What is “A.I” and how can it be explained to the average Joe?

“A.I” (Artificial Intelligence) can be explained pretty simply, it starts with a few programming languages. Really thoe, all these languages basically work the same way, for example AIML, HTACCESS, XML, and CSS can be described as “meta languages” in the sense that they all store information about information.

So what languages and what electronics do we use to make things respond to our comments?

How can we call a mechanized truck, or tell our blinds to shut, or even turn on or off the outdoor lights by speaking to a smart phone from the office?

The answer is:

AIML, PHP (or server side language of choice), MySql (or SQL), and Arduino, this item and those languages (explained below) makes up “Interactive Artificial Intelligence”.

Before we begin I’d like to reassure anyone starting out with programming, the syntax changes a little from language to language but really isn’t that hard to learn. For you to read this and understand this you have to know and process many words and characters, programming only requires that you remember a few statements opposed to a few hundred.

So to begin, lets start with them “Brains”….

The Brains:
Basically your computer is an “AI” device, the “UI” (User Interface) in a “Windows operating system” known as “Explorer” (not be confused with “I-Explorer) works with a compiler to read information, and write information to a Database known as the “Registry”,
The Windows Registry or database can be viewed and edited by calling “regedit” in the “dos-prompt” under the command prompt.
The user “registry” has a nice “UI” for those of you who don’t like “shells”.
With Windows each user has a registry with a “UI” but only administrators can make system wide changes, this is because the other registries are “Database Tables’ opposed to the actual database.

For those of you who are unfamiliar with programming I would like to introduce you to “.xml” format.
XML is a “markup-language” that provides “Meta-Data” to programs. Meta-Data is basically just information about information, so what does that mean?
In the case of “Joomla” an open source “CMS” (Content Management System) if a developer decided to make a template, he or she will make an .xml file, the file is used for the installation of the template, and is important because it tells the server side scripting language in this case “PHP” what the contents of the template are.

The .xml file contains a list of the “Images”, “Documents”, “files”, and “folders” associated with the template, this provides “information about information” and no install will happen without it, in fact many programs work this way.

AIML is short for “Artificial Intelligence Markup Language” and is very simple to understand, remember for you to understand what I have wrote here you have to remember characters in the form of letters and have understanding of the vocabulary used, so how many words have I used here for you to remember? I ask you to note that because the AIML syntax only has a few tags for you to remember opposed to a couple hundred and only a few terms to remember opposed to a few thousand. In other words….. You can do this!!

I recently downloaded a program from “Labsmedia” and installed it on a “WAMP” (Windows Apache Mysql PHP) server setup, this little CMS has a very cool editor that lets you add information to your AI character, it works by taking information you enter including questions and answers and storing it in an xml file and database. When a person enters a question into a field at a later time the response will be any variation of the responses you programmed into it using the editor.

An alternative to installing a WAMP and the “labsmedia” cms is to use a website called “Pandora Bot” this is a much easier approach however if you ever want to use this AI with your Micro-Processor (Arduino) then stick with the hard rout and install everything, besides I find it better to understand things from the ground up..

I say that because it’s a very realist possibility to have your Artificial Intelligence User Interface to have Arduino change the environment around you, for example you may want to ask your “AIUI” to open or close the garage door.

How does AI or AIML, PHP, and MySql work with Arduino?

We now know that AIML is an XML file with some extra tags, we know that PHP is a server side language, we understand that MySql is the brain or memory, and we have an Arduino PCB that plugs into the USB.

We need to know how PHP communicates with the Database and the USB port.
Once you have a good understanding of how PHP interacts with these two things we can now concentrate on how the Arduino works, keep in mind that binary code “0,1,0,1,1” acts as a switch, each data-bit sent in the packet from the AIML/ PHP to the Arduino threw the USB turns things on or off.
So the PHP file will not only have MySql variables defined but will call the USB port and send a data-packet to the Arduino based on information entered from the user.

So for example lets say we are using one sensor and one relay to brew or check coffee, we can ask the AI bot if coffee is brewed and the Bot will read packets sent from the sensor and respond either yes or no depending on the reading, or, we can ask the bot to brew coffee and that key word “Brew” will send a packet to the USB to switch the relay on, and then draw the response from the brain and give you a response like “the coffee is being brewed”.

A few links related to this post: (How to program Arduino)