The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
1answer
8k views

Why can't I turn on an LED through Python?

I have an LED connected to pin 11 on the Raspberry Pi header, (also known as BCM/GPIO pin 17, and GPIO0). I have installed the Raspberry Pi Python library according to these instructions. Attempt 1 ...
3
votes
6answers
32k views

How to install python3-matplotlib on RasPi?

I hope there is a simple way to install python3-matplotlib package on my RasPi. My OS is raspbian. I've tried already: sudo pip3 install matplotlib (command gcc failed with exit status 1) also: ...
3
votes
1answer
341 views

Strange I2C behaviour

First of all: sorry for the title, I don't know how to describe further... Background: I'm working with the RDA5807M FM receiver chip. It worked fine for at least one month now. I just had jumper ...
3
votes
2answers
1k views

Powering several LEDs from GPIO output

I'm currently working on a "rotating cube" project where a raspberry pi will be used to determine which cube face is at the top and any given time using an accelerometer and light it up with LEDs. So,...
3
votes
1answer
299 views

Output from pigpio unexpected

I have attached a DHT-22 weather sensor to my rev 1 raspberry pi after a fresh install of a recent install of debian. Following the instructions from https://www.youtube.com/watch?v=IHTnU1T8ETk I ...
3
votes
1answer
2k views

Redirect stdout and stderr to file from background

I am running a python script on startup like this (in /etc/rc.local): /usr/bin/python3 -u /path/to/script.py > /path/to/output.log 2> /path/to/output.log & (The -u option was a failed ...
3
votes
2answers
1k views

Unable to capture image using the Raspberry Pi Camera Python

The raspistill -o image.jpg command successfully captures images. But when I try capturing from a really simple Python script, I get an error. The script is from picamera import PiCamera cam = ...
2
votes
0answers
473 views

Error transferring file from Raspberry Pi to other device using Bluetooth [closed]

I wrote a Python script which can transfer a file from one Pi to another Pi specifically by using the MAC address of the other device. The problem is: I am able to send the file to one device, but ...
2
votes
4answers
19k views

Can't run python script from cron

Running latest version of Rasbian and want to execute /home/pi/temp.py from cron every 2 min. Have chmod 755 on the file When I run the command from the prompt it executes fine and the script does ...
2
votes
1answer
926 views

Switching between TV's displaying OSMC on Raspberry Pi through Mobile Apllication

Description : I am trying to make a remote controller for OSMC(Kodi) media player installed on Raspberry pi. Rpi will connected to mobile app through wifi. On the other hand Rpi is connected to switch ...
2
votes
1answer
4k views

Execute raspistill from Python

I was trying to capture images using the Python picamera module and was always getting Timed out waiting for capture to end error (See this question). Since the shell command raspistill works fine, I'...
2
votes
1answer
537 views

GPIO stopped working under Python after using SPI

I'm using a Gertboard, and the GPIO Python demos were running fine. I started using/modifying the DAC and ADC demo code, and now I can't output to GPIO using Python (e.g. the Gertboard leds-rg.py ...
2
votes
2answers
22k views

Reading data from external device

I need some help with data reading. In my situation, I have an Arduino Uno connected via USB to the RPi. The Arduino is sending data to the RPi with Serial.write(). The Arduino outputs 128 bytes each ...
2
votes
2answers
352 views

GPIO Display an Buttons dont work

i bought a pi 2 B last week with a ready to use 16x2 Display + Keyboard wich i pluged in the gpio pins. It looks exactly like this picture: When i start the pi, the background display lights up like ...
2
votes
1answer
304 views

py532lib - i2c - Working But Too Many Files Open After A While

I'm successfully reading data from my NFC tags with the py532lib, using the i2c connection, put out by Hubcitylabs 5 years ago. https://github.com/HubCityLabs/py532lib/blob/master/py532lib/i2c.py ...
2
votes
1answer
2k views

Invalid Sample Rate

I am running a Speech Recognition/PyAudio module on Raspberry PI. Every time I try to run my program, i end up with this message... pi@raspberrypi ~/Desktop/Projects/EDWIN $ python edwin.py ALSA lib ...
2
votes
0answers
92 views

How to manually adjust system clock for testing purposes

I have written a Python script that is set to run different functions at different days/times. I would like to test it by setting the system clock to 1-2 minutes before the dates/times that the Python ...
2
votes
2answers
4k views

IndexError DS18B20 Temperature sensor

I have this temperature sensor (DS18B20). I've followed the tutorial on Adafruit (here). First I had to setup some modules by doing: sudo modprobe w1-gpio sudo modprobe w1-therm Then I check the ...
2
votes
3answers
916 views

Is it possible to control a stepper-motor with javascript?

So I have seen some examples, how you can control servo-motors with javascript, but we use 2 stepper-motors for our project and these use an extra library in python. So is there a way to control them ...
2
votes
1answer
2k views

Voltage Meter with MCP3008

So I am attempting to use an MCP3008 chip to create a Voltage meter with the Raspberry Pi (I have a Pi 2 Model B). I have been following this tutorial: https://www.raspberrypi.org/learning/physical-...
2
votes
1answer
7k views

Problems Regarding Raspberry Pi Project with MQ-2 Gas Sensor

Recently I have been learning Python implementations on Raspberry Pi's GPIO system. I'm interested in wireless sensor network examples and decided to make a fire alarm system using MQ-2 sensor as the ...
1
vote
4answers
159 views

program my robot with python

initially my question was about how to fix my code. You informed me that usage of that python class will not work with my setup of one motor. I agree and I want to instead use the GPIO library to ...
1
vote
2answers
896 views

SPI SDA GPIO Rspi

Can anyone help me to connect more than 2 devices (other CE0 and CE1) and use any GPIO for the SDA pin?
1
vote
0answers
1k views

kernel Disabling IRQ #49

I am using the RPi_GPIO library in a python shell to read a raw wireless signal using the wait_for_edge() function in a loop like so: while True: GPIO.wait_for_edge(26, GPIO.RISING) print 'R' ...
1
vote
1answer
497 views

Why is PIR motion Sensor always on?

I'm trying to make an alarm system but the motion sensor is always on as soon as the script is run. I've posted a question about a different problem i was having with this project so it'll confusing ...
1
vote
2answers
9k views

recording a video with picamera

I have this code which record a video when there is a motion, and the name of the video is the date that is the code: import RPi.GPIO as GPIO import time import picamera import datetime # new def ...
1
vote
1answer
580 views

SPI Communication with ADS7851

I'm currently trying to communicatie Raspberry Pi 2 B+ with ADS7851, an adc chip made from TI. ADS7851_DATASHEET I've done pretty much of research, but I'm still stuck on how to communicate in SPI ...
1
vote
1answer
8k views

How to use Arduino Motor Shield with Raspberry Pi?

I have currently started looking into raspberry pi projects. My background is in C# and Java. I do not have much experience with Python which seems to be the preferred programming language to do ...
1
vote
1answer
681 views

extend the current for PWM LED Control

i am using the raspberrypi to have 2 led's fade up and off. My script works and its ready to go. But i need to get my LED's brighter. Is there a way to extend the GPIO Current of the rasperry pi ? ...
1
vote
1answer
14k views

How can I develop a touchscreen GUI in Python?

I am new to touch screen programming, and I'm programming a camera in python. How can I create a touchscreen-compatible GUI in Python?
1
vote
1answer
5k views

Access numpy array in openCV

Using the documentation here here, the code import time import picamera import picamera.array import cv2 with picamera.PiCamera() as camera: camera.start_preview() time.sleep(2) with ...
1
vote
2answers
13k views

How can I install numpy and pandapower?

How can I install numpy and pandapower on the RASPBIAN JESSIE LITE Minimal image based on Debian Jessie? the one without the GUI. And how can I install Pip and miniconda on it as well?
1
vote
1answer
3k views

“ImportError: No module named 'gspread'”

I installed gspread library and ran pip install gspread and followed all the instructions on this page. I've read many other threads on this issue and have checked that no file named gspread.py exists ...
1
vote
1answer
245 views

How to open .bat file in VSCode using raspbian

From the website ( https://channel9.msdn.com/Blogs/jsturtevant/Setting-up-Project-Oxford-for-Python-on-Windows ) at about 4:27, the author opens the activate.bat file by using code .env\Scripts\...
1
vote
1answer
2k views

pigpio's spi_xfer and spi_open functions

In my previous project I have used spidev in order to work with ADC, and in python script I could have: spi = spidev.SpiDev() spi.open(0,0) ... adc = spi.xfer2([1,(8+channel)<<4,0]) Now I'm ...
1
vote
1answer
2k views

Video streaming via motion jpeg, python3-flask, and the camera module

Recently I've been working on a project to stream video from one raspberry pi zero with a camera module to another with a small TFT display. The application demands that this stream has very, very ...
1
vote
1answer
185 views

Python : determine which Raspberry Pi Model it is running on (etc)?

Now we have so many models of Raspberry Pi and considering the official software works on all of them....is there a Python Library that gives information about the host itself ? In particular what ...
1
vote
1answer
600 views

Can I run Python 3.3+ on Raspbian Jessie?

It seems like Raspbian Wheezy does not support Python 3.3, only 3.2. Can I run Python 3.3+ on Raspbian Jessie?
1
vote
1answer
1k views

How to turn Bluetooth on and off with Python 3?

First timer here. I'm new to RPi and Python in general. I am making an RC car with my Pi, an Adafruit PCA9685, and an old OUYA bluetooth controller. Everything works on my desk. But, I want it to ...
1
vote
2answers
986 views

Error in reading data with pymodbus

I have been trying to read data from a modbus slave device using pymodbus. After much research I found this code on internet. It is a straight forward code. I am able to read the data on windows but ...
1
vote
1answer
2k views

Raspberry PI 2 Model B Not Detecting ds18b20 Sensor (Tested with Multiple Sensors)

I just wanted to ask some advices. I have tried everything I could find, including : /boot/config.txt add Line dtoverlay=w1-gpio,gpiopin=4 Update and Upgrade Updating firmware Buying new Sensors. ...
1
vote
3answers
242 views

Ghost USB drives left behind when power is cycled off and on

I'm designing a kiosk device with a Raspberry Pi. The device is powered down by removing power without warning (not by graceful shut-down). If a USB drive is mounted at the time (say "SanDisk"), at ...
1
vote
4answers
67 views

How do I fix incorrect timestamps in my bash script that launches on startup?

I'll try to explain this the best that I can. I am creating a simple bash script that runs on startup. This script is supposed to create an archive based on the current date, run a python program that ...
1
vote
2answers
5k views

send gpio commands from rpi python script to another rpi

it is possible to control the Gpio of a raspberry pi connected by WiFi by another raspberry pi by a python script? I need to Connect\disconect some electric loads of my house switchboard, controled by ...
0
votes
2answers
32 views

Ultrasonic Sensor + omxplayer block CPU

Thanks to the community i create a scrip that check status of 3 ultrasonic sensors and depending on the status omxplayer will play a movie or other. Problem is that after few while and video loops CPU ...
0
votes
2answers
867 views

Geany IDE use python 3?… and where is my Tkinter window?

On my Pi that's now updated to a nice recent Raspbian, I am eager to start using the Geany editor for Python. But: (1) How do I force it to use Python 3.x? I can tell that Geany is using Python 2.x ...
0
votes
2answers
588 views

Picamera Python Library Alternatives

I'm looking for something like picamera python library, for USB webcams. Is there a python library that allows for image capture, and streaming for USB web-cameras?
0
votes
1answer
807 views

Raspberry Pi 3B keeps crashing after executing a python script

I'm trying to run a Python script on my Raspberry Pi 3B. It involves the OpenCV and the Tensorflow libraries, for object recognition. The camera I'm using is a Nilox MiniF action cam, set to the ...
0
votes
0answers
331 views

Python script wait for button press before starting/stopping a separate python script

I've written a python script (shown below) which starts and stops another separate python script (datalogger) once a button is pressed. The datalogger script records logic levels (0 or 1) and stores ...
0
votes
2answers
349 views

PIR Module False Positivesq

All I am working with a PIR Module and a camera for a project to provide text messaging when motion is detected as well as taking a picture. I am seeing a large number of false positives from the PIR. ...