Go to advanced search

by SurferTim
Mon May 31, 2021 10:46 am
Forum: Troubleshooting
Topic: Playing audio with PHP shell-exec
Replies: 4
Views: 292

Re: Playing audio with PHP shell-exec

Why thank you Dougie! That typing saved me hours with those two pesky mouse clicks to reboot.
by SurferTim
Mon May 31, 2021 8:08 am
Forum: Troubleshooting
Topic: Playing audio with PHP shell-exec
Replies: 4
Views: 292

Re: Playing audio with PHP shell-exec

If it is an Apache web server, the user is www-data. If you want to use any of the RPi functions, the www-data user must be a member of that group. I think that the audio group would be necessary to play audio files, as is the gpio group for accessing digital pins and the dialout group for accessing...
by SurferTim
Wed May 26, 2021 10:12 am
Forum: Troubleshooting
Topic: how to open some ports while keeping SSH accessible
Replies: 4
Views: 225

Re: how to open some ports while keeping SSH accessible

Open port 22 (or ssh).
sudo ufw allow 22
or
sudo ufw allow ssh
by SurferTim
Fri May 21, 2021 12:30 pm
Forum: Troubleshooting
Topic: PI 3B+ and Wifi Dongle help request
Replies: 8
Views: 353

Re: PI 3B+ and Wifi Dongle help request

I tried that setup a while back, and couldn't get wlan1 to work as an AP. However, I did manage to switch the interface names so the wifi dongle is wlan0, then it would work as an AP. I am not certain this still works. To make onboard wlan always wlan1 (mac b8:27:eb:1e:56:52 in this example) Create ...
by SurferTim
Mon May 17, 2021 3:13 pm
Forum: Networking and servers
Topic: Attaching a DHCP Server to OVS on Pi 4
Replies: 9
Views: 662

Re: Attaching a DHCP Server to OVS on Pi 4

Did you use "bridge=br0" in hostapd.conf? It's been a while since I used a bridge, but this worked in the past. interface=wlan0 bridge=br0 ssid=RPiNet hw_mode=g channel=7 wmm_enabled=0 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=mypassphrase wpa_key_mgmt=WPA-PSK ...
by SurferTim
Thu May 13, 2021 7:01 pm
Forum: Troubleshooting
Topic: Errors with DS18B20
Replies: 15
Views: 867

Re: Errors with DS18B20

I think that V+ should be 3.3v. 5V is acceptable for the V+ on a DS18B20. It won't get back to the Pi. I see that as maybe the start of a bad habit for someone not familiar with electronics. You are correct in this instance tho. It is an open collector output. Edit: The open collector output is why...
by SurferTim
Thu May 13, 2021 6:49 pm
Forum: Troubleshooting
Topic: Errors with DS18B20
Replies: 15
Views: 867

Re: Errors with DS18B20

I think that V+ should be 3.3v.
I see no pullup resistor on the data line.

Edit: There should be a 4.7Kohm resistor from 3.3v power to the data line.
Are you using a sensor standalone, or is it mounted on a circuit board (module)?
by SurferTim
Thu May 13, 2021 6:30 pm
Forum: Troubleshooting
Topic: Errors with DS18B20
Replies: 15
Views: 867

Re: Errors with DS18B20

If you are only "fairly sure" about the wiring, maybe you should post how you have it connected.
Pullup resistor value around 4.7Kohm?
DQ pin to power or GND?
by SurferTim
Thu May 13, 2021 1:50 pm
Forum: Troubleshooting
Topic: Electrical interference (?) affecting PI 4 IO pin values
Replies: 5
Views: 294

Re: Electrical interference (?) affecting PI 4 IO pin values

If electrical interference is a problem, then I would not use the internal pullup. Use a lower value resistor from 3.3v to the GPIO pin, like 1Kohm.

Edit: Somebody beat me to it.
by SurferTim
Thu May 13, 2021 10:06 am
Forum: Python
Topic: Same Subprocess call has different outcomes on 2 pi's
Replies: 2
Views: 257

Re: Same Subprocess call has different outcomes on 2 pi's

Are you running the script as the same user on each RPi?
Does the user you are running this script belong to the gpio group?
Check with this. Do you see "gpio" there?

Code: Select all

groups
by SurferTim
Tue May 11, 2021 9:45 am
Forum: Python
Topic: RPIO.GPIO does not work when ran from crontab
Replies: 5
Views: 462

Re: RPIO.GPIO does not work when ran from crontab

The last time I saw this message was when the user was not a member of the gpio group. RuntimeError: This module can only be run on a Raspberry Pi! I haven't used crontab in a while so I'm not certain what user it runs as. On the RPi, it appears user root is not a member of the gpio group. sudo grou...
by SurferTim
Sun May 09, 2021 6:33 pm
Forum: Python
Topic: Error while trying to run python program from terminal
Replies: 4
Views: 422

Re: Error while trying to run python program from terminal

I think this covers it.

Code: Select all

ImportError: No module named guizero
Did you install guizero?
https://lawsie.github.io/guizero/
by SurferTim
Sun May 09, 2021 3:42 pm
Forum: Networking and servers
Topic: Static IP not working for eth0
Replies: 8
Views: 549

Re: Static IP not working for eth0

Have you added anything to /etc/network/interfaces?
by SurferTim
Sun May 09, 2021 3:38 pm
Forum: Troubleshooting
Topic: No network connection, but headless works
Replies: 5
Views: 376

Re: No network connection, but headless works

What interfaces have you added to the bridge br0?
Maybe if you post the output of the routes...

Code: Select all

ip route
by SurferTim
Sat May 08, 2021 8:36 pm
Forum: Python
Topic: Autostart script problems
Replies: 8
Views: 571

Re: Autostart script problems

Code: Select all

Exec=lxterminal -e "cd /home/pi/dist;python3.7 myscript.py"
Semicolon separator worked for me. I don't use the python3.7 thing.
by SurferTim
Thu May 06, 2021 10:19 pm
Forum: Python
Topic: Wrapper script?
Replies: 9
Views: 391

Re: Wrapper script?

Did you create the file using sudo? You shouldn't. That should use root as the user and group.

Edit: You want the file's owner and group as 'pi'.
by SurferTim
Thu May 06, 2021 9:05 pm
Forum: Python
Topic: Wrapper script?
Replies: 9
Views: 391

Re: Wrapper script?

It should work fine. It runs as user 'pi'.
Like I said, I use pygame, and it is a GUI.

Edit: This assumes the RPi boots into the desktop, not CLI.
by SurferTim
Thu May 06, 2021 8:56 pm
Forum: Python
Topic: Wrapper script?
Replies: 9
Views: 391

Re: Wrapper script?

I use python3 and pygame, but same principle. Check if directory "/home/pi/.config/autostart" exists. If not create it. Create new .desktop file: nano /home/pi/.config/autostart/myscript.desktop Add this to myscript.desktop [Desktop Entry] Type=Application Name=Myscript Exec=lxterminal -e ...
by SurferTim
Thu May 06, 2021 5:09 pm
Forum: Python
Topic: Issue sending characters from Pi to Pi via UART
Replies: 1
Views: 122

Re: Issue sending characters from Pi to Pi via UART

On device #2 use something like

Code: Select all

decoded_data = r_data.decode()
by SurferTim
Wed May 05, 2021 11:18 pm
Forum: Troubleshooting
Topic: Flow meter circuit and low pulse count
Replies: 21
Views: 639

Re: Flow meter circuit and low pulse count

I thought that might have been wrong. Maybe too much resistance? I'd try a 1K/2Kohm divider.

An o-scope would really help.
by SurferTim
Wed May 05, 2021 10:50 pm
Forum: Troubleshooting
Topic: Flow meter circuit and low pulse count
Replies: 21
Views: 639

Re: Flow meter circuit and low pulse count

Verify the flow is 4000 gallons/minute? Its odd that I get a good reading, and a pretty consistent on the number of pulses, but its like 5 a minute.... yet the sensor has 4000GPM going through it.... Could my voltage divider be causing this? I am using a 10k and a 4.7k. Any other issues that anyone ...
by SurferTim
Wed May 05, 2021 5:40 pm
Forum: Python
Topic: Datetime issue
Replies: 3
Views: 259

Re: Datetime issue

This runs ok. Couldn't figure out what "tijd" is. #!/usr/bin/env python3 from datetime import datetime, timedelta tomorrow = datetime.now() + timedelta(days=+1) tomorrow_formatted = tomorrow.strftime('%-d-%m-%y') #d=datetime.datetime.strptime(tijd,'%H:%M') dnow=datetime.now() print(tomorro...
by SurferTim
Mon May 03, 2021 8:51 pm
Forum: Troubleshooting
Topic: Executing python scripts from PHP (one runs, the other doesn't)
Replies: 4
Views: 177

Re: Executing python scripts from PHP (one runs, the other doesn't)

To access the GPIO, which you have apparently done, add www-data to the gpio group.
To access the serial ports, you must add www-data to the dialout group. (Usually)

Edit: Remember to reboot after adding a user to a group.
Also, don't add www-data to the root group!
by SurferTim
Mon May 03, 2021 3:49 pm
Forum: Python
Topic: Read SPI data from unknown device
Replies: 21
Views: 1451

Re: Read SPI data from unknown device

I had to test it. This code works with the info you provided. I programmed a STM32 Blue Pill to output data like your master. Ensure you have GND connected to the other device. #!/usr/bin/env python3 import RPi.GPIO as GPIO from time import sleep CS = 16 # GPIO23 clkpin = 18 # GPIO24 datapin = 22 # ...

Go to advanced search