Harmony Clean Flat Responsive WordPress Blog Theme

connecting mysql, mobius, thyme, and Tas

오후 8:00 Unknown 0 Comments Category :

Hi guys. It's so long time for posting. For this time, I am gonna show you how to connect mysql, mobius, Thyme, and Tas. The definition and funtion for each of them is shown in the guidebook on www.iotocean.org. you guys need to download mysql installer, mobius, thyme, tas, and nodejs. I will show you everything how to download them. For this time, I used mobius-yt-2.1.2 and Thyme 1.6.5. Please download them in advance.

1. mysql.
go to mysql website and click the MySQL Community Server.


If you click it, you can see "MySQL Community Server 5.6. If you find it, click it.

I recommend to use 5.6 version because the guidebook also recommend to use it. Download the installer MSI.

When you finish to download it, let's install mysql then. Just follow what I did.
Choose custom option to install what we need.



























Set your password for database.


And then just click next and excute. When you finish to install mysql, you can see this one.


Next thing you need to do for database is importing mobius table to database.
Let's go to mysql database and then you can see this one.


On the left side, there are MANAGEMENT, INSTANCE, PERFORMANCE, AND SCHEMAS. In order to import mobius, we need to make another table in Schemas. If you right click in the Schemas section, you can see "create Schemas".


In the mobius configuration, the default name for database is 'mobiusdb'. So name mobiusdb for this table and click apply. If you are done, you can see mobiusdb table and set it as a default schema.

































Now, let's import mobius sql file to database.
click 'server->dataimport' and then you can see this one.

In order to import mobiusdb sql file, click 'Import from Self-Contained File' and search mobius sql file in you computer(you need to download this file in iotocean webpage).
Next, you need to select the 'Default Target Schema. Of course, our default target is mobius db so choose it and click start import.

















When the importing is done and refresh schemas, you can see mobiusdb table.

Now, the database is ready for everything. Then, Let's connect database and mobius. In order to connect them, you need to use Node.js. It is easy to install it. So if you don't have it, please download and install it.

If you download mobius zip file and unzip it, there are some directories, a JSON, and 3 node.js files. In order to connect mobius to database, you need to set password to let mobius log in to database.



This is mobius.js file and you can see 'global.usedpass' which is your mysql database password. Put the password there and save it.
When you finish save it, implement command window and go to mobius directory.




If you see this one, mobius and mysql are connected each other.



If you follow to this step, now you are going to use raspberry pi3. Before handling Thyme, I will show you how to control rasbian in your PC. We need to install samba, xdrp, nodejs, tightvncserver.
For the first step, type 'sudo apt-get update' and 'sudo apt-get upgrade' to upgrade your raspbian.
In order to install nodejs, we need to remove current installed nodejs in raspbian. follow this one.


After that, let's download nodejs 4.x version. Type 'curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -'. I recommand to download 4.x version but if you wanna download 6.x version, just type 6.x instead of 4.x. When the downloading is down, you can see this one.
Just following what it said. Type 'sudo apt-get install nodejs' to install nodejs. And then, type 'sudo atp-get install tightvncserver', 'sudo apt-get install xrdp'.
If you use window OS, there is a 'remote desktop'program. You can control your raspberry pi by using this program.

Samba helps you to upload and download files easily. What you need to do for move file from PC to raspberry pi, just drag a file from PC to raspberry pi. That's all. In order to download it, type 'sudo pat-get install samba samba-common-bin'. Now, you need to set a password for samba.










Type 'sudo sambpasswd -a pi' and set the password and type 'sudo nano/etc/sanba/smb/conf' to configure user(pi)'s options. when you open smb.conf, go to the end of text and put this one.


Now, All done for Thyme and tas. Then. let's move Thyme and TAS files from PC to raspberry pi. I will make a directory in raspberrypi for them.

Let's use samba to move them. Open any directory in window and type '\\raspberry pi's address'. my raspberry pi's address is 192.168.0.23 so I will type \\192.168.0.23



You can see a pi directory and when you double click it, it ask you to put user name and password. You already set them so you should know them. When you log in raspberry pi, you can see many directories. The only things you need to do is copy and paste Thyme directory from PC to raspberry pi.
There is a conf.JSON file in thyme folder. Open it and change 'cbhost' to your database address(which is your PC address).

If you excute mobius in your PC and Thyme in your raspberry pi, this messages should be shewn up.




Then, just Follow what it need, go to conf.json again and change AE-ID to another one started with S or C.

If you set them perfectly and re-execute mobius and thyme, you can see this command line in your PC and raspberry pi.

mobius

Thyme
There is a message that "TCP SErver for TAS is listening on port 7622" meant that now this thyme is waiting for TAS.

Finally, only TAS is left. if you unzip TAS, you can see conf.xml file. You need to edit this file. 
This is default value in the conf.xml file and we need to upload some message to thyme.
If you see the app.js file in TAS, it ask you upload's Id and ctname. So we need to make upload's ctname and id in conf.xml file. and this ctname must be matched with cnt's name in conf.json in thyme. like this.





In these conf files(left one is Thyme and the other is TAS), both ctnames are matched. Moreover, app.js in TAS ask you the upload's id. there are 'If' phrase that 'if(upload.id == timer) which let you upload data to Thyme if this if phrase is satisfied. That's why I set id as timer.

If you set everything, Let's execute mobius, thyme, and TAS.


As you can see, TAS send message to Thyme, and Thyme send answer to TAS.


In the mobius terminal, you can see mobius can get date from thyme correctly.



This my MySQL database which received data from mobius and you can see these data in cin in database's table

Thank you for reading and when you have some question, please email me.


RELATED POSTS

0 개의 댓글