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

Serial to Arduino totally non-responsive

I'm trying to connect my Arduino to my Raspberry Pi using the GPIO pins. I understand that the Pi uses a 3.3V signal while the Arduino uses a 5V signal so I bought a bi-directional logic level ...
29
votes
9answers
115k 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 ...
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 ...
18
votes
3answers
24k 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
1answer
10k 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 ...
125
votes
1answer
307k 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
96k 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 ...
12
votes
4answers
15k 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 ...
0
votes
3answers
1k views

Possible SPI issues around NRF24 operations post RPi system update?

I have a number of RPis that communicate with Arduinos via BLavery's lib_nrf24.py (which appears to be derived from Barraca's pynrf24). Recently several of the RPis automatically updated via apt-get ...
11
votes
1answer
13k 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 ...
13
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 ...
3
votes
5answers
16k 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&...
0
votes
2answers
119 views

How to wire a Raspberry Pi to a 16 channel relay module? It won't work

A am using working on a project that requires a camera analyzing some images and activating the appropriate GPIOs to control a relay board. I currently have a touchscreen display, a Raspberry Pi Cam ...
38
votes
7answers
159k views

Playing audio files with Python

I am looking for a well maintained Python library with allows me to play audio files on my Raspberry Pi using the standard audio output. So far I've tried several, but none of them seem to work. ...
23
votes
2answers
40k 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 ...
26
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 ...
15
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 ...
8
votes
1answer
2k 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 ...
11
votes
3answers
35k 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
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
2answers
5k 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
2k views

Raspberry Pi stable date time

I'm working on a Raspberry Pi project, in which date and time are the most important factors. So, I want them to be very accurate. I know there are two methods to configure the Raspberry Pi's date ...
2
votes
2answers
26k 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
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
1answer
112 views

Why is SPI not working on any of my Raspis?

I tried it on both Raspi 3 and 2 using the SpiDev python library. I've never even seen any kind of output on MOSI or CS lines with my oscilloscope. Controlling an SH1106 OLED display via the luma....
1
vote
2answers
3k 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
1answer
391 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?
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
66 views

How can I amplify my voice in real time just like a microphone does?

I am planning to make a microphone and speaker system to amplify my voice just like a normal microphone does. I have a sound sensor and a speaker... is there any Python code that I can use?
0
votes
1answer
145 views

Serial Communication from Raspbian using Python to Arduino

In Terminal its working but not working using python code. My Code: import serial from time import sleep ser = serial.Serial ("/dev/ttyS0") while True: received_data = ser.read() ...
15
votes
4answers
62k 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 ...
39
votes
5answers
70k 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 ...
15
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 ...
6
votes
1answer
40k 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 ...
13
votes
3answers
184k 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
4answers
29k 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 ...
4
votes
3answers
50k 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! :( ...
2
votes
2answers
2k views

Emulating a keyboard with the Raspberry pi Issue: Bluetooth instance has no attribute 'cinterrupt'

I am trying to turn my Raspberry Pi into a programable bluetooth keyboard by following this tutorial. I think I have been able to programatically send bluetooth keystrokes, however I have an error ...
5
votes
2answers
10k 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 ...
5
votes
5answers
39k 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
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
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 ...
2
votes
2answers
52k 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
29k 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 ...
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
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
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 ...