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

Is running a CGI server as root too dangerous?

I've setup my Raspberry Pi with nginx and fcgiwrap as CGI. I wanted to control GPIO ports using a Python script with the Rpi.GPIO library. The problem is that in order to be able to control the ports, ...
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
619 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
5k 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
1answer
3k 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
5k 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
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 ...
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
733 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
27k views

Bluetooth import for Python Raspberry Pi 3

I have successfully connected my cell phone to the Raspberry Pi's onboard bluetooth. I know the Bluetooth works, but I cannot get import bluetooth to work properly. I get this error when I run the ...
5
votes
2answers
10k 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
1answer
8k 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 ...
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
1k views

Starting Browser from terminal and being able to control it via Python

I've got a Pi with a Adafruit TFT LCD installed. I'm using omxplayer and fbcp to stream videos at startup using python, like so: # Start Loop ct = 1 video_list = glob.glob('videos/*') os.system('...
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
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, ...
5
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 ...
5
votes
1answer
155 views

Login to Raspberry Pi Via Python Script

I am trying to make a system to login to the Raspberry Pi with an RFID tag. I successfully connected the RFID reader RC522 module to the Raspberry Pi and I can retrieve the number of the tag and write ...
5
votes
3answers
2k views

HC-SR04 randomly stops taking readings

I have implemented 3 HC-SR04 ultrasonic-distance sensors into my hobby-project, and they are working randomly, meaning they sometimes give me anywhere between 1-12 readings from the sensors and then ...
5
votes
1answer
368 views

What are the differences between these libraries? [closed]

Currently I don't know which library I should use OpenFace OpenBR OpenCV My system hast to recognize about 10 different persons and it will run on a Raspberry Pi 3 with the Raspberry Pi Camera ...
5
votes
2answers
3k views

Crontab on Rpi not running Python script

I have a simple problem that I cannot seem to find an answer to even though I have done some research. I am trying to run a python script via crontab (I have never worked with crontab before this haha)...
5
votes
1answer
5k views

Capture video for a certain time then quit and save to a folder using OpenCV 3

I am using this sample code from the OpenCV documentation and what the code is simply doing is capturing a video and when it's interrupted it saves it to a folder. What I want to do it capture the ...
5
votes
2answers
518 views

Pi Zero W not timing accurately?

Ok, I admit this a very odd issue I'm having. My setup is that I have an ultrasonic sensor that senses the distance every five seconds, and sends the data to another Pi, (a Pi 3 in this case) via ...
5
votes
5answers
1k views

Bluetooth buttons and mpg123

This is my first post. I have started a project with a rpi2 that currently allows me to bluetooth my rpi2 to a bluetooth speaker. On that bluetooth speaker there are three buttons. One that plays and ...
5
votes
1answer
8k views

Resolution properties for python's OpenCV and uv4l camera driver

I've followed this tutorial to install OpenCV 2.3.1 in raspberry and it has worked fine. I've also installed from here the uv4l raspicam driver. But now I need to modify some capture properties as the ...
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
1answer
418 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 ...
5
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 ...
4
votes
6answers
4k views

How do I know what version of Python script I'm writing?

As a newbie to Python on the RPi (or anywhere else for that matter), how do I know what version of Python (2 or 3) I'm writing for without looking up every command or syntax while trying to write a ...
4
votes
4answers
15k views

gpio library on windows while developing

I am new to Python so maybe this is not an appropriate question. I am working on a project on Python that will use GPIO functionalities of the raspberry Pi. Right now, I am developing the python code ...
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 ...
4
votes
4answers
387 views

Python script not running correctly when launched with crontab

I'm running a telegram bot on my Raspberry Pi 3. When I run it in my console or using Thonny, everything runs smoothly. python3 /home/pi/Documents/telegrambot.py The problem occurs when I set the ...
4
votes
4answers
28k 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
2answers
165 views

Are there any major differences when programming of the Pi and for normal Linux

As the title says, are there any major differences in programming with Python on the RPi and a normal PC with linux? And if there are (excluding the GPIO and other platform specific stuff) could you ...
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! :( ...
4
votes
2answers
8k 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 ...
4
votes
3answers
15k 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 ...
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
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 ...
4
votes
4answers
4k views

Infrared NodeJS

I just orded my RPI a while ago (Haven't recieved it yet), and this is just completely out of curiosity, but will I be able to connect some sort of IR receiver, and get it's input in Node? Or is this ...
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 ...
4
votes
2answers
2k 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 ...
4
votes
1answer
24k 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 ...
4
votes
2answers
46k views

ImportError No module named thread

I want to make a simple thread that listens if a Button is pressed or not. I receive the error ImportError No module named thread. import RPi.GPIO as GPIO import time import thread GPIO.setmode(...
4
votes
2answers
5k views

Getting feedback from a hall sensor with Raspberry Pi

This is my first Raspberry Pi project and I'm a Python newb. I've got a geared motor + driver + separate power supply (for the geared motor) + hall sensor. I know the "physics" and the way ...
4
votes
3answers
7k 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-...
4
votes
2answers
694 views

Building a Raspberry Pi network monitor. My code is not working

Long story short. I moved, put my home server is a closet and started worrying about temp and humidity, saw a guide online to make a network temperature and humidity monitor from a Raspberry Pi and an ...
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
2answers
8k views

How do I wait for interrupts in different languages?

I have a IR photo gate sensor that I have attached to my Raspberry Pi, and it is working nicely as I test with WebIOPi and a C program using the wiringPi library. I would like to use some other ...
4
votes
2answers
8k views

Can't install lxml

I'm making a bot for a wiki I'm setting up, and for it I need requests and lxml. However, when I do pip install lxml it gives me: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/...