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
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
313 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 ...
2
votes
0answers
83 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
1answer
218 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
4k views

ImportError: No module named 'PyQt5'

I am trying to get the script here to work on Raspberry Pi. I have tested it on Windows and Ubuntu and it works fine. But getting pyqt5 working on RPi seems to be a challenge. On Ubuntu the following ...
2
votes
1answer
917 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
2answers
350 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
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 ...
2
votes
2answers
21k 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
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
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
0answers
448 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
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
4answers
18k 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
1k 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
2answers
24k views

GPIO: Warning Channel already in use

gpio.py:5: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings. GPIO.setup(8, GPIO.OUT) That is what I get after I run: import RPi....
2
votes
3answers
885 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
516 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 ...
1
vote
1answer
597 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
2answers
8k 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
3answers
199 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
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
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 ...
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
1answer
665 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
182 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
2answers
913 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
2answers
863 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
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
1answer
205 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
4answers
60 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
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
1k 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
13k 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
2k 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
2answers
8k views

Python script does not continue after os.system command

First post and also first time experimenting with a PI & Python. I have a pi-3 model B with the 7" touchscreen and PIR sensor. My goal is to have it set up so that it constantly displays the ...
1
vote
2answers
12k 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
7k 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
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
1answer
523 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 ...
0
votes
1answer
48 views

Removing autostart program from .bashrc

Hello guys I made a really dumb mistake by adding a python script in .bashrc. I wanted to make this script autostart and followed a tutorial, where it said i should add it to .bashrc. Later on i read ...
0
votes
0answers
677 views

Simple Buttons with GPIO, not working

I' following this tutorial to have two buttons working with my Pi. The code I have is the same: import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_DOWN) ...
0
votes
0answers
211 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
6k views

Multiple Inputs through GPIO

I am currently trying to create a program that does something each time a button is pushed, it seems simple but for me this has been very difficult to acomplish. I am on python 2.7 (but I can go to 3 ...
0
votes
2answers
684 views

raspberry pi2 photogate

Two Questions: Hello in the video at 1:40, i had replaced the 4.3k resistor with 4.7k resistor, what would be the change in the gpio input when the ir phototransistor is active and unactive (light ...
0
votes
2answers
4k views

Run a shell script from a python script when a button is pressed

I'm trying to create a very simple python script that waits for a GPIO button press and then runs a shell script. I personally don't know much about python so what I've come up with is mostly from ...
0
votes
3answers
9k views

Python code for SW-420 vibration sensor [closed]

I bought an SW-420 vibration sensor. So, I want to make a sensor for touch and vibration detection. This is my first Raspberry Pi project. I was googling for open source Python code but couldn't ...
0
votes
1answer
552 views

Monitor data sent to 74HC595

I'm new to Python and Raspberry Pi, so please bear with me. I would like to intercept the bytes of data being sent to a 74HC595 switch register. GPIO pin 23 on my RPi is connected to the data pin of ...
0
votes
1answer
461 views

gpiozero: Ignore false positives/negatives

I've seen several threads where users experience some noise fluctuation in the GPIO input readings, for instance, without any physical change to a Button's state, the events when_released/when_pressed ...
0
votes
1answer
457 views

Executing multiple scripts on startup in a particular order

I am running Raspbian GNU Linux (9) Stretch, on my Raspberry Pi 3. Project Overview Python script which makes use of 2 inputs to the Pi. Calculations are performed based on these inputs, and values ...