mohamadbagher
Published

Two-Rocket Gauge Device in a Laboratory

This device is made up of an electronic part of the compression board and is used for mine laboratories.

ExpertShowcase (no instructions)90 days624
Two-Rocket Gauge Device in a Laboratory

Things used in this project

Story

Read more

Schematics

Adxl345 connection to raspberryPi

dc motors connection to raspberry pi

vl6180 connection to raspberry pi

Code

Part of the app code

Python
from Tkinter import *
from time import sleep
import time
import sys
# import RPi.GPIO as GPIO
from rpisensors import VL6180X
import spidev
import math
from tkSimpleDialog import *
import string
 
################################################################################################################
def core_specifications():
 global backgrand
 global eD
 global value_max
 global eM
 global  eH
 global var_r
 global e20
 global e21
 global Max_simple_slip
 global eR
 f3=Frame()
 f3=Toplevel()
 f3.minsize(800 ,420)
 f3.maxsize(800 ,420)
 f3.configure(bg="gray")
 print backgrand
 g3=LabelFrame(f3 ,bd=10 ,font=("times",14 ,"bold") ,text="Core Specifications",bg=backgrand ,fg="black")
 g3.pack(fill=BOTH ,expand=True)
 g31= LabelFrame(g3,bd=10 ,font=("times",10),width=600 ,height=180,bg="gray")
 g31.pack()
 g31.place(x=95,y=110)
 l1=Label(g31 ,text="Diameter (mm)" ,bg="gray",fg="black",font=("times ",12,"bold"))
 l1.pack()
 l1.place(x=10 ,y=40)
 eD=Entry(g31 ,width=5 ,bd=5)
 eD.pack()
 eD.place(x=140 ,y=40)
 eD.focus()
 l2=Label(g31 ,text="Moisture (%)" ,bg="gray",fg="black",font=("times ",12,"bold"))
 l2.pack()
 l2.place(x=10 ,y=100)
 eM=Entry(g31 ,width=5 ,bd=5)
 eM.pack()
 eM.place(x=140 ,y=100)
 eM.focus()
 l3=Label(g31 ,text="Height (mm)" ,bg="gray",fg="black",font=("times ",12,"bold"))
 l3.pack()
 l3.place(x=270 ,y=40)
 eH=Entry(g31 ,width=5,bd=5)
 eH.pack()
 eH.place(x=390 ,y=40)
 l4=Label(g31 ,text="Rock code" ,bg="gray",fg="black",font=("times ",12,"bold"))
 l4.pack()
 l4.place(x=270 ,y=100)
 eR=Entry(g31 ,width=10 ,bd=5)
 eR.pack()
 eR.place(x=390 ,y=100)
 b1=Button(g3 ,text=">>>",command=test_panel ,bg="blue",fg="white" ,bd=8)
 b1.pack()
 b1.place(x=705,y=342)
 bb=Button(g3,text="<<<",bg="blue",fg="white",bd=8,command=f3.destroy)
 bb.pack()
 bb.place(x=0,y=342)
 t=e20.get()
 d=e21.get()
 try:
     value_max=float(t)
 except Exception as ex:
     print "noooooo"
 #print value_max
 try:
      Max_simple_slip=float(d)
 except Exception as ex:
     print "noooooo"
 #print Max_simple_slip


##############################################################################################
def tick():
 global time1
 time2=time.strftime(" %Y / %m / %d __ %H:%M:%S")
 if time2 != time1:
  time1 =time2
  clock.config(text=time2)
 clock.after(200 ,tick)


##################################################################################################
def About():
 global backgrand
 f1=Frame()
 f1=Toplevel()
 f1.minsize(800,420)
 f1.maxsize(800,420)
 f1.configure(bg="gray")
 g= LabelFrame(f1,font=("times ",14,"bold"),bd=10 ,text="About",bg="gray",fg="black")
 g.pack(fill=BOTH ,expand=True)
 msg= Message(g,text="aagddydfttdkyclyf ",bg="blue",fg="white")
 msg.config(font=("times",14))
 msg.pack()
 bb=Button(g,text="<<<",bg="blue",fg="white",bd=8,command=f1.destroy)
 bb.pack()
 bb.place(x=0,y=346)
##############################################################
def ok_them():
    backgrand=et.get()
    print backgrand
    f9.destroy()
 #############################################################################################
def theme():
     global backgrand
     global et
     global et1
     global f9
     f9=Frame();
     f9=Toplevel()
     f9.minsize(800 ,420)
     f9.configure(bg=backgrand)
     g9=LabelFrame(f9,font=("times ",14,"bold"),bd=10 ,text="Theme",bg=backgrand, fg="black")
     g9.pack(fill=BOTH ,expand=True)
     lt=Label(g9,font=("times ",12,"bold"),text="BackGrand",bg="gray")
     lt.pack()
     lt.place(x=100 ,y=100)
     et=Entry(g9,width=9,bd=5)
     et.pack()
     et.place(x=300,y=100)
     et.focus()
     lt1=Label(g9,font=("times ",12,"bold"),text="color font",bg="gray")
     lt1.pack()
     lt1.place(x=100 ,y=250)
     et1=Entry(g9,width=9,bd=5)
     et1.pack()
     et1.place(x=300,y=250)
     et1.focus()
     bt=Button(g9,text="Theme",bg="blue",width=10 ,height=3,fg="white",bd=8,command=ok_them)
     bt.pack()
     bt.place(x=600,y=300)
######################################################################################################
def Setting ():
 global backgrand
 f2=Frame()
 f2=Toplevel()
 f2.minsize(800 ,420)
 f2.configure(bg=backgrand)
 g1=LabelFrame(f2,font=("times ",14,"bold"),bd=10 ,text="Setting",bg=backgrand, fg="black")
 g1.pack(fill=BOTH ,expand=True)
 bt=Button(g1,text="Theme",bg="blue",width=10 ,height=3,fg="white",bd=8,command=theme)
 bt.pack()
 bt.place(x=100,y=150)
 bt=Button(g1,text="Date & Time",bg="blue",width=10 ,height=3,fg="white",bd=8,command=theme)
 bt.pack()
 bt.place(x=325,y=150)
 bt=Button(g1,text="Calibration",bg="blue",width=10 ,height=3,fg="white",bd=8,command=theme)
 bt.pack()
 bt.place(x=550,y=150)
 bb=Button(g1,text="<<<",bg="blue",fg="white",bd=8,command=f2.destroy)
 bb.pack()
 bb.place(x=0,y=342)

###########################################################################################################
def Auto_Tilt_Testing():
 global backgrand
 f3=Frame()
 f3=Toplevel()
 f3.minsize(800 ,420)
 f3.configure(bg="gray")
 g2=LabelFrame(f3,font=("times ",14,"bold"),bd=10,text="Auto Tilt Testing",bg="gray", fg="black")
 g2.pack(fill=BOTH ,expand=True)
 g21=LabelFrame(g2,font=("times ",14),bd=10,text="Test Procedure",width=600 ,height=150,bg="gray")
 g21.pack()
 g21.place(x=100 ,y=30)
 g22=LabelFrame(g2,font=("times ",14),bd=10,text="Test Setting",width=600 ,height=150,bg="gray")
 g22.pack()
 g22.place(x=100,y=190)
 global var_singelcore
 global var_triplecore
 global var_multitesting
 global Max_simple_slip
 global e21
 global c2
 global c1
 global e20
 global value_max

 var_triplecore=IntVar()
 var_singelcore =IntVar()
 var_multitesting=IntVar()
 c1=Checkbutton(g21,font=("times ",13,"bold"),text="Single Core",variable=var_singelcore,command=(lambda:cb()),bg="gray")
 c1.pack()
 c1.place(x=50,y=50)
 c2=Checkbutton(g21,font=("times ",13,"bold") ,text="Triple Core",variable=var_triplecore ,command=(lambda:cb1()) ,bg="gray")
 c2.pack()
 c2.place(x=225,y=50)
 c3=Checkbutton(g21,font=("times ",13,"bold") ,text="Multi Testing",variable=var_multitesting,bg="gray")
 print var_multitesting
 c3.pack()
 c3.place(x=425,y=50)
 l=Label(g22,font=("times ",12,"bold"),text="Tilt Rate (deg/min)",bg="gray")
 l.pack()
 l.place(x=0 ,y=50)
 e21=Entry(g22,width=7,bd=5)
 e21.pack()
 e21.place(x=130,y=50)
 e21.focus()
 l1=Label(g22,font=("times ",12,"bold") ,text="Max Simple slip (mm)",bg="gray")
 l1.pack()
 l1.place(x=250 ,y=50)
 e20 = Entry (g22,width=7 ,bd=5)
 e20.pack()
 e20.place(x=400 ,y=50)
 bf=Button(f3 ,text=">>>" ,bg="blue",fg="white",bd=8, command=core_specifications)
 bf.pack()
 bf.place(x=716 ,y=365)
 bb=Button(g2,text="<<<",bg="blue",fg="white",bd=8,command=f3.destroy)
 bb.pack()
 bb.place(x=0,y=341)
 #m=float(m)
 #print e20.get()
############################################################################################################

#######################################################
def Manual_Tilt_Testing():
 global backgrand
 global  var_manual
 var=IntVar()
 f4=Frame()
 f4=Toplevel()
 f4.minsize(800 ,420)
 f4.configure(bg="gray")
 g3=LabelFrame(f4,width=18,text="Manual Tilt Testing",bd=10,font=("times",14 ,"bold"),bg="gray", fg="black")
 g3.pack(fill=BOTH ,expand=True)
 l31=Label(g3,bd=5 ,relief=RAISED ,text="Tilt Degree :" ,font=("times",14 ,"bold"),bg="gray")
 l31.pack()
 l31.place(x=200 ,y=180)
 l32=Label(g3,width=18,bd=5 ,relief=RAISED,textvariable=var ,font=("times",14 ,"bold"),bg="white")
 var.set(var_manual)
 l32.pack()
 l32.place(x=500 ,y=180)

 b=Button(g3 ,text="Save",bd=8,command=save_Manual ,bg="green" ,fg="white",width=5 ,height=2)
 b.pack()
 b.place(x=650 ,y =300)
 bb=Button(g3,text="<<<",bg="blue",fg="white",bd=8,command=f4.destroy)
 bb.pack()
 bb.place(x=0,y=341)
 ###################################################################################
def start_manual_Tilt_Testing():
     angel()
     Manual_Tilt_Testing()
 #######################################################################################3
#backgrand=et.get()
#new window
master = Tk()
master.minsize(800 ,420)
master.configure(bg=backgrand)
master.title("MyApp")
grupe=LabelFrame(master,font=("times",14 ,"bold"),text="Menu",bd=10,bg=backgrand,fg="black")
grupe.pack(fill=BOTH ,expand=True)
#label clock
time1=""
clock=Label(grupe ,font=("times",12 ,"bold"),bd=8,bg="gray", fg="black")
clock.pack(expand=True)
clock.place(x=330 ,y=0)
#new Button
b1 = Button(grupe ,text="About",command= About,bg="blue",bd=8 ,fg="white" ,width=4 ,height=2)
b1.pack(expand=True)
b1.place(x=280 ,y=240)

b2 = Button(grupe ,text="Setting",command= Setting ,bg="blue",bd=8 ,fg="white" ,width=4 ,height=2)
b2.pack(expand=True)
b2.place(x=525 ,y=240)

b3 = Button(grupe ,text="Manual Tilt Testing",command=start_manual_Tilt_Testing,bd=8,bg="blue" ,fg="white" ,width=13 ,height=2)
b3.pack(expand=True)
b3.place(x=250 ,y=120)


b4 = Button(grupe ,text="Auto Tilt Testing",command=Auto_Tilt_Testing,bd=8,bg="blue" ,fg="white" ,width=11 ,height=2)
b4.pack(expand=True)
b4.place(x=500 ,y=120)

tick()
master.mainloop()

Credits

mohamadbagher

mohamadbagher

2 projects • 8 followers

Comments