Questions tagged [python]

Python is a general-purpose, dynamically typed, object-oriented high-level programming language. Interpreters for versions 3.x and 2.x come installed on the Raspberry Pi's most popular operating system distributions.

Filter by
Sorted by
Tagged with
1
vote
2answers
502 views

mq5 gas sensor not alerting of leakages

I'm currently using an mq5 gas sensor in my kitchen with the MCP3208 ADC. my code shows a continuous loop of the voltage charge. in the mq5 as it detects gases in the air. It is supposed to print ("...
0
votes
1answer
66 views

Home System with Raspberry or Arduino? [on hold]

I am sketching a wireless system for my house to handle: from 4 up to 10 magnetic/pir sensors thermostatic sensor + display and 3 buttons (on/off heaters and up/down threshold temp) change the actual ...
0
votes
1answer
535 views

ShiftBrite - running on Python

I was wondering if anyone can help me out with converting the example Shiftbrite Arduino code into Python so I can run it on my RPi. Here is the example code in question: int datapin = 10; // DI int ...
1
vote
1answer
15 views

Pandasql on Raspbian?

Has anyone successfully installed the Python pandasql package on their Raspberry Pi? sudo apt-get install pandasql Gives the following results: Reading package lists... Done Building dependency ...
0
votes
2answers
2k views

smbus write_word_data command

I am trying to use the smbus write_word_data command which takes three arguments addr, cmd, value - all of the documentation that I can find tells me that I need to specify cmd, but gives no clue as ...
0
votes
1answer
3k views

python error: “ImportError: No module named encodings”

I'm in a bit of a python death spiral, here, with the "ImportError: No module named encodings" error when I try using python. I've read a dozen or so different posts on the problem, and none of them ...
1
vote
1answer
45 views

Nested Else issue. Very Basic

This is the code I am using to operate a relay to open my garage and the garage status is checked by a magnetic switch. However there is an issue with the logic can someone help me please as I am ...
0
votes
0answers
10 views

Rpi become frozen with python loop script after few cycles

It is a bit hard to show and ask to review entire code, so please let me describe it. I am using Rpi as serial-controller with python script but the python script become frozen.(technically I have to ...
0
votes
1answer
17k views

How do I get weight sensor's data to Raspberry Pi (HX711 Load cell)?

Can someone please give me the Python code to get the weight from a HX711 load cell into the Raspberry Pi? Also, can you please let me know if you used an I2C or SPI protocol?
0
votes
1answer
560 views

Raspberry Pi - Press for on / Press for off switch

I've begun tinkering with using electronics and am also new to using Python. I was wondering if someone could help me please? What I'm trying to achieve is to use an on/off switch to run a motor - ...
0
votes
3answers
1k views

Python Script that handles Bluetooth doesn't work when loaded on startup

Background I am using my Raspberry Pi B+ to control a 32x32 LED matrix and I am trying to send commands from an Android app to my Pi over bluetooth to display text on the LED matrix. I am using ...
0
votes
1answer
1k views

OpenCV VideoCapture.isOpened() always returns False?

I followed the installation tutorial at https://www.pyimagesearch.com/2017/09/04/raspbian-stretch-install-opencv-3-python-on-your-raspberry-pi/#comment-451314 , and everything installed fine. But I ...
-1
votes
0answers
20 views

How to avoid to create empty wave form in sending serial with pigpio

I am so frustrated with this problem, please help me if anyone knows whats happening here.. I am using pigpio in python 2.7/raspberry pi. the purpose is to control three devices over serial. It works ...
0
votes
2answers
2k views

Installing/using PyVISA-py on Raspberry Pi

I am trying to install PyVISA-py on my Raspberry Pi 3 Model B without internet connection, because I understand that the normal PyVISA needs the NI backend that is not supported on the Pi. However, I ...
0
votes
2answers
25 views

Ending a camera video stream in Python / threading

I’m very new to Python and have been struggling with the code for a wildlife camera project on the Pi. I’ve managed to get the PIR sensor and automatic camera capture working, but I’d like to have a ...
1
vote
1answer
5k views

Red LED on the Camera is not turning off?

The red LED on my Pi Camera is not turning off. Does this mean the camera is still on even after the camera.stop_preview() command is executed? def setup_camera(): camera = picamera.PiCamera() ...
1
vote
1answer
809 views

py-spidev and ADNS3080

I have been trying a lot to deal with the flow-motion sensor but I couldn't arrive to a clear result. It might be I can't understand the procedure.. I'm using cs1 on raspberry Defining the spi by ...
0
votes
1answer
4k views

Active Long Range RFID system for Raspberry Pi 3

I have bought those cards: UHPPOTE 2.4Ghz RFID Active Card for Long Distance Range Reader Vehicle Parking System. I need to buy certain RFID readers to be able to read data from those cards and work ...
2
votes
1answer
6k views

Send image from one raspberry pi to another via socket

I am new to posting questions on this site so forgive me if this isn't in the best place or if I do something wrong. I have two Pi's and I am trying to capture images in a loop (giving me a video), ...
0
votes
1answer
1k views

play audio stream when bluetooth connects

I have a Raspberry Pi Zero W and want it to use as an Internet Radio. So I wrote a Python script that connects to my bluetooth speaker and starts a stream. Everything works fine, but i always need to ...
0
votes
1answer
1k views

Boot to Kiosk Mode with Python Script

I am trying to get a python script with tkinter GUI to run in kiosk mode on startup without loading the entire X environments desktop and everything else. I have the following script in ~/.xinitrc: ...
1
vote
1answer
5k views

Selenium - Firefox - OSError: [Errno 8] Exec format error

I'm trying to run selenium on a Raspberry Pi 3. I've installed geckodriver and added it to my path. $: which geckodriver /bin/geckodriver echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/...
1
vote
0answers
16 views

I don't know why suddenly mjpg-streamer and webcam stop working

I have made a program that uses three webcams and three ultrasonic sensors using raspberry pi 3 and python 3. When each ultrasonic sensors detect stuff in front of them, webcam take a picture of it. ...
2
votes
1answer
342 views

Raspberry Pi 3 & Arduino: [bluetooth.btcommon.BluetoothError: (112, 'Host is down')]

I am trying to send informations from Raspberry Pi 3 to Arduino Uno with bluetooth. I managed to connect the Arduino's bluetooth module with the Raspberry Pi. But I have this error when I execute my ...
0
votes
1answer
24 views

Pigpio on callback get value

I currently have some code that I found that constantly outputs a value from a digital caliper. However, I want to modify this so that it is inside a function that can return that is returned from ...
0
votes
2answers
19 views

Pigpio equivalent of GPIO's event_detected() function?

Is there an pigpio equivalent to GPIO's event_detected() function? I need something that is constantly watching for a button press. The code I currently have doesn't consistently detect it (python ...
1
vote
1answer
1k views

“404 not found” error when requesting Python with Lighttpd through CGI

I've installed lighttpd and gotten it to serve /var/www/index.html just fine, but I haven't gotten it to run a Python script yet. I enabled CGI and set it's match case and directory as instructed in ...
1
vote
3answers
2k views

Alternatives to LIRC for transmitting IR codes

Alright, I've managed to get LIRC to work on a Pi 3, but not on a zero w running raspbian lite. I have the infrared codes I want to send (e.g 0x40BF or 0x8877) and I'm wondering if there's another ...
2
votes
1answer
31 views

Camera access in docker container is generating errors / locking

I am trying to build some machine vision software inside docker containers, it has worked previously, but now both devices are not able to access the camera. It seems to be a configuration/update ...
0
votes
1answer
471 views

Listen for certain keyboard input and insert to SQL Server DB

I have a USB NFC reader (acts as an emulated keyboard that types out the 10 digit ID number on the card when scanned). I want an app to listen for this input and when it sees 10 digits, I want it to ...
0
votes
4answers
1k views

boot up rasbian into gui program, no interaction

I have a project I want to do, and I got an SPI touch screen (tontec 3.5") for it. I want to start up into some sort of GUI application. I only have roughly 950mb left on my micro SD (8gb, install ...
1
vote
0answers
204 views

Error opening USB Cam with OpenCV4: GStreamer-CRITICAL **: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed

After installing OpenCV4.0 on my RPi, i tried a simple script below with a Logitech USB Cam (720p) but at "cam = cv2.VideoCapture(0)" it gives me an error "(python:num process): GStreamer-CRITICAL **: ...
1
vote
1answer
397 views

Access the display from a python app running as a service

Problem: The code below can't access the display when running as a service. I have my raspi hooked up to a touch screen monitor in the kitchen and I've attached a Passive Infrared sensor to the GPIO ...
0
votes
3answers
281 views

VNC: how to manage a fleet of RPi?

I've to manage 50 Raspberry Pis remotely, e.g. via VNC over the web. The RPis are behind a router, so I can't access them by IP. I'm looking for something like a self-hosted TeamViewer. The desired ...
0
votes
1answer
589 views

How can I run a Python script on boot with display support?

I need to run a Python script on boot with display support I have tried using rc.local, cron and a couple of other methods. All of them start the program and it runs as it should but I have a blank ...
0
votes
1answer
3k views

Scan Distance from Eddystone Beacons

I would like to read an Eddystone Beacon using my Raspberry Pi 3 to calculate distance from the beacon. I can't find any resources to do this from the official Eddystone documentation. How should I go ...
0
votes
0answers
29 views

Run program on raspbian buster LXDE startup

I know this question has been asked before, but the methods referenced are not working for me. Currently I have done this: sudo nano /etc/xdg/lxsession/LXDE-pi/autostart and added the line @python3 /...
0
votes
0answers
13 views

Can't read from serial0 using PySerial when python script starts at boot [duplicate]

I have a Python script that uses Pyserial, connects to '/dev/serial0' and reads from it in loop. The script works fine when starting it manually after the RPi is up. However, when I added the script'...
0
votes
1answer
1k views

Play different videos with omxplayer depending on reported sonar distance

I am a new to Python. What I want to do is that playing different videos depends on distance using Ultrasonic sensor. For example, if the distance <= 20, play movie1. if the distance > 20, play ...
0
votes
0answers
25 views

Raspberry Pi Zero W Temperature isuue [closed]

I have developed an application on raspberry pi zero w with raspbian buster lite. Application is about scanning beacon's mac. To scan the beacon data I took reference from https://github.com/...
1
vote
1answer
1k views

Kivy on Raspberry Pi: Mouse cursor not showing

I'm running kivy on a Raspberry Pi. I accepted that apparently you can't get around the fullscreen, but I can't get the cursor to show either. I tried by adding touchring = show_cursor=true to the [...
0
votes
1answer
51 views

problem when running the python application in /etc/rc.local in console mode

I'm coding an application to run when starting raspberry, however when trying to run this error is returned: QXcbConnection: Could not connect to display My application is done in python with qt ...
0
votes
0answers
19 views

MQTT and Rapsberry PI

When I connect to a newly installed Mosquitto client from my Windows machine it works fine See the python command below : >>> import paho.mqtt.client as mqtt #import the client1 >>&...
0
votes
2answers
35 views

Configure Raspberry pi to run my application before GUI Desktop

I have created an application through Python that has library dependencies on Qt4, pyqt4, pyqtgraph etc. This application is based on Raspberry Pi, I have developed and finished it on the platform. I ...
0
votes
1answer
909 views

How to identify the MAC address of built-in wifi in python

I'm experiencing some difficulties when I attempt to identify the MAC address of the built-in wifi in my raspberry pi 3 model B. My application requires the built-in wifi to always be identified as ...
2
votes
1answer
70 views

pi4 no module named gpio

I am trying to import rpi.gpio in my geany on pi4, but it comes with error no module named gpio. The odd is that i updated pip and python and installed successfully with sudo apt-get install python3-...
0
votes
1answer
591 views

Using gpio from CLI to trigger a rising or falling event detection

I have a python system script with various functions. I have multiple buttons hooked up to the Pi and I am using this code: import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(22, GPIO.IN, ...
1
vote
1answer
1k views

RFID RC522 Reader & Chromium Web Page

I'm having a bit of difficulty locating a specific example, however I have found people referencing that they have accomplished what I am looking for. At a basic level, I have a webpage being served ...
0
votes
2answers
32 views

RUN RC522 READ Python Script without SUDO [duplicate]

Im working with MFRC522-Python library, I READ the RFid Uid then I open a webbrowser with a specific URL composed by the uid of each card. The thing is in Raspbian Buster (RPI 3b+) cannot run Chrome-...
1
vote
1answer
4k views

Error trying to install python-firebase on Raspberry Pi 3

I have installed requests but I'm unable to install the python-firebase package. I want to fetch data from firebase on my Raspberry Pi 3. I have used the following code to do the same on my PC. from ...