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
4answers
13k views

How do I download the Python libraries without a direct internet connection on my Pi?

I live in the sticks and don't have a direct internet connection on my Pi. I need to download the Python libraries and move them locally offline. How can I download them from somewhere I do have an ...
3
votes
1answer
2k views

Raspberry Pi camera doesn't work only displays red light

When I run my code, I get this error: No data received from sensor. Check all connections, including the Sunny one on the camera board The red light on the camera module glows, but doesn't ...
3
votes
3answers
7k views

Multiple Callbacks from GPIO interrupt

I created a quick program that uses the GPIO library to create an interrupt with a callback that is initiated when a (pink) button is pressed. It works, but when the button is pressed and then ...
3
votes
1answer
509 views

Is there a way to read the pullup status of a GPIO pin in python with, or if not, without pigpio?

I've discovered pigpio and am starting to learn to use it with Python. I thought I would use it to "discover" the pullup status of a pin before setting it, but while mode has both .set_mode() and ....
3
votes
1answer
1k views

How to cross-compile OpenCV and copy python bindings?

I want to install dlib and OpenCV on Raspberry Pi 2. As you know, if I try to compile those on the Pi directly, then a) It takes a lot of time (3-4 hours for dlib and then 2 for OpenCV) and b) It is ...
3
votes
2answers
6k views

PIL.Image from picamera.capture()

I want to get an image from the pi camera module and use the pillow imaging library to modify the image. The way I have been doing it up to now is to take a picture with the camera and then open that ...
3
votes
1answer
4k views

Reading serial data from Arduino

I have am working on a project where I'm trying to get a Raspberry Pi to play some sounds when triggered by button presses on an Arduino. The command is sent to Raspberry Pi through serial. I used ...
2
votes
2answers
9k views

Get USB address

I have a FTDI USB-Serial (UART) IC connected to my Raspberry Pi. When I type lsusb I can see all my USB buses: Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID ...
2
votes
1answer
5k views

How to initialize an ESC with Python code [duplicate]

I can't make my brushless motor move; it kepps on beeping. I have connected it to an electronic speed control (ESC) and am trying to signal the ESC from the GPIO pins of Raspberry pi B+. How do I ...
2
votes
2answers
1k views

Python script does not run when called by service

I have written a python program that continuously parses my current IP and emails it to me if it changes that I want to begin running as soon as the computer boots up: /home/pi/sendIP.py#note that ...
2
votes
1answer
1k views

KeyboardInterrupt Handling with picamera

So I have a python program in which I'm using the picamera library to shoot pictures and record video. I'm using my program for scientific purposes and my goal is keep each picture as close to the ...
2
votes
1answer
1k views

Launch Python script from Cron in foreground

I have developed a Python script that I would like to run at every boot of the Pi. The script in question is one that I do not want to run in the background. It will be controlling the display of ...
2
votes
1answer
220 views

Is there a way to enable VNC on my Pi with python?

I am creating a system and I want to make it as quick and painless to deploy as possible. I also need people who are unfamiliar with RPi to deploy it. So I am creating an installer that can handle ...
2
votes
3answers
14k views

How can I use a LCD display with a I2C adapter?

I'd like to try to communicate to a 16x2 LCD display, however whole docs I found assume I should connect the whole pin-out however I got some kind of I2C adapter from mjkdz.com which makes a 4 pin ...
1
vote
1answer
2k views

turn screen on and off with motion sensor

I'm working on a project which will use a PIR motion sensor to turn on a connected HDMI monitor when there's someone in the room, and turn it off when they leave. I'm new to Linux, but not to Python. ...
1
vote
1answer
945 views

smbus/I2C sensor returns fixed data

I am attempting to use a sensor in conjunction with a raspberry pi smbus. When I try and read a specific byte of data, it returns 181. No matter what byte you tell it to read it returns 181, ...
1
vote
2answers
4k views

spidev.xfer2 in python gives IOError: [Errno 22] Invalid argument

I am currently trying to follow this tutorial. I keep running into errors for the RPi part. I have received several error related to SPI. I removed SPI from my blacklist and followed the instructions ...
1
vote
3answers
2k views

Can I copy paste the SD card and use all developed programs?

I have used the NOOBs image and installed Raspbian distribution. I have another Pi with several scripts and programs I want to recreate to the new Pi. Can I do a simple copy of all documents from ...
1
vote
3answers
891 views

how to make radio wave with pi2

As pi2 have processing power of 900MHz it can generate upto 250Mhz radio frequency. I have run fm_transmitter on pi2 it was working but only with one song(star_wars.wav) and code was in c++. Does ...
1
vote
1answer
3k views

How to set a permission to call a Python script from PHP?

I connected an Arduino Nano via USB to my Raspberry PI3. The Arduino is programmed to send (via serial) 16 bytes of information every 500 milliseconds. In this RPi3 I have Python, Apache2 and PHP5 ...
1
vote
1answer
3k views

How do I write my temperature data to Windows Azure's Sqldatabase?

I'm new to Raspberry PI and need help on this part as I need to write my temperature data to Windows Azure's Sqldatabase. import smbus import time import datetime #SMBus(0) - Raspberry Pi Model A #...
1
vote
1answer
5k views

Start/stop Fan at certain time

I have connected a fan to my raspberry pi with a transistor that sits on pin 5 ( GPIO 5 ).' I followed an online "guide" to make it. I would like to make a script that makes it run during the day, ...
1
vote
2answers
2k views

How to run python script on pi without logging in everytime

I want my pi to run a python script on it everytime I plug it into any power source. My pi collects data from MSP430x and upload it on a cloud server. I want to keep it running all the time and I can'...
1
vote
2answers
6k views

Capturing serial number of 2 USB RFID Reader in python (PI+2 RFID (Mifire RFID))

I've tried several programs to capture the serial number of 2 USB RFID Reader. I use 2 Mifire RFID (named RFID A & RFID B) and they connected to my Raspberry Pi. I want the Raspberry Pi ...
0
votes
1answer
128 views

trying to run 6 USB cameras simultaneously on a single Raspberry Pi 3B+ with add-on 4 port USB hub with external power

We are trying to simultaneously run 6 cameras on a Raspberry Pi 3B+ with an add-on 4 port USB hub that has an external power supply. The cameras are set at 15 FPS with a colour image size of 640 X 480....
0
votes
1answer
4k views

Installing Kivy on Raspberry Pi 3 and making it work with Python 3.4

(This may be a duplicate of an unanswered question at How do I Install Kivy for python 3.4 on my raspberry? Is that possible? , but I'd like to add some details to this.) I have followed the default ...
0
votes
1answer
232 views

GPIO outputs not changing on specific GPIO ports

I'm using a Rpi B rev2 and I'm having problems changing the output of ports 2,3,4,5,6 (BCM). All the other ports work perfectly. I searched for documentation and I see the only thing that sets these ...
0
votes
2answers
670 views

How do I Install Kivy for python 3.4 on my raspberry? Is that possible?

The question is on the title XD How do I Install Kivy for python 3.4 on my raspberry? Is that possible? I tried using the https://kivy.org/docs/installation/installation-rpi.html guide but thats only ...
0
votes
1answer
1k views

Fastest Hardware Interrupt software?

I'm wiring my Raspberry pi to a USdigital encoder , especifically this model "H6BM-1000-500-IE-S-H" , it has 1000 signals per revolution , I've followed the tutorial on http://raspi.tv/2013/how-to-...
0
votes
3answers
975 views

Why can't I connect to my Raspberry Pi through SSH on my PC or a phone app?

I tried to SSH into my Pi using PuTTY, but I got an error: Network Error: Connection timed out I have checked my router, noted that the device is indeed connected to the network, I was able to use ...
0
votes
1answer
1k views

Using a switch, not push button, to play mp3s

I'm trying to setup a switch on a breakout board which, upon flicking the switch, will allow me to play a short mp3, then loop a second mp3 until I switch it off. When I do so, I want it to play a ...
0
votes
2answers
3k views

How should I properly communicate 2 Raspberry Pi via UART?

I'm testing serial communication with Python pyserial module. I try to communicate some strings between two Raspberry Pi's ... I tested transmitter and receiver code at same device connecting it's ...
8
votes
1answer
48k views

Using python with bluetooth to communicate

I'm trying to write a simple program to communicate between the RPi and a bluetooth cellphone. I went with this tutorial: Bluetooth Python tutorial for RPi and was able to connect to the phone and ...
5
votes
1answer
1k views

Raspberry Pi 2 and thermal printer

I try to print some text with python and a thermal receipt printer by a Raspberry Pi 2 model B. I use the library developped by Adafruit and the printer sold by Adafruit too. But it fails. The only ...
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
2answers
8k 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
3answers
7k views

How to Run pigpiod on boot

In order to use pigpio Module in Python (remote GPIO for Raspberry Pi ), pigpiod has to be loaded to memory on each RPi. what is the right way to to it ? during Ubuntu's boot or a part of Python's ...
5
votes
3answers
4k 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 ...
4
votes
1answer
11k views

Pi to act as GSM voice phone

I won't know for certain until I've implemented it, but I've marked ppumkin's answer as The Answer. I will have a Huawei 3G (or GSM) dongle attached to my raspberry pi. I haven't purchased it yet, ...
4
votes
2answers
18k views

how do I enable JPEG support with PIL?

By default, PIL doesn't have jpeg support on the Raspberry Pi, so it returns the following: IOError: decoder jpeg not available This can also be seen while installing PIL: *** JPEG support not ...
4
votes
3answers
252 views

Python script run from crontab does not recognize USB drive mounted later

I am having a bit of a problem here, I really hope some of you can point me in the right direction: I made a python3 program running a loop and checking if the file /DATALOGGER/DATALOGUSB/SETUP.py ...
4
votes
1answer
6k views

Python 3.6 on Rpi3 Raspbian isn't default after install

On a fresh install of Raspbian Jessie+PIXEL (1/11/17 release), I installed from the source Python 3.6.0. I downloaded the tgz file from Python.org and built from source. I used a couple of sources ...
4
votes
2answers
15k 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 ...
4
votes
1answer
699 views

GPIO stuck in High Mode

I'm new to this whole RP world, and I'm trying to learn it. I've been trying to follow this post, and connected my Pi this image below Connection between Pi and Adafruit T-Cobbler Plus Wiring ...
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
1answer
293 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
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 ...
3
votes
6answers
30k 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
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 = ...