Community Question

EDIT:
*************THIS PROJECT HAS BEEN ADDED TO EZ-AI******************


This has been updated to include the latest information about this tool.

EZ-DB is a utility that will allow EZ-Builder to store and retrieve data from a database. The current databases that are supported are MySQL and MSSQL. EZ-DB can be downloaded from this site.

EZ-DB Pre-Release

The location that you place the folder doesn't matter, as long as you can connect to your EZ-Builder application. Unzip the contents of the zip file (the EZ-DB folder) to any location that you would like to have as the applications home. I haven't tested yet to see if this can run on a different computer by using the EZBuilderIP setting in the config file.

CONFIGURING THE APPLICATION

The EZ-DB.exe.config file contains the configuration settings for this application. I have stored a copy of this file in the Backup folder for you, if you make a mistake and need to recover a working version.

This is the contents of this file. As you can see, you should be running .net 4.5. Going down the list under the <appSettings> section you will see the following

Code:


<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<startup>

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />

</startup>

<appSettings>

<add key="Server" value="localhost"/>

<add key="UserName" value="Robot"/>

<add key="Password" value="3Z-R0b0t"/>

<add key="Database" value="robot"/>

<add key="DBServerType" value="MSSQL"/>

<!--add key="DBServerType" value="MySQL"/-->

<add key="TableName" value="Variables"/>

<add key ="EZBuilderPort" value="6666"/>

<add key ="EZBuilderIP" value="127.0.0.1"/>

</appSettings>

</configuration>



Server - Name of the machine housing your database (localhost works if it is on the same computer)

UserName - The user name specified within your database server that has permissions to insert/update and read from the database. If you are going to use stored procedures, they will also need rights to execute the stored procs. Many people will just give this user DBO permissions over this database.

Password - The password for the specified user within your database server.

Database - The database that you will be storing to and querying data from.

DBServerType - There is one for MSSQL and one that is initially commented out for MySQL. Uncomment one and comment out the other. This is done by including the !-- before and -- after the xml element, but within the element starting and ending brackets. Example... <!--ALL OF THIS WILL BE COMMENTED OUT-->

TableName - This is the name of the table that you want to store your data in. Retrieval can be from anywhere on the database server, or using linked servers or replication could come from multiple servers.

EZBuilderPort - The port that the robot you are wanting to have communicate with the database is running on. This is not 23 or 24, but the port TCP port setting. See image below. If multiple robots are running, one of these will handle the database traffic for all robots for one machine.

EZBuilderIP - The IP address of the computer that EZ-Builder is running on.

After updating the EZ-DB.exe.Config file, save it and you will be ready to go from the application side.

USING WITH EZ-BUILDER

Some parameters have to be setup for this communication to work.

I add this to my initialization script to set these

Code:


#Starting variables for EZ-DB

$SqlReturn = ""

$SqlCommand = ""



To call the app and store data in the database, you would use a script component like this

Code:


Exec("C:\EZ-DB\EZ-DB.exe","$tempC Out Wall-E")


This will call the EZ-DB.exe application and pass some parameters to it.

The first parameter is the parameter that you want to store the value of. In this example, I am storing the $tempC variable from the EZ-Builder application into my database.

The second parameter must be In or Out. Notice the first letter is capitalized. Right now, it must be capitalized so it literally must be either In or Out. This is from the perspective of Ez-Builder. Are you passing something In to Ez-Builder or passing something Out of Ez-Builder? In this case, I am passing the variable Out to be stored in the database.

The third variable is the name of your robot. This will also be stored so that if you have multiple robots storing data in the same table, you will be able to identify which one sent the data.

To call the app to retrieve data from the database, you will need to first store your query in the
$SqlCommand variable and then call the application, passing in three parameters.

Code:


$SqlCommand = "SELECT AVG{CONVERT{INT,VariableValue}} FROM Variables WHERE VariableName = '$tempC' and RobotName = 'Wall-E' and DateEntered > CONVERT{VARCHAR{10},GETDATE{},101}"

EXEC("C:\EZ-DB\EZ-DB.exe", "$SqlCommand In Wall-E")


If you are familiar with any SQL language, you will realize that all of the ( have been replaced with { and all of the ) has been replaced with }. This is because you're variable in EZ-Builder would not be able to be set because of issues with having ( or ) inside of a variable value. EZ-DB converts { to ( and } to ) before the query is executed.

The result of the query will be passed back to the $SqlReturn variable in EZ-Builder. This can then be used to do whatever you want to do with it in EZ-Builder.

I have included a EZB project called EZ-DBExample.ezb in this folder. It might be helpful.

My email address is D.Cochran@CochranRobotics.com. If you have any questions, please let me know.



I will be adding more output data data to display information about what is going on with the app in the ez-builder panel. Messages like "connecting to database", "Getting Data", "Returning data to EZ-Builder" and stuff like that. I will probably make a configuration setting to enable or disable these messages.

I would appreciate more ideas or features that you might have.
User-inserted image

CochranRobotics
Commented July 2014
Bug fixed. Let me know if you would be interested in testing. I will do the email thing to help you get it setup.
CochranRobotics
Commented January 2015
EZ-DB has been replaced by EZ-DBMulti. There are some changes, but I think it is simpler to use. I will post the source code for it when I am finished with my current project and have it tested pretty well.

Current project uses EZ-Face to recognize the user of the robot if they are in the catalog of recognized users, and then searches the database using EZ-DBMulti for information about that user. Then in the interaction of the user with the robot, the robot does things like checking to see if it is the users birthday. If so, it wishes them a happy birthday.

So far, tests are good. I dont know other things that it will store in the database yet. maybe the last time that a nursery rhyme was told to a user and limit its retelling of the same rhyme based on the previous tells to that person, or something like that.

This robot is a Teddy Ruxpin that is being setup for my granddaughter. It will be used as a building platform for my inmoov to try to give it some "intelligence". A lot of the same things that I want to accomplish with the Ruxpin will be building blocks for the inmoov. Anyway, I will post on this topic again when I have had more time to test through this project.
Morbeious
Commented January 2015
Nice, have you thought about connecting it to Jarvis (link) project? for a AI
Jarvis
CochranRobotics
Commented January 2015
There are a few services out there that I am looking at. Jarvis is one, Google has one, IBM has one. There are a few others. I am waiting for something to pan out more with them.

My son is doing a project with with a company that shall remain unnamed right now Voice Recognition and database/data cube querying for responses to questions. Its one of the large ones, but the project is just starting. I may be testing some of his code when it gets to that point :)

My granddaughter is only 1 and barely speaking right now, so I want to use this as a method of teaching through repetition. Things like "Your birthday is..." or "You are now x years old" and things like that. Its more about her specifically but she will have a younger brother in the next few month, so I decided to go ahead and make it database driven so that it could be used by more than one user without rewriting a lot of stuff.

Fun possibilities all the way around. Also, I help an Elementary school with Robotics. It is a really cool way to show what is possible. Having the Teddy put with a very young group of kids and it being able to interact with them differently based on who it is would be the ultimate goal.
WayneA
Commented February 2015
@d.cochran Quick Question First please, which is better MSSQL or MySQL? I googled both, you got to pay for MSSQL and MySQL is free.

Thanks
CochranRobotics
Commented February 2015
Mssql express is free also. Currently ezdb only supports mssql and mssql express because I had to push one of them forward. I will be making ezdb work again with my sql but it's going to be a bit. There is a lot to add in the way of table design and stored procs.

If you download sql express I would also download sql management tools. It will give you a tool for making changes to the database.
Question
AvatarCochranRobotics
Asked on Tuesday, July 1, 2014