Пример #1
0
	def function_Estop(self):
		try: 
			print("EStop - Activated")	
			#remember not to disable sensor reading
			aircon_output.aircon_enabled = 0 
			coldblock_output.coldblock_enabled = 0
			hotend_output.hotend_enabled = 0 
			stepper_output.motor_enabled = 0
			camera_linedetection.camera_enabled = 0
			herkulex.servo_enabled = 0
			grovepi.analogWrite(self.peltierfanpin1,0)
			grovepi.analogWrite(self.peltierfanpin2,0)
			#grovepi.ledCircle_off(self.ledcirclepin)
			time.sleep(0.1)
			self.peltier1.start(0)
			self.peltier2.start(0)
			self.heater.start(0)
			GPIO.output(self.motor_enable_pin,1) #set H to disable
			GPIO.output(self.motor_dir_pin,0) #set H to disable
			GPIO.output(self.motor_step_pin,0) #set H to disable
			print("Successful = Power down system")	
			buzzer.beep(self.buzzerpin,2)
		except Exception, e:
			print("--- Failed = Pls manual power down ---\n")
			print("--- Failed = Pls manual power down ---\n")	
			print("--- Failed = Pls manual power down ---\n")
			buzzer.beep_fail(self.buzzerpin)		
			print(str(e))
Пример #2
0
 def updateTemperaturelabel(self):
     while True:
         self.labelReadAircon.setText("{:.1f} C".format(
             sensors.adc1_temp_cur))
         self.labelReadColdblock.setText("{:.1f} C".format(
             sensors.adc2_temp_cur))
         self.labelReadHotend.setText("{:.1f} C".format(
             sensors.adc3_temp_cur))
         #update image
         try:
             if (sensors.adc3_temp_cur >= 165.0):
                 buzzer.beep(self.buzzerpin, 2)
             if (self.cameraStart):
                 self.labelCameraview.setPixmap(
                     QtGui.QPixmap(camera_linedetection.imgPath01))
                 self.lcdOutputDia1.setProperty(
                     "value", camera_linedetection.OutputDia1)
                 self.lcdOutputDia2.setProperty(
                     "value", camera_linedetection.OutputDia2)
                 self.lcdOutputDia3.setProperty(
                     "value", camera_linedetection.OutputDia3)
             else:
                 self.labelCameraview.setPixmap(
                     QtGui.QPixmap("../../../../../"))
         except Exception, e:
             print(str(e))
         time.sleep(0.30)  #update rate is set to x seconds
Пример #3
0
 def function_Estop(self):
     try:
         print("EStop - Activated")
         #remember not to disable sensor reading
         aircon_output.aircon_enabled = 0
         coldblock_output.coldblock_enabled = 0
         hotend_output.hotend_enabled = 0
         stepper_output.motor_enabled = 0
         camera_linedetection.camera_enabled = 0
         herkulex.servo_enabled = 0
         grovepi.analogWrite(self.peltierfanpin1, 0)
         grovepi.analogWrite(self.peltierfanpin2, 0)
         #grovepi.ledCircle_off(self.ledcirclepin)
         time.sleep(0.1)
         self.peltier1.start(0)
         self.peltier2.start(0)
         self.heater.start(0)
         GPIO.output(self.motor_enable_pin, 1)  #set H to disable
         GPIO.output(self.motor_dir_pin, 0)  #set H to disable
         GPIO.output(self.motor_step_pin, 0)  #set H to disable
         print("Successful = Power down system")
         buzzer.beep(self.buzzerpin, 2)
     except Exception, e:
         print("--- Failed = Pls manual power down ---\n")
         print("--- Failed = Pls manual power down ---\n")
         print("--- Failed = Pls manual power down ---\n")
         buzzer.beep_fail(self.buzzerpin)
         print(str(e))
Пример #4
0
def main():
    #intialize the components of the project
    setupComponents()

    # This loop keeps checking for chips. If one is near it will get the UID and authenticate
    nfc = TwoRfid.Nfc522()  #create object to read from 2 different rfid
    while continue_reading:

        #read RFID of people entry and car entry
        gid1, gid2 = nfc.obtem_nfc_rfid()

        #handle car gate
        if not gid1 == 0:
            print("rfid reader of car gate read: ", gid1)
            buzzer.beep(1)

            name, slot, state = UserDB.AllowAccess(str(gid1), 0)
            if (state == 0):  #this person has a reservation
                lcd.message("WELCOME ", name)

                time.sleep(2)
                lcd.message("Go To Slot", str(slot))
                ServoMotor.OpenGate()  #open the gate

                #wait till the car pass the gate
                if (UltraSonicSensor.IsPassed()):

                    UserDB.changeState(gid1)
                    time.sleep(3)
                    ServoMotor.CloseGate()  #close the gate

                    #make microController open specific slot
                    openSlot(str(gid1), slot)
                    lcd.message("WELCOME IN", "SMART PARKING")

            elif (state == -2):  #this person not has a reservation
                lcd.message("Please ", "Reserve First")
                time.sleep(5)
                lcd.message("WELCOME IN", "SMART PARKING")

        #handle person gate
        if not gid2 == 0:
            print("rfid reader of person gate read: ", gid2)
            buzzer.beep(1)

            name, slot, state = UserDB.IsReserve(str(gid2), 1)
            if state == 1:  #this person has a car inside the garage
                #open the gate
                lcd.message("Here you are", "The Gate is open")
                GPIO.output(PERSON_GATE, True)
                time.sleep(6)
                GPIO.output(PERSON_GATE, False)

            else:
                lcd.message("Sorry You don't ", "Have car inside")
                time.sleep(5)

            lcd.message("WELCOME IN", "SMART PARKING")
Пример #5
0
	def updateTemperaturelabel(self):
		while True:
			self.labelReadAircon.setText("{:.1f} C".format(sensors.adc1_temp_cur))
			self.labelReadColdblock.setText("{:.1f} C".format(sensors.adc2_temp_cur))
			self.labelReadHotend.setText("{:.1f} C".format(sensors.adc3_temp_cur))
			#update image
			try:
				if(sensors.adc3_temp_cur >= 165.0):
					buzzer.beep(self.buzzerpin,2)
				if(self.cameraStart):
					self.labelCameraview.setPixmap(QtGui.QPixmap(camera_linedetection.imgPath01))
					self.lcdOutputDia1.setProperty("value", camera_linedetection.OutputDia1)
					self.lcdOutputDia2.setProperty("value", camera_linedetection.OutputDia2)
					self.lcdOutputDia3.setProperty("value", camera_linedetection.OutputDia3)
				else:
					self.labelCameraview.setPixmap(QtGui.QPixmap("../../../../../"))
			except Exception, e:
				print(str(e))
			time.sleep(0.30) #update rate is set to x seconds
Пример #6
0
def main():
    #intialize the components of the project
    setupComponents()

    nfc = TwoRfid.Nfc522()  #create object to read from 2 different rfid

    # This loop keeps checking for chips. If one is near it will get the UID and authenticate

    while continue_reading:
        #read RFID
        gid1, gid2 = nfc.obtem_nfc_rfid()
        Uid = str(gid1)

        if not Uid == '0':
            person = False
            # Print UID
            print("Card read UID: " + Uid)

            #alter the user that the card is read
            buzzer.beep(1)

            ok = UserDB.allowExit(Uid)

            if ok:
                ServoMotor.OpenGate()  #open the gate

                #wait till the car pass the gate
                if (UltraSonicSensor.IsPassed()):
                    time.sleep(2)
                    ServoMotor.CloseGate()  #close the gate

                    #remove this user from the db of slots
                    #and also from the db of car entrance
                    UserDB.freeSlot(Uid)

            else:
                print("this tag doesn't have car inside the garage")
                print("enter the correct one")
Пример #7
0
def start():
    time.sleep(4)

    while True:
        # if PIR sensor is True == if motion is detected
        if GPIO.input(17):
            print("Child is in the car")

            # check environmental condition (humidity and temperature)
            humid, temp = Adafruit_DHT.read_retry(11, 27)
            # calculate the wet-bulb temperature
            wetBulb = temp*atan(0.151977* pow((humid+8.313659),0.5))+atan(temp+humid)-atan(humid-1.676331)+0.00391838* \
                      pow(humid,1.5)*atan(0.023101*humid)-4.686035

            # if wet-bulb temperature is above the safe range
            if wetBulb >= 15:
                # wait for 5 min
                time.sleep(600)

                #### telegram to notify parents
                # record video
                rec_video()
                # send a warning message
                bot.sendMessage(chat_id=chat_id,
                                text="Your child is still in a scorching car!")
                # send a real-time video
                bot.sendVideo(chat_id=chat_id, video='/home/pi/video.mp4')

                # wait for 5 min
                time.sleep(300)

                #### buzzer to notify passengers
                # buzzer will be active for 2 min
                buzzer.beep(120)
                buzzer.destroy()

                # wait for 5 min
                time.sleep(300)

                #### telegram to notify 911
                # get GPS location data
                received_data = (str)(ser.readline())
                GPGGA_data_available = received_data.find(gpgga_info)
                if (GPGGA_data_available > 0):
                    GPGGA_buffer = received_data.split(
                        "$GPGGA,",
                        1)[1]  #store data coming after "$GPGGA," string
                    NMEA_buff = (GPGGA_buffer.split(',')
                                 )  #store comma separated data in buffer
                    gps.GPS_Info()

                # record video
                rec_video()
                # send a warning message
                bot.sendMessage(
                    chat_id=chat_id,
                    text=
                    "Possible Child Heat Stroke Death in a Vehicle at Lat: " +
                    lat_in_degrees + "Long: " + long_in_degrees)
                # send a real-time video
                bot.sendVideo(chat_id=chat_id, video='/home/pi/video.mp4')

    # clean up GPIO pins
    GPIO.cleanup()
Пример #8
0
"""*------------------------------------------------------------*-
  Buzzer main functions - usage file
  Tested on Gwiot 7304D2 RFID Reader(26 bit Wiegand mode) and RASPBERRY PI 3B+
    (c) Minh-An Dao 2019
  version 1.00 - 28/10/2019
 --------------------------------------------------------------
 *
 * Usage:
 * ./buzzer_main [-d] [delay] [-b] [beep] [-p] [pin]
 *  With:
 *  -delay: buzzer ON time
 *  -beep : times to beep
 *  -pin: new buzzer pin (wiringPi pin)
 *
 --------------------------------------------------------------"""
import buzzer

try:
    buzzer.beep(100, 2)
except KeyboardInterrupt:
    pass
Пример #9
0
		herkulexthread.daemon = True
		herkulexthread.start()
		
		#Enable buzzer warning
		buzzer.alertbuzzer_enabled = 1
		thread.start_new_thread(buzzer.run, (buzzerpin,)) #start sensor thread
		
		#Enable the devices and sensors
		sensors.ambience_sensor_enabled = 0 #enable temp reading after thread start
		sensors.adc1_sensor_enabled = 1 #enable adc reading after thread start
		sensors.adc2_sensor_enabled = 1 #enable adc reading after thread start
		sensors.adc3_sensor_enabled = 1 #enable adc reading after thread start
		
		time.sleep(0.5)
		print("\n\n\nBoot-up ... Successful\n\n\n")
		buzzer.beep(buzzerpin, 1)
		
	except Exception, e:
		print(str(e))
		print("\n\n\nBoot-up ... Failed\n")
		buzzer.beep_fail(buzzerpin)
		GPIO.cleanup()

	try:
		app = QtWidgets.QApplication(sys.argv)
		app.aboutToQuit.connect(exitProgram)
		labelWindow = QtWidgets.QMainWindow()
		ui = mainwindow.Ui_labelWindow(peltierfanpin1,peltierfanpin2, peltier1, peltier2, heater, motor_step_pin, motor_dir_pin, motor_enable_pin, buzzerpin, ledcirclepin)
		ui.setupUi(labelWindow)
		labelWindow.show()
		sys.exit(app.exec_())
Пример #10
0
# -- coding: utf-8 --
#导入模块
import buzzer

var = 1
#初始化led引脚
buzzer.buzzer_init()
#初始化后进入一个死循环执行流水灯,通过修改flow(time),time参数来改变速度(单位秒)
while var == 1:
    buzzer.beep(0.2, 1)