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

Flow meter Raspberry circuit and problem receiving pulses

I am trying to connect a flow meter YF-S201 to Raspberry Pi B+. It has three wires --> Red -> 5V --> Blac -> Ground --> Yellow -> Signal I have a doubt with the cicuit, The flow meter works in 5V ...
6
votes
2answers
7k views

Read keyboad input from background process

For a new project, I need to read input from a USB barcode scanner (that registers as a keyboard) and perform some actions on the "typed" text whenever the Enter key was pressed. The requirement is ...
6
votes
1answer
4k views

RPIO does not work on Python 3, only in Python 2.7

I've installed RPIO library to my RPI following these instructions: $ sudo apt-get install python-setuptools $ sudo easy_install -U RPIO I'm trying to run this code (test.py): from RPIO import PWM ...
6
votes
4answers
27k views

Sending live data readings from Raspberry Pi to laptop

I have a simple Python code that takes readings from a temperature sensor. I wish to send these readings (each time one is recorded in the code's while loop) to my laptop so the values can be used in ...
6
votes
3answers
30k views

Serial Port on Raspberry Pi 3 ttys0

I have a Raspberry Pi B and a Raspberry Pi 3. I am trying to get the Raspberry Pi 3's serial port working. I have put a jumper across pins 8 and 10 to check the serial port is working. I've executed ...
6
votes
2answers
13k 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:(...
6
votes
2answers
1k views

Using Quickly to develop apps for Raspberry Pi?

Can Raspberry Pi apps be developed with Quickly on Ubuntu? I know there isn't Ubuntu for the Pi yet but what I want to do is develop the app on my Ubuntu machine, compile it and copy the deb file to ...
6
votes
1answer
2k views

Installing pymedia

I've got a project in mind and I would like to use the spectrum analyzer of pymedia to get frequency data from audio while it's playing. Has anyone managed to install it? I've tried and failed. I've ...
6
votes
1answer
6k views

Changing RFID key for RFID-RC522

I have been playing around with my RPi2B (with Jessie), an adafruit breakout board and a RFID-RC522. I followed a guide to make it work, and it works like a charm Guide for adding RFID-RC522 to RPi2B ...
6
votes
1answer
629 views

My PI crashes and freezes when playing music from Spotify

I've programmed a small spotify application on my RPi that freezes quite often. I'm wondering if anyone here has any experience using pyspotify and managed to create a stable application using this ...
6
votes
2answers
11k views

USB microphone recording input and audio output

I've got a USB sound card which I'm trying to record from using the standard pyaudio tutorial for recording however I get the following (below). Frustratingly this script actually works on my mac and ...
6
votes
1answer
834 views

Rasberry Pi zero and 3 bluetooth transfer speed is slow RFCOMM

I am trying to send a series of bytes from the Raspberry Pi zero W to the Raspberry pi 3 via bluetooth. Im using the PyBluez python package. I believe that Raspberry Pi Zero has Bluetooth 4.1 and ...
6
votes
2answers
2k views

Impossible to scan RFID tags using libnfc, PN532, and RPi3

I recently bought this NFC/RFID reader PN532 module V3 I want to use it with my raspberry pi 3. I have install and configured the library libnfc. The PN532 is connected with I2C. I have well enabled ...
5
votes
5answers
5k views

How to start a python script at boot [duplicate]

What I tried: crontab -e creating a desktop entry at /home/pi/.config/autostart edit /etc/rc.local My python script: import os from gpiozero import Button from time import sleep from pynput....
5
votes
5answers
38k views

How does python GPIO bouncetime parameter work?

I have a simple Python script that is observing two GPIO pins, I've set the bouncetime parameter to 500ms, but I get multiple (almost always 2) calls to my callback, usually 3 or 4 ms apart. This is ...
5
votes
3answers
6k views

gpiozero Button.when_pressed

I'm learning python and gpio using the examples here: https://gpiozero.readthedocs.io/en/stable/recipes.html I wanted to extend the code to more than one button and pass a parameter to a function (...
5
votes
3answers
35k views

Python serial permission issue

I'm trying to connect my Arduino to my RPi through python and PySerial, and I'm using the following code: import serial ser = serial.Serial('/dev/serial/ttyACM0', 9600) and I was getting an issue ...
5
votes
2answers
10k views

How to Connect 6 ultrasonic sensors to a raspberry pi?

I need to connect 6 ultrasonic sensors to one raspberry pi and all six sensors should take the distance measurement same time. I have written the code and made the thread also but only two sensors ...
5
votes
3answers
21k views

Python Script Stops Running After about 3 Hours

I realize this is a somewhat vague question, but, I have a python script that needs to run for two years on a raspberry pi and is failing after about 3 hours. Without getting into to much detail as to ...
5
votes
1answer
30k views

Does RPi 3 have BLE (Bluetooth Low Energy/Bluetooth 4.0/Bluetooth Smart)

I am wondering if the RPi3 has BLE built in. (Not standard bluetooth, but BLE) And if it does, how do I find BLE devices or install BLE software or whatever, as I know Raspbian doesn't support BLE ...
5
votes
3answers
5k views

Display IP Address on Character Based LCD

I need to know the IP address of my raspberry pi. I need to do this with a Character LCD display. So here's what I have done so far. I can display text on a HD44780 based 16x2 LCD connected to my ...
5
votes
2answers
474 views

Can the Raspberry Pi 4 better distribute Python scripts to all four cores?

This relates to previous questions regarding the GIL (Global Interpreter Lock) for Python on the Raspberry Pi. My question has to do with the new processor on the Pi 4 - does it still have the same ...
5
votes
4answers
10k 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 ...
5
votes
3answers
7k 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 ...
5
votes
2answers
10k views

Upgrade from Python 2.7 to 3.3,x

How do I uninstall Python 2.7 and install the latest Python 3.3.x? Tried using "upgrade" but it didn't solve my problem.
5
votes
2answers
4k views

Miniconda for ARMv6 (Zero W)

I want to install miniconda on my Zero W, but it has ARMv6 architecture and that does not seem to be supported by Continuum Analytics. See https://repo.continuum.io/miniconda/ (just one outdated ARMv6 ...
5
votes
4answers
5k 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/...
5
votes
4answers
13k views

How to use JSN-SR04T on a Raspberry Pi?

I want to try out JSN-SR04T, which is an ultrasonic distance measuring module, that is also supposedly water proof. The main reason that i want to try this module over the HC-SR04, is because the JSN-...
5
votes
3answers
5k views

OTA Update of Multiple Raspberry Pi's

I have 4 Raspberry Pi compute modules, running at different locations and I would like to run a script from the server that would connect and update the pi's with the latest version of the file found ...
5
votes
3answers
9k views

No module named 'ImageTk'

I am learning tkinter and trying to place an image on a Button, but I cannot get past the import. My code: from tkinter import * from PIL import Image, ImageTk The error: No module named 'ImageTk' ...
5
votes
1answer
12k 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 ...
5
votes
2answers
2k views

Raspberry Pi to Arduino (Leonardo) avoiding latency

I'm using a Python script via (TkInter) on the Raspberry Pi to capture mouse movement and events. My goal is to send this data, in real time, to another connected Arduino device(Leonardo). My first ...
5
votes
2answers
981 views

Autostart Python script doesn't work

I am trying to get my Raspberry Pi to open a terminal and run a Python script when it boots up. I have followed the instructions of some guides and have so far been unsuccessful. My steps I have ...
5
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 ...
5
votes
1answer
1k views

Does the Raspberry Pi support I2C multi-master configurations?

We are using Raspberry Pi 2 single board computers for test automation (they run our feature test against an actual DUT). Our Device Under Test (DUT) uses I2C multi-master mode to communicate with its ...
5
votes
1answer
624 views

I need to control 8 LED's but I can only control 3? [helpful pictures attached]

I'm very new to electronics in general, but I want to build a small project where I can individually control (from a GPIO pin) 8 LED's. From what I understand, each GPIO pin on the Pi (Pi2 model B V1....
5
votes
1answer
6k views

How do I boot the RPi into a python GUI instead of Raspbian desktop?

I've been trying to get the RPi to boot into a custom python script that constructs a simple GUI using pygame, but nothing I attempt has any success. What are the steps I need to follow to get this ...
5
votes
2answers
16k 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 ...
5
votes
1answer
5k views

Hue saturation intensity histogram plot

I am using pi with raspbian wheezy and python 2.7. I have an image in jpg format which I can read and convert to array. But I want to convert the image from RGB color model to HSI color model and then ...
5
votes
2answers
6k views

How to install smbus to virtualenv?

How to setup python-smbus in the virtual env? Pip does not find any appropriate package. Is there a way to make main python installation's libraries visible to virtual env?
5
votes
1answer
3k 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 ...
5
votes
3answers
29k views

How do I remove 'Python Games' from Raspbian?

When you download Raspbian, there are 'Python Games' installed. Is there an easy/clean way of removing this from the system including the Menu? I preferably want to get rid of whatever 'Minecraft Pi' ...
5
votes
2answers
12k views

How to read data from arduino with raspberry pi via I2C

I have connected Raspberry pi 2 model B with arduino uno via Bi-Directional Level shifter. Raspberry pi GND ---------- GND Arduino 3.3v ---------- 5v ...
5
votes
3answers
40k views

Error when attempting to create Python GUI using Tkinter: “no display name and no $DISPLAY environment variable”

Sup, I am simply trying to use Tkinter (a Python GUI creator) to create a GUI on my Raspberry Pi. To start, I only want a GUI to show up on my screen. That's it! The code DOES work on my PC The code ...
5
votes
1answer
2k views

PWM Control on Raspberry PI

Alright so I understand this question is fairly saturated, but my use in pwm is for two differing pieces of hardware. (Sourced from: https://www.modmypi.com/blog/raspberry-pi-gpio-en-franais) From ...
5
votes
1answer
15k views

How to prevent python script from running more than once? [closed]

I want to prevent starting the program if it is already running. Right now the same user can start the program multiple times and cause unexpected behavior. Is this something I should solve at the ...
5
votes
3answers
2k views

Raspberry Pi/“Arduino” communication

I'm looking to use a raspberry pi to speak to multiple "arduino" ATMEGA328p ICs (through a logic-level converter). I figure I can do this reasonably well over the GPIO RX/TX and use qualifiers to let ...
5
votes
1answer
1k views

How to Check GPIO pins simultaneously?

Can you give me an idea on how to check the statuses of specific GPIO pins if it is HIGH or LOW? My project is all about checking the statuses of GPIO pins (6 GPIO pins). I want to check all of the ...
5
votes
1answer
11k 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....
5
votes
1answer
11k views

Print output not shown when run Python script CRON

I am automatically running a simple python program from start up using cron. The pi boots / automatically logs in, displays the command line and runs the python program but the print output (updating ...

1 2
3
4 5
58