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
4
votes
2answers
2k views

Raspberry Pi camera doesn't work only displays red light

When I run my code, I get this error: No data received from sensor. Check all connections, including the Sunny one on the camera board The red light on the camera module glows, but doesn't ...
4
votes
1answer
17k views

How to use a 4x4 keypad in Python?

I have a Keypad 4X4, but my actual code doesn't work. See below: import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) MATRIX = [[1,2,3,'A'], [4,5,6,'B'], [...
4
votes
3answers
6k views

Cannot connect to PiCamera when using it with Flask

I am trying to create a live streaming camera with my Raspberry Pi and the Pi Camera module. I have chosen to create it with Flask so that I can use the Python API for it. Though when I run this ...
4
votes
2answers
15k views

How to trigger GPIO event using an active infrared sensor

Trying to get an active infrared sensor to trigger an event on a GPIO pin. I'm using python and the RPi.GPIO library on an RPi model B. Some background info, not sure how relevant it is, but I'm a ...
4
votes
2answers
6k views

Resetting usb device from terminal

I am using a USB IR Toy v2 and using this excellent https://github.com/crleblanc/PyIrToy python library to get it working after failing to get things going with LIRC. However, while it works once, ...
4
votes
3answers
6k views

Connect sim800 to Raspberry PI (RX, TX)

I've been trying to connect my sim800L to my Raspberry pi 3 model B (rasbian) but without success... I'm at the very first step, and since I'm new to Raspberry pi, I don't understand very well how it ...
4
votes
2answers
621 views

GUI with integrated Gnuplot

I am building a Raspbian app user-interface that displays two side-by-side data plots using the Gnuplot library. One way I could do this would go something like this: Create Gnuplots Export as PNG ...
4
votes
1answer
3k views

How to read the status of the Power-LED on Raspberry Pi 3 with Python

How to read the status of the Power-LED (or the rainbow square - if you like that better) on Raspberry Pi 3 to detect an low-voltage-condition in a python script? Since the wiring of the Power-LED has ...
4
votes
1answer
7k views

Control seconds SPI interface with SpiDev

Is there any option to control the second SPI interface of Raspberry Pi 2 B with SpiDev? http://pinout.xyz/pinout/spi Pin 19, 21, 23 are SPI0 and Pin 35, 38, 40 are SPI1. SPI0 works perfect, but if ...
4
votes
1answer
700 views

GPIO stuck in High Mode

I'm new to this whole RP world, and I'm trying to learn it. I've been trying to follow this post, and connected my Pi this image below Connection between Pi and Adafruit T-Cobbler Plus Wiring ...
4
votes
1answer
520 views

The following packages have been kept back: mopidy

After performing sudo apt-get update && sudo apt-get upgrade, I got the message The following packages have been kept back: mopidy What I usually do in this case, is sudo apt-get install ...
4
votes
3answers
2k views

How can I add an On-Off switch to my Raspberry Pi 2

I want to add a on/off switch to my pi 2 to correctly shut the pi down This is the switch I want to add: Edit: moved from a link to be included below: This guy in a Raspberry Pi kik group made this ...
4
votes
2answers
15k views

Controlling a fan on a relay with python

I have a Raspberry pi Model B revision 2 and I've set up a mini 5v fan on a relay switch which i want to control with python now. I will be running a crontab every hour to check the temperature of the ...
4
votes
1answer
8k views

Custom White Balancing with picamera

I need a method to set the White Balance of the raspberry pi camera by "teaching it". Such as it is in DSLR cameras, I'd like to show a white picture to the camera and say "OK, this is white, now ...
4
votes
1answer
11k views

Pi to act as GSM voice phone

I won't know for certain until I've implemented it, but I've marked ppumkin's answer as The Answer. I will have a Huawei 3G (or GSM) dongle attached to my raspberry pi. I haven't purchased it yet, ...
4
votes
2answers
3k views

Record raw PCM from microphone

I have a small project I'm working on that will use real-time audio processing. Until now I've been able to record (via the arecord command) straight to a .wav, but like I said I need real-time ...
4
votes
1answer
55 views

How to Monitor GPIO Input Indefinitely Without Recursion

I actually joined StackOverflow to ask this question because I wasn't sure it was RPi specific, but as I was thinking about how to form the question, I realized it might be GPIO specific (for some ...
4
votes
1answer
2k views

When do I want Python 2 vs Python 3 on the Pi?

I've never programmed in Python, but I recently came across an article talking about the differences of learning Python 2 vs Python 3 and committing to one version or the other. What are the abstract ...
4
votes
4answers
4k views

Read data from Si7021 via I2C

I have an Si7012 temperature / humidity sensor attached to the i2c pins on my Raspberry Pi. Specifically, I have the Adafruit "break-out" with this sensor attached https://www.adafruit.com/product/...
4
votes
1answer
2k views

PWM control of motors with PHP front end

I have a dual H bridge connected to my Pi for controlling 2 brushed DC motors with. I intend to have a web interface to control the speed of the motors. I'm thinking of a HTML page submitting AJAX ...
4
votes
2answers
667 views

Python: Is there any way to get a list of IPs connected to a network

Is there any way to get a list of IPs connected to a network? I'm trying to build lots of networking tools so.
4
votes
4answers
13k views

How do I download the Python libraries without a direct internet connection on my Pi?

I live in the sticks and don't have a direct internet connection on my Pi. I need to download the Python libraries and move them locally offline. How can I download them from somewhere I do have an ...
4
votes
3answers
7k views

Safely Logging Data on Raspberry Pi

Currently I am reading data from a GPS receiver through USB on a raspberry pi and I would want to log this data on the SD card. I am collecting the data through Python by using file = open("file.txt",...
4
votes
1answer
2k views

Comparison of Python Gui performances

I am building a data visualization application. It is a multithreaded Gui without user interaction. I have 24 widgets that shall be updated any 100ms. 16 widgets are PyCairo rectangles and the other 8 ...
4
votes
1answer
339 views

SMS API via Raspberry PI

I want to calculate the temperature and humidity via sense hat integrated with Raspberry Pi 3. Is there any free API for SMS available currently?
4
votes
1answer
961 views

Getting started with image processing using opencv in windows and using in raspberry pi

I am learning image processing using opencv in windows. In another project that I am working on, requires the image processing to be done in raspberry pi for object recognition. Since I do not own a ...
4
votes
1answer
2k views

Counting Pulse Length Using PiGPIO

Background I am trying to get a particle sensor to work with the Raspberry Pi (model B+). I am using the Shinyei PPD42N6 (datasheet here). The sensor outputs a digital signal with pulses ranging ...
4
votes
1answer
4k views

Piezo with Python

I've found Piezo example for Rpi with specific libraries in Java and C (wiring) -- are there any for Python? I've seen PyPiezo but it seems to be for specific hardware.
4
votes
1answer
2k views

RGB LED is not lighting up

I connected an RGB LED(common anode) via the GPIO, and tried to get it to light up, but for some reason when I run the command, the LED does not light up. Here's the code I'm using import RPi.GPIO ...
4
votes
8answers
12k views

how to turn on and off an led with only a tactile button

I'm a beginner to the raspberry pi and python. I want the pi to act like a flip flop to the led so that when i push the button once, it will turn on and if I push it again, it will turn off and so on....
4
votes
2answers
18k views

How do I run a python program as a process in the background?

I have made a little python program that lights up some LEDs to display the current heat of the pi, but I want to run it while I'm doing other stuff. I don't want it to run in a window because I often ...
4
votes
1answer
12k views

SimpleCV installation on Raspberry Pi

I want to install SimpleCV, a Python framework for computer vision, on my Raspberry Pi. These are the steps I followed: Step 1 - install dependencies sudo apt-get install python-opencv python-scipy ...
4
votes
3answers
258 views

Python script run from crontab does not recognize USB drive mounted later

I am having a bit of a problem here, I really hope some of you can point me in the right direction: I made a python3 program running a loop and checking if the file /DATALOGGER/DATALOGUSB/SETUP.py ...
4
votes
1answer
783 views

PyCharm 2017.3.3 hangs

There is PyCharm, an IDE for programming Python. It's available in a Community edition for Linux as well. The problem affects (at least) version 2017.3.3. I installed it as a normal user with wget ...
4
votes
1answer
4k views

smbus Import Error

I'm trying to use the module 'smbus' on python3. I've downloaded it - when I try to download smbus, it says that smbus is up to date and installed. However, when I try to use it, it says the module is ...
4
votes
2answers
7k views

Broken Python PIP install; What is the correct way to fix?

I have an install script that I've been using (and I swear it worked before on another Pi), but whatever I've done, it appears I have a broken install of pip, and I'm not sure how to fix it. I tried ...
4
votes
1answer
2k views

Serial connection Arduino - Pi

I am having an Arduino Nano sending "48" or "49" via a serial connection to a Pi. I'd like to use this input, but for some reason the connection always cuts out after a few seconds with the following ...
4
votes
1answer
9k views

Activate virtualenv & start script on boot - RPi

I am trying to start a python script that exists in a virtualenv from bootup on my RPi. From reading this post and the RPi rc.local post I know that I will have to add something like this to /etc/rc....
4
votes
2answers
73k views

Reading from serial port [loop]

I would like to read from the USB serial port from time to time in a loop. I can open the port and read data with: import serial ser = serial.Serial('/dev/ttyACM0', 9600) while 1 : ser.readline(...
4
votes
2answers
10k views

Pyaudio - Recording sound on Pi - getting errors

I'm attempting to record sound on the Pi. I am using PyAudio for this and everytime I do even the following: import pyaudio pa = pyaudio.PyAudio() I get the following errors: ALSA lib pcm.c:2217:(...
4
votes
3answers
6k views

Automatically start python program at start-up

I am working on a project that needs a special GUI that takes up the full screen. I know I can make the X-Window system start up on boot (using raspi-config then changing the setting) but is it ...
4
votes
1answer
4k views

Zbar Installation

I'm attempting to install zbar on my raspberry pi. I built the source by entering: ./configure make make install I don't get any errors or warnings from any of the above commands. After the install ...
4
votes
1answer
2k views

How do I install Tensorflow Lite on Raspbian Stretch?

Thanks for your help. I want to deploy a tensorflow neural network to a Raspberry Pi 3 B+ with the Raspbian Stretch OS, and I'd like to know the best way to install Tensorflow Lite (or Tensorflow ...
4
votes
2answers
505 views

Occasionally get “Register read error: 0xee06” when script is run with Adafruit BNO055

I'm running scripts on a Raspberry Pi 3 hooked up to an Adafruit BNO055 sensor, and occasionally when I run the test script I get this error: Traceback (most recent call last): File "...
4
votes
2answers
542 views

Thermostat for greenhouse

I want to prepare a homemade thermostat for my greenhouse project. I have enough knowledge about electronics and linux based embedded systems but I'm not skilled enough in programming, so let me ...
4
votes
1answer
376 views

getting two camera preview with raspberry pi compute module

You know raspberry pi compute module has two CSI camera inputs. I can connect two camera and activate both of them. I have a project with raspberry pi that I need to preview from both camera ...
4
votes
1answer
439 views

Picamera record video in one resolution and take stills in three other resolutions

I looked into the documentation of the picamera and wondered whether there would be a way to use the splitter option to have the picamera capture a video in 640x480 and asynchronously capture stills ...
4
votes
1answer
6k views

Python 3.6 on Rpi3 Raspbian isn't default after install

On a fresh install of Raspbian Jessie+PIXEL (1/11/17 release), I installed from the source Python 3.6.0. I downloaded the tgz file from Python.org and built from source. I used a couple of sources ...
4
votes
1answer
670 views

PWM dc motor using L293D weak sound

This is the problem: using this tutorial and Adafruit_Python_GPIO libs when start pwm and step up with DutyCycle and frequency I hear a weak sound from motor but unfortunely it doesn't move. Wiring ...
4
votes
1answer
499 views

Autorun Python script with shell

Having an issue when running a particular script automatically. It requires root permission, uses bluetooth, and prints in a Python Shell. What I did: sudo nano /etc/xdg/lxsession/LXDE-pi add @...