Raspberry PI Pico W motion and light sensor relay

At first I thought I would need to use a PI Pico to control a automatic light in my garage.  I started off by buying the following, but then I learned that just the RCWL-0516 Switch Module could do it all without the need for the PI Pico.

Radar Sensor RCWL-0516 Switch Module

Songhe RCWL-0516 RCWL0516 Microwave Radar Sensor Module,Human Body Induction Switch Module,Motion Induction Switch Sensor Module 5-7m 4-28V 5pcs

At CDS you can add a LDR (light-dependent resistor) to do motion detection during night only. For example, if you need to use this module for motion sensing light for outdoor, then LDR is a must. Without LDR light will glow in daytime also which is the waste of electricity.

(details here)

Amazon 8 pcs for $9.59

 RCWL-0516

 

Resistor 5516 GL5516 5mm 0.5 Mohm Photoresistor

Chanzon 20pcs LDR Resistor 5516 GL5516 5mm 0.5 Mohm Photoresistor Light-Dependent Photoconductor 20pcs Photo Light Sensitive

(details here)

Program to raise blinds - up.py

# up.py  python3 program to raise blinds

import time
import RPi.GPIO as GPIO
import sys
import shutil
from os.path import exists

channel1 = 17   # motor left
channel2 = 27   # motor right
channel3 = 22   # power switch
traveltime = 86

upfile = '/home/pi/shade/up.status'        # existance of this files means blinds are currently up
downfile = '/home/pi/shade/down.status'    # existance of this files means blinds are currently down
raisefile = '/home/pi/shade/raise.status'  # existance of this files means blinds were partly raised
lowerfile = '/home/pi/shade/lower.status'  # existance of this files means blinds were partly lowered
stopfile = '/home/pi/shade/stop.status'    # existance of this files means disable movement of blinds (windy)

stopfile_exists = exists(stopfile)
upfile_exists = exists(upfile)
downfile_exists = exists(downfile)

# if on vacation or windy a stopfile prevents program running
if ( stopfile_exists):
    sys.exit('Warning cannot raise blind because of stopfile at: /home/pi/shade/stop.status')

if (not downfile_exists):
    sys.exit('Error cannot raise blind that is up: /home/pi/shade/down.status')

shutil.move(downfile, raisefile)
sys.stdout.write ('raise ')

#GPIO setup
GPIO.setmode(GPIO.BCM)
GPIO.setup(channel1, GPIO.OUT)
GPIO.setup(channel2, GPIO.OUT)
GPIO.setup(channel3, GPIO.OUT)

def motor_off(pin):
    GPIO.output(pin, GPIO.HIGH)  # Turn on

Program to lower Blind - Down.py



# Program down.py
# python3 down.py
import time
import RPi.GPIO as GPIO
import sys
import shutil
from os.path import exists

channel1 = 17   # motor left 
channel2 = 27   # motor right 
channel3 = 22   # power switch 
traveltime = 86 # number of seconds to move blind

upfile = '/home/pi/shade/up.status'        # existance means blinds are currently up 
downfile = '/home/pi/shade/down.status'    # existance means blinds are currently down 
raisefile = '/home/pi/shade/raise.status'  # existance means blinds were partly raised 
lowerfile = '/home/pi/shade/lower.status'  # existance means blinds were partly lowered 
stopfile = '/home/pi/shade/stop.status'    # existance means disable movement of blinds (windy)

stopfile_exists = exists(stopfile)
upfile_exists = exists(upfile)
downfile_exists = exists(downfile)

if ( stopfile_exists):
        sys.exit('Warning cannot lower blind because of stopfile at: /home/pi/shade/stop.status')

if (not upfile_exists):
    sys.exit('Error cannot lower blind that is not up: /home/pi/shade/up.status')

sys.stdout.write ('lower ')
shutil.move(upfile, lowerfile )

#GPIO setup
GPIO.setmode(GPIO.BCM)
GPIO.setup(channel1, GPIO.OUT)
GPIO.setup(channel2, GPIO.OUT)
GPIO.setup(channel3, GPIO.OUT)

def motor_off(pin):
    GPIO.output(pin, GPIO.HIGH)  # Turn on
    print ("off")

def motor_on(pin):
    GPIO.output(pin, GPIO.LOW)  # Turn off
    print 

Ubuntu - The following packages have unmet dependencies:  nvidia-driver-515 : Depends:

Cura gives Could not probe OpenGL. This program rquires OpenGL 2.0 or higher.

 

I just dealt with the same issue on Ubuntu 22.04 when trying to install

$ sudo ubuntu-drivers autoinstall
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

Linux Commands with examples

cp

Copy file1 to file2 preserving the mode, ownership and timestamp.

  $ cp -p file1 file2

mv

Rename file1 to file2. if file2 exists prompt for confirmation before overwritting it.

  $ mv -i file1 file2

rm

get confirmation before removing the file.

  $ rm -i file*

cd

change directory.

  $ cd path

change back to previous directory

  $ cd -

pwd

Print working directory, shows the path of the current directory

  $ pwd

more

Echo the contents of the file to the screen one page at a time, see also less and cat

  $ more /opt/example/file.txt

ls

Display filesize in human readable format (e.g. KB, MB etc.,)

Financial planning - Automatic Millionaire

Book summaryautomatic millionaire cover

The Automatic Millionaire starts with the powerful story of an average American couple—he’s a low-level manager, she’s a beautician—whose joint income never exceeds $55,000 a year, yet who somehow manage to own two homes debt-free, put two kids through college, and retire at 55 with more than $1 million in savings. Through their story you’ll learn the surprising fact that you cannot get rich with a budget! You have to have a plan to pay yourself first that is totally automatic, a plan that will automatically secure your future and pay for your present.
 
What makes The Automatic Millionaire unique:
 
·        You don’t need a budget
·        You don’t need willpower
·        You don’t need to make a lot of money
·        You don’t need to be that interested in money
·        You can set up the plan in an hour
 

Ambulance down in the valley

by Joseph Malins (1895)

-a poem about prevention -

 

'Twas a dangerous cliff, as they freely confessed,

though to walk near its crest was so pleasant;

but over its terrible edge there had slipped

a duke and full many a peasant.

 

So the people said something would have to be done,

but their projects did not at all tally;

some said, 'Put a fence 'round the edge of the cliff, '

some, 'An ambulance down in the valley.'

 

But the cry for the ambulance carried the day,

for it spread through the neighboring city;

a fence may be useful or not, it is true,

but each heart became full of pity

for those who slipped over the dangerous cliff;

 

And the dwellers in highway and alley

gave pounds and gave pence, not to put up a fence,

but an ambulance down in the valley.

 

'For the cliff is all right, if your careful, ' they said,

'and if folks even slip and are dropping,

it isn't the slipping that hurts them so much

as the shock down below when they're stopping.'

 

So day after day, as these mishaps occurred,

quick forth would those rescuers sally

to pick up the victims who fell off the cliff,

with their ambulance down in the valley.

Minecraft on Linux

I have downloaded minecraft and minecraft_server.1.7.4.jar on my Fedora 20 computer and I am running it just fine.

To start the server I run the following command from the directory with the jar file:

# java -Xmx1G -Xms1G -jar ./minecraft_server.1.7.4.jar

I also downloaded the minecraft maping software Overviewer

To update the map I run the following command, where map_config is my settings:

# overviewer.py --config=map_config

 

java -Xmx1280M -Xms1280M -jar Minecraftserver1.19.2.jar