Controlling a HVAC Relay With a NodeJS Web Server and a Raspberry Pi
In this video I control a HVAC relay using a Raspberry Pi and a NodeJS web server.
Prerequisite:
https://rumble.com/v4auyje-controlling-a-type-b-plug-with-a-hvac-relay-and-a-raspberry-pi.html
Run your server at start up:
https://rumble.com/v4ayapn-how-to-run-a-command-at-start-up-on-raspberry-pi-os.html
<code>
#!/home/william/.nvm/versions/node/v20.11.0/bin/node
const http = require('http');//require HTTP
const querystring = require('querystring');//require query string
const url = require('url');//require url
const { exec } = require("child_process");//require EXEC
http.createServer((req, res) => {//CREATE WEB SERVER
let runcommand = (command) => {//CREATE A FUNCTION THAT CAN BE CALLED TO RUN COMMANDS
exec(`${command}`, (error, stdout, stderr) => {
if (error) {///CONSOLE LOG ERRORS
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
});
}
let htmlMessage = '';//THIS VARIABLE WILL CONTAIN THE MESSAGE THAT WILL BE DISPLAYED TO THE USERS
let getValues = querystring.parse(url.parse(req.url).query);
if(getValues.onoff == "on")//IF /?onoff=on is sent then run the code in the if block that will call the runcommand function
{
runcommand('echo "The pin was turned on "`date` >> ./log');//THIS COMMAND WILL LOG THE ACTION TAKEN USING THE ECHO COMMAND
runcommand('./on.py');//THIS COMMAND WILL TURN ON THE GPIO PIN
htmlMessage = "<h1>The pin was turned on!</h1>";//THIS IS THE MESSAGE THAT WILL BE SENT TO THE USER
} else if(getValues.onoff == "off"){//IF /?onoff=off is sent then run the code in the if block that will call the runcommand function
runcommand('echo "The pin was turned off "`date` >> ./log');//LOG THE ACTION WITH THE ECHO COMMAND
runcommand('./off.py');//THIS COMMAND WILL TURN OFF THE GPIO PIN
htmlMessage = "<h1>The pin was turned off!</h1>";//THIS IS THE MESSAGE THAT WILL BE SENT TO THE USER
}
res.setHeader('Content-Type', 'text/html');//SET THE HEAD FOR HTML
res.writeHead(200, { 'Content-Type': 'text/html' });//WRITE THE HEAD
console.log(htmlMessage);
//BELOW IS THE SIMPLE HTML IT ONLY HAS TWO LINKS, A H1 ELEMENT AND A LITTLE CSS. THE LINKS WILL SEND THE GET INFO TO TURN ON AND OFF THE PINS
let html = `
<!DOCTYPE html>
<html>
<head>
<style>
a {
display: block;
padding: 10px;
margin: 10px;
size: 70px;
background-color: pink;
}
</style>
</head>
<body>
${htmlMessage}
<a href="?onoff=on">ON</a>
<a href="?onoff=off">OFF</a>
</body>
</html>
`;
res.write(html);//WRITE THE HTML
res.end();//END
}).listen(3000);
</code>
25
views
How To Run A Command At Start Up On Raspberry Pi OS
In this video I run a command at start on Raspberry Pi OS using crontab -e. This will work on any gnu/linux distro but this example it is on a Raspberry Pi.
11
views
How to install an inverter in a pickup
In this video I install a 4000 watt dc to ac inverter in a pickup. I tried my best to repair the audio in this video, I will do a second video and narrate it because the audio did not come out good using the built in microphone on the camera.
Warning:
Warning replicating anything seen in this video may result in injury or harm if used incorrectly. This video is made for educational purposes but no one should replicate anything in this video. If you intend to do anything similar it is highly recommended that you seek professional guidance and training prior to attempting anything similar.
9
views
How To Install an Inverter In a Pickup and Test
In this video I go over how to install a 4000 watt dc to ac inverter into a pickup using 4 gauge wire.
Warning:
Warning replicating anything seen in this video may result in injury or harm if used incorrectly. This video is made for educational purposes but no one should replicate anything in this video. If you intend to do anything similar it is highly recommended that you seek professional guidance and training prior to attempting anything similar.
15
views
Controlling a Type B Plug With a HVAC Relay and a Raspberry Pi
In this video I go over how to control a type b plug using and Raspberry Pi and a HVAC relay. I use the GPIO pins and Python 3 to turn on and off the relay controlling the type b plug.
Follow Up video:
https://rumble.com/v4aya4r-controlling-a-hvac-relay-with-a-nodejs-web-server-and-a-raspberry-pi.html
Script:
#!/usr/bin/python3
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(3,GPIO.OUT)
GPIO.output(3,GPIO.HIGH)
#!/usr/bin/python3
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(3,GPIO.OUT)
GPIO.output(3,GPIO.LOW)
21
views
Vino VNC Remote Desktop Ubuntu 23.10 on Raspberry Pi
In this video I go over how to install and get started with a VNC server and
viewer on Ubuntu Mate 23.10 on a Raspberry Pi.
More information can be found on the Ubuntu Mate version of the video: https://www.bitchute.com/video/e4rxSEXVE9IS/
https://rumble.com/v3kuh7k-remote-desktop-ubuntu-22.04.html
The script I used is listed below:
#!/bin/bash
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino authentication-methods "['vnc']"
gsettings set org.gnome.Vino vnc-password $(echo -n 'test' | base64)
/usr/lib/vino/vino-server
exit 0
8
views
How to Wire a Parallel Port to Control a Type B Plug
In this video I go over how to wire a HVAC solid state relay to control a type b plug(United States Standard AC wall outlet) and how to use a parallel port of a computer to turn on and off the relay. The wire colors shown are consistent with the standard wire colors used in construction, that use NM sheathed electrical cable.
This video can be used with three other videos to control outlets via a web server.
1. HOW TO CONTROL THE PARALLEL PORT DATA PINS WITH A WEB SERVER https://www.bitchute.com/video/uaGFOnTcnuGB/
2. How To Find Your Parallel Port Address on Linux https://www.bitchute.com/video/4csxAgjpmt1j/
3. How To Control The Parallel Port Data Pins Linux https://www.bitchute.com/video/Zl8ktsobi5P6/
3
views
Installing the "Linux" VM on a Chromebook
In this video I go over how to install "linux" from the settings menu and get started with it using "Linux Files" and apt-get.
12
views
One Audio Track Is Too Slow, Audacity Fix Using Tempo
In this video I show how to align audio and video tracks with audacity using tempo.
11
views
How to install DOOM using Dosbox on Ubuntu
In this video I go over how to install Dosbox v0.74-3 on Ubuntu Mate 23.04 and how to run Doom using it.
32
views
How to control the parallel port data pins with a web server
In this video I over how to control the data pins on the parallel port using a web server.
18
views
Arrested Decay Preview
This is a fictional writing project I started many years ago that I plan to finish, my life has been derailed over the past few years but despite the people who wish me ill I am getting it back and over the next few years I plan on finishing this project. This is a preview and it only is the first four pages.
24
views
How To Find Your Parallel Port Address on Linux
In this video I go over how to find your parallel port address on Linux
9
views
How To Control The Parallel Port Data Pins Linux
In this video I go over how to use the parallel port to control LEDs and relays using a C application on Linux.
Source Code Link:
https://github.com/williamhlane/ParC.git
Source Code:
#include <stdio.h>
#include <unistd.h>
#include <sys/io.h>
#define PortAddress (0x0378)
int main()
{
int number;
printf("Enter the value for the pins you'd like to activate.");
scanf("%d", &number);
if (ioperm(PortAddress, 1, 1))
{
printf("ioperm(%x) failed. Are you root?", PortAddress);
return 1;
}
outb(number, PortAddress);
return 0;
}
13
views
Remote Desktop Ubuntu 22.04
In this video I go over how to install and get started with a VNC server and
viewer on Ubuntu Mate 23.04. The server is Vino while the viewer is Vinagre.
More information can be found on the Ubuntu Mate version of the video: https://www.bitchute.com/video/e4rxSEXVE9IS/
The script I used is listed below:
#!/bin/bash
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino authentication-methods "['vnc']"
gsettings set org.gnome.Vino vnc-password $(echo -n 'test' | base64)
/usr/lib/vino/vino-server
exit 0
22
views
Starting Linux Programming, Python, C and Bash
In this video I go over how to create and run bash scripts, Python scripts and C applications on LINUX.
13
views
The Yard Crew
While Miss Angel was not there the day in question, she would have loved it so she made an appearance in the video as well.
15
views