Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial update ? #39

Closed
antoinespace opened this issue Nov 3, 2019 · 5 comments
Closed

Tutorial update ? #39

antoinespace opened this issue Nov 3, 2019 · 5 comments

Comments

@antoinespace
Copy link

Hello all!

Do you have news about the tutorial update?
I've been trying to install this system several times on a Raspberry Pi Zero but I can not do it and some elements of the tutorial do not match.
I am a beginner in programming and I have already learned many things with this project but here I am blocked.

Thanks
Antoine

@antoinespace
Copy link
Author

Hello :)
To explain a little my problem, here are all the commands that I put in Putty on my Raspberry Zero Pi.
After install Stretch Lite on the Pi Zero, updated, I pass this :

pi@raspberrypi:~ $ sudo apt-get install git
pi@raspberrypi:~ $ git clone https://github.com/DottoreTozzi/iSpindel-TCP-Server iSpindel-Srv
pi@raspberrypi:~ $ sudo apt-get install apache2 mysql-server mysql-client python-mysql.connector
pi@raspberrypi:~ $ sudo apt-get install phpmyadmin
pi@raspberrypi:~ $ sudo apt-get install samba samba-common-bin
pi@raspberrypi:~ $ sudo mysql -u root
MariaDB [(none)]>  CREATE DATABASE iSpindle;
MariaDB [(none)]> USE iSpindle;
MariaDB [iSpindle]> CREATE TABLE `Data` (
    -> `Timestamp` datetime NOT NULL,
    -> `Name` varchar(64) COLLATE ascii_bin NOT NULL,
    -> `ID` INT UNSIGNED NOT NULL,
    -> `Angle` double NOT NULL,
    -> `Temperature` double NOT NULL,
    -> `Battery` double NOT NULL,
    -> `ResetFlag` boolean,
    -> `Gravity` double NOT NULL DEFAULT 0,
    -> `UserToken` varchar(64) COLLATE ascii_bin,
    -> `Interval` int,
    -> `RSSI` int,
    -> `Recipe` varchar(64),
    -> PRIMARY KEY (`Timestamp`, `Name`, `ID`)
    -> )
    -> ENGINE=InnoDB DEFAULT CHARSET=ascii
    -> COLLATE=ascii_bin COMMENT='iSpindle Data';
MariaDB [iSpindle]> CREATE TABLE `Calibration` (
    ->     `ID` INT UNSIGNED NOT NULL,
    ->     `const1` double NOT NULL,
    ->     `const2` double NOT NULL,
    ->     `const3` double NOT NULL,
    ->     PRIMARY KEY (`ID`)
    -> )
    -> ENGINE=InnoDB DEFAULT CHARSET=ascii
    -> COLLATE=ascii_bin COMMENT='iSpindle Calibration Data';
MariaDB [iSpindle]> CREATE TABLE `Config` (
    -> `ID` int NOT NULL,
    -> `Interval` int NOT NULL,
    -> `Token` varchar(64) NOT NULL,
    -> `Polynomial` varchar(64) NOT NULL,
    ->         `Sent` boolean NOT NULL,
    -> PRIMARY KEY (`ID`)
    -> ) ENGINE=InnoDB DEFAULT CHARSET=ascii COLLATE=ascii_bin COMMENT='iSpindle Config Data';
MariaDB [iSpindle]> CREATE USER 'iSpindle' IDENTIFIED BY 'ohyeah';
MariaDB [iSpindle]> GRANT USAGE ON *.* TO 'iSpindle';
MariaDB [iSpindle]> GRANT ALL PRIVILEGES ON `iSpindle`.* TO 'iSpindle' WITH GRANT OPTION;
MariaDB [iSpindle]> QUIT;
pi@raspberrypi:~ $ sudo apt-get install samba samba-common-bin
#samba is already the newest version (2:4.5.16+dfsg-1+deb9u2).
pi@raspberrypi:~ $ cd /etc/samba
pi@raspberrypi:/etc/samba $ sudo nano smb.conf

Copy this at the end of the script :

[global] 
server string = RASPBIAN
guest ok = yes 
security = user
socket options = TCP_NODELAY SO_RCVBUF=65535 SO_SNDBUF=65535
registry shares = yes
syslog = 0
map to guest = bad user
workgroup = WORKGROUP
bind interfaces only = No
encrypt passwords = true
log level = 0
# smb ports = 445
unix extensions = No
wide links = yes

include = /etc/samba/user.conf
include = /etc/samba/shares.conf

pi@raspberrypi:/etc/samba $ sudo nano shares.conf


Copy this in a new doc :

[pi-home]
	path = /home/pi
	guest ok = yes
	read only = no
	force user = pi
	browseable = yes

[system-logs]
	path = /var/log
	guest ok = yes
	read only = yes
	force user = root
	browseable = yes

pi@raspberrypi:/etc/samba $ cd
pi@raspberrypi:~ $ sudo apt-get install insserv
pi@raspberrypi:~ $ sudo insserv smbd
pi@raspberrypi:~ $ sudo service smbd start
pi@raspberrypi:~ $ cd /home/pi/iSpindel-Srv
pi@raspberrypi:~/iSpindel-Srv $ sudo mv ./iSpindle.py /usr/local/bin
pi@raspberrypi:~/iSpindel-Srv $ sudo mv ./ispindle-srv /etc/init.d
pi@raspberrypi:~/iSpindel-Srv $ sudo chmod 755 /usr/local/bin/iSpindle.py
pi@raspberrypi:~/iSpindel-Srv $ sudo chmod 755 /etc/init.d/ispindle-srv
pi@raspberrypi:~/iSpindel-Srv $ cd /etc/init.d
pi@raspberrypi:/etc/init.d $ sudo systemctl daemon-reload
pi@raspberrypi:/etc/init.d $ sudo insserv ispindle-srv
pi@raspberrypi:/etc/init.d $ sudo service ispindle-srv start
pi@raspberrypi:/etc/init.d $ ps -ax | grep iSpindle
`17074 pts/0    S+     0:00 grep --color=auto iSpindle`
pi@raspberrypi:/etc/init.d $ cd
pi@raspberrypi:~ $ cd iSpindel-Srv

After all of this :
I can go to PhpMyAdmin, I see the databases of iSpindel but no information is caught.

My iSpindel is configured like this :
Service Type : TCP
Token : (nothing)
Server Address : 192.168.1.30 (address of my PiZero)
Server port : 9501

I didn't change the settings in iSpindle.py because the update seems to have changed that (but I don't have a "iSpindle_Config.ini" file in my config).

I feel that python is not doing the job because I should have a second line in the command "ps -ax | grep iSpindle"

Somebody see somthing wrong?
Thanks for help!

@vonfritz
Copy link
Contributor

Hi,
"iSpindle_Config.ini" or "iSpindle_default.ini" should be in:

~/iSpindel-Srv/config.

iSpindle.py looks first if "iSpindle_Config.ini" is present if not "iSpindle_default.ini" is used.

Then the creation of the database tables are outdated.
You don't need to create it manually. simply use the sql update scripts:

$ mysql -u root -p

MariaDB [(none)]> CREATE DATABASE iSpindle;
MariaDB [(none)]> CREATE USER 'iSpindle' IDENTIFIED BY 'ohyeah';
MariaDB [(none)]> GRANT USAGE ON . TO 'iSpindle';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON iSpindle.* TO 'iSpindle' WITH GRANT OPTION;
MariaDB [(none)]> quit;
$ mysql --user=iSpindle --password=ohyeah iSpindle < MySQL_CreateTables.sql
$ mysql --user=iSpindle --password=ohyeah iSpindle < MySQL_Update_1.sql
$ mysql --user=iSpindle --password=ohyeah iSpindle < MySQL_Update_2.sql
$ mysql --user=iSpindle --password=ohyeah iSpindle < MySQL_Update_3.sql
$ mysql --user=iSpindle --password=ohyeah iSpindle < MySQL_Update_4.sql
$ mysql --user=iSpindle --password=ohyeah iSpindle < MySQL_Update_5.sql
$ mysql --user=iSpindle --password=ohyeah iSpindle < MySQL_Update_6.sql

ciao

@antoinespace
Copy link
Author

Hello Vonfritz, thanks for your answer. It's works, I receive datas on PhpMyAdmin. But I want to enable the creation of a CSV file on the Raspberry. For information, I created a new document "iSpindel_Config.ini" with this informations :

[GENERAL]
DEBUG = 1
PORT = 9501
HOST = 0.0.0.0

[MYSQL]
SQL = 1
SQL_HOST = 127.0.0.1
SQL_DB = iSpindle
SQL_TABLE = Data
SQL_USER = iSpindle
SQL_PASSWORD = ohyeah
SQL_PORT = 3306

[CSV]
CSV = 1
OUTPATH = /home/pi/iSpindel/csv/
DELIMITER = ;
NEWLINE = \r\n
DATETIME = 1

I create the CSV's folder (pi@raspberrypi:~/iSpindel/csv $) but it's still empty.

Did I miss something?

@vonfritz
Copy link
Contributor

Yes,
"iSpindel_Config.ini" Should only contain DEBUG and MYSQL configuration values all other values are retrieved from the SQL database!
You can set the values via the settings page using a Web browser or with PhpMyAdmin writing directly to the Settings Table.

ciao

@antoinespace
Copy link
Author

Thanks Vonfritz, it's works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants