CREATE YOURSELF A TELEPRESENCE SISTEM HOMEMADE.

Welcome to walkeremote portal. Sign Up to create your pilot station for telepresence system with use of Raspberry, actionoiseboards, old notebook or mobile phone for recycle it.
For Actionoiseboard Hardware and general Tutorials: HERE
Below Last script updated.


Use of pilot station with notebook keyboard:


arrow keys for direction, k=nord,l=sud
p=Gohead,x=stop.
Back to CommandPage from DBLIST menu' and press
the Select Blue Button.

Reboot from pilot.station:
write the number 888 in first
arrow form and click red button send,immediatley
need to change the parameter for avoid the
continous reboot of remote machine.

One among many web site
To create new Database account for free and on line is:
https://www.freesqldatabase.com/
after registration an email with data
will be received,copy and paste the credentials received to form in ADD DB menu button)
Form to field: Hostname, dbuser, dbpassword, my_db.


Example of python code
to read database's values


#copy and paste this code in a file py with name Neww.py

import stop                #file stop.py necessary in the same folder of Neww.py    
import pymysql.cursors       #stop.py file coming soon
import RPi.GPIO as GPIO
import time
import subprocess
from threading import Timer
from RpiMotorLib import RpiMotorLib   #stepper motor library
   
GPIO.setmode(GPIO.BCM)
nord=[21,20,16,12]
sud=[12,16,20,21]
obstacle=0
mymotor=RpiMotorLib.BYJMotor('MyMotorOne','28BYJ')  #Stepper Motor
GPIO.setup(21,GPIO.OUT)
GPIO.setup(20,GPIO.OUT)   #GPIO Pins connected to driver L298n
GPIO.setup(16,GPIO.OUT)
GPIO.setup(12,GPIO.OUT)
GPIO.setup(17,GPIO.OUT)   
GPIO.setup(22,GPIO.OUT)   #GPIO Pins connected to driver L298n
GPIO.setup(23,GPIO.OUT)   #GPIO connected to driver L298n
GPIO.setup(24,GPIO.OUT)   #GPIO connected to driver L298n
GPIO.setup(5,GPIO.OUT)    #GPIO connected to driver L298n
GPIO.output(17,GPIO.HIGH) #relay connected with a bc337 transistor for deactivate the motor driver during the boot
#stepper motors

#date of access to  database
db=pymysql.connect(host="",port=3306,user="",password="",db="",charset="utf8mb4") 
cursor=db.cursor()
sql="SELECT comandi FROM pilotino" #table and row
cur=cursor.execute(sql)
result=cursor.fetchone()


GoHeadTime="SELECT gohead from MotionTime"
time1=cursor.execute(GoHeadTime)
result1=cursor.fetchone()

GoBottomTime="SELECT gobottom from MotionTime"
time2=cursor.execute(GoBottomTime)
result2=cursor.fetchone()

GoRight="SELECT goright from MotionTime"
time3=cursor.execute(GoRight)
result3=cursor.fetchone()

GoLeft="SELECT goleft from MotionTime"
time4=cursor.execute(GoLeft)
result4=cursor.fetchone()

Gorallent="SELECT goralle from MotionTime"
time5=cursor.execute(Gorallent)
result5=cursor.fetchone()



for a in result1:
           print(a)
           
      
for b in result2:
           print(b)
         
         
for d in result3:
          print(d)
          
          
for c in result4:
          print(c)
         
for e in result5:
          print(e)



   
def check():
    if(cur > 0):
         for x in result:
             if(x=="h"):
                    print("right")
                    GPIO.output(22,GPIO.LOW)  #right
                    GPIO.output(23,GPIO.HIGH)
                    GPIO.output(24,GPIO.HIGH)
                    GPIO.output(5,GPIO.LOW)
                    time.sleep(float(d))           
                    GPIO.output(22,GPIO.LOW)
                    GPIO.output(23,GPIO.LOW)
                    GPIO.output(24,GPIO.LOW)
                    GPIO.output(5,GPIO.LOW)
                    via()
                    #Timer(5, via).start()
                    
             if(x=='nord'):
                  print('nord')
                  mymotor.motor_run(sud, .1/50,30,False,False,'half', .100)
                  via()
             
             
             
             if(x=='sud'):
                  print('sud')
                  mymotor.motor_run(nord, .1/50,30,False,False,'half', .100)
                  via()
                              
                    
             if(x=="g"):
                    print("left")
                    GPIO.output(22,GPIO.HIGH)  #left
                    GPIO.output(23,GPIO.LOW)
                    GPIO.output(24,GPIO.LOW)
                    GPIO.output(5,GPIO.HIGH)
                    time.sleep(float(c))
                    GPIO.output(22,GPIO.LOW)
                    GPIO.output(23,GPIO.LOW)
                    GPIO.output(24,GPIO.LOW)
                    GPIO.output(5,GPIO.LOW)
                    via()
              
              
             #if(x=="s"):
                    #print("stop")
                    #GPIO.output(22,GPIO.LOW)   #stop
                    #GPIO.output(23,GPIO.LOW)
                    #GPIO.output(24,GPIO.LOW)
                    #GPIO.output(5,GPIO.LOW)
                    #via()
                    #Timer(0.50, via).start() 
              
              
              
             if(x=="b"):
                    print("bottom")
                    GPIO.output(22,GPIO.HIGH)  #bottom
                    GPIO.output(23,GPIO.LOW)
                    GPIO.output(24,GPIO.HIGH)
                    GPIO.output(5,GPIO.LOW)
                    time.sleep(float(b))
                    GPIO.output(22,GPIO.LOW)
                    GPIO.output(23,GPIO.LOW)
                    GPIO.output(24,GPIO.LOW)
                    GPIO.output(5,GPIO.LOW)
                    via()
              
             if(x=="ra"):
                    print("GoRallent")
                    GPIO.output(22,GPIO.LOW)  #Gorallent
                    GPIO.output(23,GPIO.HIGH)
                    GPIO.output(24,GPIO.LOW)
                    GPIO.output(5,GPIO.HIGH)
                    time.sleep(float(e))
                    GPIO.output(22,GPIO.LOW)
                    GPIO.output(23,GPIO.LOW)
                    GPIO.output(24,GPIO.LOW)
                    GPIO.output(5,GPIO.LOW)
                    via()
                   
                   
                    
                    
             if(x=="y"):
                    
                    print("go no obstacle")
                    GPIO.output(22,GPIO.LOW)  #go straight.
                    GPIO.output(23,GPIO.HIGH)
                    GPIO.output(24,GPIO.LOW)
                    GPIO.output(5,GPIO.HIGH)
                    time.sleep(float(a))
                    GPIO.output(22,GPIO.LOW)
                    GPIO.output(23,GPIO.LOW)
                    GPIO.output(24,GPIO.LOW)
                    GPIO.output(5,GPIO.LOW)
                    via()
            
                    
                    
                    
                                          
                                        
                    
    if(cur==0): 
          print("no command inserted")
          quit()
     
    via()    
           
def via():
    canc="delete from pilotino"
    cursor.execute(canc)
    db.commit()
    quit()         



if(a=='888'):
    subprocess.Popen(['sudo','reboot','-h','now'])

  

check()

  
    

#obstacle sensor detect
#copy and paste this code in a file py with name stop.py
import subprocess
import pymysql.cursors
import Neww             #put in the same folder the python script Neww.py
import RPi.GPIO as GPIO
from Bluetin_Echo import Echo    #library for obstacle sensor
GPIO.setwarnings(False)
TRIGGER_PIN = 15
ECHO_PIN = 14
speed_of_sound = 250
echo = Echo(TRIGGER_PIN, ECHO_PIN, speed_of_sound)
samples = 10
resu = echo.read('cm', samples)
# Print result.
obstacle=0
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
db=pymysql.connect(host="",port=3306,user="",password="",db="",charset="utf8mb4") 
cursor=db.cursor()
sql="SELECT comandi FROM pilotino" #table and row
cur=cursor.execute(sql)
result=cursor.fetchone()

GPIO.setup(22,GPIO.OUT)   #GPIO Pins connected to driver L298n
GPIO.setup(23,GPIO.OUT)
GPIO.setup(24,GPIO.OUT)
GPIO.setup(5,GPIO.OUT)
                     
         
if (resu < 40):    # 40 is the value of distance sensor before to interrupt the motors loop can change with own value.
      print('obstacle detected')
      GPIO.output(22,GPIO.LOW)
      GPIO.output(23,GPIO.LOW)
      GPIO.output(24,GPIO.LOW)
      GPIO.output(5,GPIO.LOW)
      canc="delete from pilotino"
      cursor.execute(canc)
      db.commit()
      subprocess.call(['sh','./close.sh'])      #launch of close bash file for interrupt the motors loop 
         
     
print ('no obstacle detected')      

copy and paste this code below
and rename close.sh


#!/bin/bash
killall python3

below 2 last sh file for launch the
py script in autostart
copy paste and rename in two sh file
Below the sh for launch the Neww.py script.


#!/bin/bash
while true;
do
python3 Neww.py;done

below the sh file for launch the stop.py script


#!/bin/bash
while true;
do
python3 stop.py;done
Now there are 2 file python Neew.py - stop.py
and 3 sh file that whe can rename : close.sh - launch.sh - stoppa.sh
insert all file inside the folder pi of your raspberry and digit in terminal for every
file : sudo chmod 777 filename for admin permission
at the end go to autostart file, from terminal digit
cd ../../etc/xdg/lxsession/LXDE-pi press enter
inside LXDE-pi digit: sudo nano autostart
add to file this two string:
@lxterminal -e /home/pi/launch.sh
@lxterminal -e /home/pi/stoppa.sh
press ctrl + x and y at the end and finish , reboot the raspberry and you can see in your screen the 2 file py launch it in autostart.

Follow the Actionoise Twitch channel and join to live
for more tutorials and try yourself from remote the raspberry robocars.


Database's tables and
rows creation


Create inside the db a table with name
MotionTime
and inside this one
create 5 columns with same order and name like below:
gobottom gohead goleft goralle goright

create another table inside the same db with name:
pilotino
inside pilotino create a column with name:
comandi


                   


webapp v.1.0.1

Author:Mik

AuthorPortfolio