New answers tagged

3

Most relays are Active LOW - the relay is ON when the input is LOW and OFF when the input is HIGH. The specification for your relay board should state this.


1

Maybe you could use a framework like Flask. With that you can create a webserver with only a few lines of code. And because it is written in python, you can use the classes you created already :)


2

Is there a reason why you want to stream via your Python script, as opposed to streaming to VLC directly? [socket] -> Python -> [pipe] -> VLC vs [socket] -> VLC You just add another interface (a pipe between Python and VLC) which adds some delay and jitter and doesn't seem to do any useful processing. Especially since you seem to read ...


2

CoderMike's Answer addressed the problems in your code, but if you are actually using the relay module pictured and have wired it in a similar manner there are more concerns. There are a number of similar (poorly-designed) relay modules on the market - they seem to infect ebay! They may work with Arduino (and TTL logic) BUT ARE A LOUSY DESIGN even for that ...


0

The problem seems to be on your Mac instead of the RPi. In my case, when sleep (or auto logout, or whatever) goes into effect, MacOS begins closing apps that are open. If I'm running a command in Terminal (incl. RPi SSH connections), it is unable to complete the sleep/logout/whatever process, and so MacOS begins throwing up notifications asking me to ...


2

Firstly does the following turn your relay on then off? import RPi.GPIO as GPIO,time GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) GPIO.setup(7,GPIO.OUT) print('on') GPIO.output(7,GPIO.LOW) time.sleep(4) print('off') GPIO.output(7,GPIO.HIGH) You also need to add timeouts to your distance sensing code otherwise your code could get stuck in a while ...


0

I had the issue and avoided it by NOT using the line: echo "/usr/local/bin/python3.8">> .bashrc on the .bashrc file and using only: echo "alias python = '/usr/local/bin/python3.8'">> .bashrc Seems to work, kept the used version of python as 3.8 and not enters the terminal running python.


1

Firstly I am assuming that your program cao.py is actually locate in /home/pi/Desktop Your question appears to have the path wrong and the Desktop folder spelt wrong. I've create the following simple program as an example: import time print('cao') time.sleep(10) To run this program on its own open a 'Terminal' window and use: python3 /home/pi/Desktop/...


3

What is a line follower robot? Line follower or Line detector is an autonomous robot that follows either black line in white are or white line in the black area. The robot must be able to detect a particular line and keep following it. You can implement it by camera or IR. As you specify, you want to do it by camera. In this case, you have a lot of options....


1

Yes. You can do far better. My pigpio Python module will give a million steps for frequencies less than 250 Hz. pigpio will give a resolution of 250 million divided by the frequency in hertz that you want to use. See hardware_PWM Example Script #!/usr/bin/env python import time import pigpio PWM=18 FREQ=5000 pi = pigpio.pi() if not pi.connected: ...


0

Bart van Leeuwen pointed me to CustomPiOS as a nice solution: https://github.com/guysoft/CustomPiOS It may not work for my project, because it is bound to Raspbian (and I will need PiCore), and it is not Python, but as far as I can know, it is the best solution to the problem of generating custom images for Raspberry Pi projects. Here is a list of ...


2

From here # python2.7 >>> from pythonwifi.iwlibs import Wireless >>> wifi = Wireless('wlan') >>> wifi.getEssid() 'romanofski' >>> wifi.getMode() 'Managed' And here def scan(self): """ Returns Iwscanresult objects, after a successful scan. """ return Iwscan(self.ifname) So # python2.7 >>> from ...


1

In the second section of code: gpioConfig=[19] so i=19 j=1 and never increments newState=statuses['gpio1'] which gives 1 As newState == 1, GPIO 19 is only every set to HIGH


0

Update 2020jan12hkt2102 I read the program a second time and found the following things: (1) This statement: _thread.start_new_thread(updateGPIOstatuses, pins,)) seems to call function "updateGPIOstatuses()" with two arguments "gpioCheckerInterval" and "pins". I guess "pins" means a list of GPIO pin numbers, eg 19, 8, 3, etc. But ...


1

How simultaneously do you need it to be? If "within a couple of seconds" is fine, then just call your scripts sequentially via SSH: sshpass -p 'raspberry' ssh pi@192.168.0.2 python take_photo.py & sshpass -p 'raspberry' ssh pi@192.168.0.3 python take_photo.py & You may want to setup a passwordless login to make the commands simpler. If you need to ...


0

I just had the same project today, here is how I did it. boot the Raspberry Pi in the lastest version of Raspbian click on the raspberry icon at the top-left corner, then click "Add/Remove Software" type "linphone" in the search bar. You will see a package called "SIP softphone-graphical client". Install that package. find linphone in /usr/bin, execute it ...


5

Okay, I have solved my problem. I reinstalled Python 3.6. Then I used this command sudo apt-get install libhdf5-dev and then sudo pip install tensorflow and installed TensorFlow successfully! I think the problem was with my Python installation. Thanks to all of you for your kindness. Cheers!!!


1

Apparently the problem is noise on the PIR power line triggering the PIR. This can be caused by virtually any other device, even the MCU doing something. I have the same problem caused by the MCU going into sleep mode. Some suggest filters on the power line, some get away with delaying re-arming of the PIR until nothing else is happening which could cause a ...


0

I have the same situation as you, I find out the warnings are created by the pyaudio but don't impact on it working normally. You can delete the warned sound cards in the file /usr/share/alsa/alsa.conf or you can use os.close(sys.stderr.fileno()) to close the sys warning reference (https://stackoverflow.com/questions/36956083/how-can-the-terminal-output-...


0

Here is my solution. This works for SSH terminal, or crontab: import Tkinter import sys import os if os.environ.get('DISPLAY','') == '': print('no display found. Using :0.0') os.environ.__setitem__('DISPLAY', ':0.0') #create main window master = Tkinter.Tk() master.title("tester") master.geometry("300x100") #make a label for the window label1 = ...


4

12V pump will require 12V PSU. 20LPM is a pretty reasonable flow rate for a small pump so your pump PSU will need to have enough power to drive the pump - check the max current draw on startup (which will be higher than the running power draw) and size the PSU accordingly. Check the contact handling voltage/current for your relays. "5V" relays (as ...


1

I've come up with a solution! import Tkinter import sys import os # check if if os.environ.get('DISPLAY','') == '': print('no display found. Using :0.0') os.environ.__setitem__('DISPLAY', ':0.0') master = Tkinter.Tk() #master.title("tester") #master.geometry("300x100") # Lay out label #label.pack() # Run forever! master.mainloop()


1

I expect the error is given because there is no module named lcddriver.py which is what import lcddriver will be looking for. Rename lcddriver to lcddriver.py.


0

though it is probably Pi 3 specific, since it didn't work for my Pi 4 It works on the 4 as well, you just need to set the right trigger. The instructions that you provided are not applicable to the 4 or just incorrect. This will tell you what triggers you have available: cat /sys/class/leds/led0/trigger To enable manual control on a 4, do: echo gpio |...


2

Here is what comes to mind first, but maybe there are other ways. Using FIFO file, arecord tool and using python here, something like this must be possible. :


0

Your question is unclear. If you plan to make new images each time using latest available packages it is a non-trivial task, which requires manual intervention to test compatibility etc, but there are available tools. If your intention is to customise an image, adding your own packages it can be done, but there is no way to avoid the effort involved in ...


2

Depending how the ads1115 is connected to the PCA9546 there are several ways to approach. For example if the 4 ads1115 is pinned out to have different address ( the ads1115 support upto 4 address; 0x48,0x49,0x4a,0x4b) you may use this line of code to select 1 - 4 channels, assuming the address of the PCA9546 is 0x77 i2c.writeto(0x77, bytes([0x01]), stop=...


1

Question How to use Rpi4B to control multiple ADS1115 I2C ADCs, using PCA9546/TCA9548A I2C Multiplexer? Answer (1) PCA9645 Datasheet Section 6.1 explains the device slave address is 0x70 to 0x77. In other words, 7 PCA9645s can be placed on the same I2C bus. You use A2, A2, A0 address decode pins/bits to select which PCA9685 device (not channel) to use. ...


1

If you do not have special requirements to compile OpenCV from source it is not a good idea to do it, in particular by newbies. You find the OpenCV library in the default Raspbian repository. Just look at it with: rpi ~$ apt list *opencv* You will find 75 packages. Just pick that one you need and install it. rpi ~$ sudo apt install python3-opencv may be ...


0

A few thoughts :- This post shows a couple of possibilities. https://www.raspberrypi.org/forums/viewtopic.php?t=129021 MrEngman I gather wrote a helpful installer script for the Edmix range of Wifis. Research a bit more yourself before trying these perhaps. 1) Remove ifplugd apt-get purge ifplugd 2) Disable any conflicting drivers, read in more detail ...


0

I would like to suggest that you redo your code somewhat. In your sensor interrupt routines do as little as possible. Just increment the variable countLeft or countRight as applicable. Don't do the PID calculations here. The reason you do this is to allow you to complete an interrupt before another one comes along. Do the speed calculations in the main ...


1

From the pyinput documentation : The key parameter passed to callbacks is a pynput.keyboard.Key, for special keys, a pynput.keyboard.KeyCode for normal alphanumeric keys, or just None for unknown keys. 1) Is there any way to map the first key to something other than "None"? The type is : pynput.keyboard.Key. Key.media_volume_up and Key....


Top 50 recent answers are included