Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

27
votes
9answers
107k views

Running a Python script at startup

This question has been asked quite a few times before but I didn't seem to get it working using the existing information. My Pi runs Raspbian. I have a Python script named dnscheck.py which loops ...
17
votes
3answers
22k views

Why are some GPIO pins HIGH when the Raspberry Pi boots up?

I have an easy circuit wired up, with an LED connected to pin 18 on the BOARD reference. I run a simple program to put pin 18 to HIGH, which turns the LED on, and then a couple of seconds later, I set ...
12
votes
4answers
13k views

How to boot into own python script (GUI) only?

I have the following problem: Using a RaspPi 3B running Raspbian Jessie (version 4.4.26-v7+) I would like the GUI of a self-written python script to be executed on startup. I know that this question ...
10
votes
1answer
9k views

Raspberry pi GPIO input pins give random values

I've been playing a lot with the Raspberry Pi lately. But I have a problem. When I set up an input pin to check whether electricity is sent to it or not, it gives me rather unstable answers. A few ...
4
votes
2answers
1k views

How to set up dashboard for monitoring PI processes

I have PIs that use a schedule to play videos on loop. The PIs also use a daemon file 'surround.sh' to control the video player, and the daemon script allows the user to check the service status of ...
115
votes
1answer
279k views

What is the difference between BOARD and BCM for GPIO pin numbering?

When using the RPi.GPIO library in Python you have to call import RPi.GPIO as GPIO and then GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM) What is the difference between these two options?
22
votes
6answers
95k views

Raspberry Pi starting programs automatically on startup

I've built a wireless sensor network consisting of two Raspberry Pi's (runnnig Raspbian) with sensors on and a base station Raspberry Pi that collects the data. Each time I want to run the system I ...
14
votes
4answers
14k views

How can I use more GPIO ports on the Raspberry Pi?

I am currently planning a project for a course at school which involves using the Raspberry Pi - however I'm worried that I will not have enough GPIO connectors for the inputs and outputs that I will ...
12
votes
2answers
24k views

Using OpenCV with RasPiCam and python

Has any one been able to get OpenCV to directly play video from the RasPiCam board using python? I've seen some projects involving workarounds, but what I'm interested in is being able to use the ...
9
votes
1answer
12k views

PiGPIO Library Example for Bit-Banging a UART

The PiGPIO library http://abyz.me.uk/rpi/pigpio/index.html mentions that one of it's features is "software serial links using any user gpio". I take this to mean that you can use it to generate a ...
3
votes
5answers
15k views

UART problems on my Pi3

I am trying to send and receive radio signals using my Raspberry, but I am already stuck at the first step :) My Radio module uses UART for communication but I have failed to set up my serial ...
4
votes
1answer
309 views

Pi Glow programming on python

After following the steps on this page. I did everything correctly and when I try to run the test.py file it says this. Traceback (most recent call last) : File "test.py" , line 9, in <module&...
22
votes
2answers
38k views

How to get Python to work with Lighttpd?

I've got Lighttpd setup on my Raspberry Pi, but I'd like to get server-side code working now. I'm familiar with PHP, but I figure I should try Python as it's supposed to be the "go to" language for ...
25
votes
2answers
8k views

How can I use the GPIO pins as digital outputs?

I've read that the Raspberry Pi has a number of input and output pins. How can I switch them? (from Python?) What voltage logic? Do I need pull-up or pull-down resistors? Do I need to switch the pins ...
8
votes
1answer
1k views

Raspberry Pi Camera - When is it ready for next frame

When using apis like the C++ or raspicam api, you poll the camera with a grab(), or similar, method. When a frame is ready, the method returns. Is there a way of checking if the camera is ready ...
10
votes
2answers
33k views

How to get the Raspberry Pi's IP address for SSH

I am using Mac OSx to access my Pi via SSH. To access it, I know that I need the Pi's IP address. So, I decided to use a few Python commands which have always succeeded in giving me the local IP. ...
4
votes
1answer
2k 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
2answers
4k 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 ...
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
4k views

I am getting ghosting/bouncing on my digital input

I am meassuring data pulses from my electrical meter, giving me one pulse per Watt used. I have 4 electrical meters connected to my Raspberry Pi model B. I have connected them directly like this (no ...
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/...
1
vote
2answers
9k views

Start python script at startup using SYSTEMD in RPI jessie

Setup: Raspberry Pi 2 Model B V1.1 Raspbian Jessie Version March 2016 Hi I am new in the RPI world, I managed to setup 2 DHT22 temperature sensors connected to GPIOs 22 and 23, 2 analog temperature ...
1
vote
2answers
2k views

No methods for running python script on startup are working

I can not get my python file to start on startup. I've tried four different methods (below) and they all work in command line but none of them appear to run on start up. As an example, the file is ~...
0
votes
2answers
4k views

Start and run a Python script at boot and use Cron to make sure its still alive

Hopefully someone can tell me if I'm going at this the right way. I have a Python script which I want to launch at boot. That was easy enough by putting a file in /etc/init.d/myBootFile I want to ...
0
votes
1answer
212 views

How to ssh without needing a password [duplicate]

I just want to run a python file on raspberry pi and use terminal code ssh. So, I don't want type password to do that. What should I do?
14
votes
4answers
60k views

Execute Python Scripts Via Web interface

I have seen a lot of projects which claim to control the GPIO pins, but I want something a bit different, for example, to be able to blink an LED. Is there a system out there where, via a web ...
14
votes
4answers
10k views

Falls off network (“Destination host unreachable”)

I am running my Pi headlessly, connecting via SSH over the network. I am having a problem that I can consistently reproduce. I will leave a Python script running on my Pi and come back a few hours ...
32
votes
5answers
60k views

How do I update my RPi3 to Python 3.6?

Python 3.6 just came out. I tried following these instructions to build from a tarball, but it got hung up on the make command, so I terminated the process after 20 minutes or so. I also noticed that ...
6
votes
1answer
33k views

Real time audio input/output in Python with PyAudio

I am trying to get my Raspberry Pi to read some audio input through a basic USB souncard and play it back in real time for 10 seconds, and then print the output with Matplotlib after it's finished. I ...
4
votes
3answers
49k views

PHP to execute Python scripts for GPIO

I found this code somewhere, that can execute Python scripts from PHP. I've installed apache2 on the Pi and I'm able to access the PHP script. But when I press the HTML buttons, nothing happens! :( ...
11
votes
3answers
153k views

How do I run a command line command in a Python script?

I'm using 2 separate scripts, Scale1.py and Scale2.py. To run them I enter sudo python Scale1.py or sudo python Scale2.py from the terminal command line. I would like to have a line in the Scale2.py ...
5
votes
2answers
9k 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 ...
1
vote
4answers
22k views

PyQt5 on a Raspberry Pi

I have a Raspberry Pi 3 with Raspbian installed, along with a 7" touch screen. I'm in the process of creating an application in Python to read several DS18B20 Thermocouples to monitor the temperature ...
5
votes
5answers
36k views

pymodbus rtu RS-485 communication

I have this little device for communication, and I can see the dongle after lsusb, and it is attached to ttyUSB0 (output from dmesg). Since the module has its driver that is installed to Raspberry Pi, ...
4
votes
2answers
6k 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 ...
2
votes
2answers
47k views

Server and client between PC and Raspberry Pi

Hi I am doing a project that I want to make Raspberry pi and Pc communicate and then Pc can get pulse signal sent from raspberry pi. The first step I think to do is to write a python server on ...
6
votes
4answers
27k 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
4k 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
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
1answer
187 views

PWM Servo - Check availability

I'm writing a program which requires Servo's basic movement. Here's the code: import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.OUT) pwm = GPIO.PWM(18, 100) pwm.start(5) ...
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 ...
3
votes
3answers
23k views

Python script with loop that detects keyboard input

I have a python script that uses a library to talk to GPIO in a constant loop. How can I detect keyboard input inside the loop and choose to exit the loop? while True: for item in pics[1:]: ...
2
votes
3answers
5k views

How to read a long int via i2c?

I tried to connect an Arduino Uno with my Raspberry using the i2c bus, with code and wiring suggested here. This example is sending only one byte from RPi to Arduino and back, and everything works ...
2
votes
3answers
5k views

Starting Python Program with Screen Automatically

I'm trying to turn a headless Pi into a single purpose computer. The application I wrote uses a ncurses GUI and I want it to start on boot. The program also needs to be run on a separate 'screen' (...
1
vote
5answers
15k views

Python run script in new console on startup [duplicate]

I try to start a python program (for accessing the camera, but that is irrelevant) every time the raspberry pi boots. The tutorials I read said one should add the corresponding command in /etc/rc....
0
votes
1answer
5k views

QtPy5 on Raspbian, getting ImportError: cannot import name QtCore

I need to be able to use the latest WebKit that includes WebRTC support How do I install Qt5+QtPy5 on Raspbian? What I have tried so far... Installed Qt5 on RPi2 - PASS Native build Qt5 on RPi2 ...
3
votes
2answers
2k views

9 Data Bits on UART pins?

I am wondering if it is possible to send 9 data bits framed with a start/stop bit at 1.25MBaud. I am currently using PySerial to configure the UART pins on the pi. I've stumbled across a few ...
2
votes
2answers
18k 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....
1
vote
2answers
245 views

raspberry pi 2 raspicam auto start problem

I write a python program opencv and python. also I'm using raspicam and I want using my python program without keyboard and mouse. Of course auto run mode. I tried two ways like below and I can't find ...
1
vote
3answers
266 views

No access to USB port, when running python script on boot

I have a python script running with an RFID reader. The script runs fine when ran from terminal. When I add python /home/pi/script.py & to /etc/profile and reboot the Raspberry Pi, the scripts ...