Thermal Electric Actuator : https://www.aliexpress.com/item/Final-Clear-Out-Thermal-Electric-Actuator-for-Manifold-in-Under-flooring-Heating-System-230V-NC-for/32711065878.html?spm=2114.30010308.3.2.a8EcNe&ws_ab_test=searchweb0_0,searchweb201602_2_10065_10068_10000009_10084_10000025_10083_10080_10000029_10082_10081_10000028_10110_10111_10060_10112_10113_10062_10114_10056_10055_10037_10054_10059_10032_10099_10078_10079_10000022_10077_10000012_10103_10073_10102_10000015_10096_10000018_10000019_10052_10053_10107_10050_10106_10051-10050,searchweb201603_1,afswitch_5_afChannel,single_sort_3_default&btsid=e917473a-92ea-4b74-a389-1ddf6114dcf4
Relay for Arduino / Raspbery Pi : https://www.aliexpress.com/item/5V-One-1-Channel-Relay-Module-Board-Shield-For-PIC-AVR-DSP-ARM-for-arduino-Relay/32718527508.html?spm=2114.30010308.3.57.PhvIW2&ws_ab_test=searchweb0_0,searchweb201602_2_10065_10068_10000009_10084_10000025_10083_10080_10000029_10082_10081_10000028_10110_10111_10060_10112_10113_10062_10114_10056_10055_10037_10054_10059_10032_10099_10078_10079_10000022_10077_10000012_10103_10073_10102_10000015_10096_10000018_10000019_10052_10053_10107_10050_10106_10051-10050,searchweb201603_1,afswitch_5_afChannel,single_sort_3_default&btsid=e4725c30-a074-42ad-93aa-fa6b26a60bcb
CODE:
PYTHON:
import RPi.GPIO as GPIO
from time import sleep
import MySQLdb
GPIO.setwarnings(False)
conn = MySQLdb.connect(host=”localhost”, user=”test”, passwd=”test”, db=”test”)
cursor = conn.cursor()
# The script as below using BCM GPIO 00..nn numbers
GPIO.setmode(GPIO.BCM)
# Set relay pins as output
GPIO.setup(5, GPIO.OUT)
while (True):
sql = “SELECT COUNT(1) FROM temperature WHERE parno = ’3′”
cursor.execute(sql)
conn.commit()
result = cursor.fetchone()[0]
if result == 1:
# parnoto izstiva
GPIO.output(5, GPIO.HIGH)
#print ‘parnoto e izklucheno’
# Sleep for 1 seconds
sleep(1)
if result != 1:
# parnoto zagrqva
GPIO.output(5, GPIO.LOW)
#print ‘parnoto e vklucheno’
# Sleep for 1 seconds
sleep(1)
HTML / PHP :
php
error_reporting(E_ALL ^ E_DEPRECATED ^ E_WARNING);
$dbhost = ’192.168.0.1:3306′;
$dbuser = ‘test’;
$dbpass = ‘test’;
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
die(‘Няма връзка с базата данни: ‘ . mysql_error());
mysql_select_db(‘test’);
//parnoto izstiva
if(isset($_POST['izkluchi']))
$sql = ‘update temperature set parno=3 where ID=1;’;
$retval = mysql_query( $sql, $conn );
mysql_close($conn);
//parnoto zagrqva
if(isset($_POST['vkluchi']))
$sql2 = ‘update temperature set parno=4 where ID=1;’;
$retval2 = mysql_query( $sql2, $conn );
mysql_close($conn);
?
Post time: Jun-12-2017