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
1
vote
2answers
21 views

Rpi zero w serial code python

So i set up my rpi zero w to comunicate at 11500 serial with an arduino... the arduino sends over serial lines such as "~1 11443". My idea is that the ~ character tells the pi when to look for data, ...
0
votes
1answer
38 views

2 Motors functioning unevenly - right motor gets more power than the left

I'm trying to execute this piece of code to run 2 motors on my robot. The code is really simple it's just repetitive. For some reason that I can't figure out, the motors run unevenly. Here is the ...
0
votes
1answer
46 views

Problem running the serial module with Python

I am trying to use the serial port on the Raspberry but when I run the example below I have the message: TypeError: 'module' object is not callable import time import serial ser = serial.serial( ...
0
votes
1answer
96 views

Having a sound clip play and be looped as long as the button is pressed down and stops as soon as it is released

I am able to have the script running when I have the code set to pygame.mixer.music.play but if I do pygame.mixer.music.play(loops=-1) I get an error stating CallbackSetToNone: The ...
0
votes
0answers
30 views

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

last few days I've been working to create a GUI using Tkinter This morning my code still worked, but now it crashed with said error: Traceback (most recent call last): File "TKtest.py", line 3, in &...
0
votes
2answers
2k 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-...
1
vote
0answers
23 views

Communication between computer with Labview and Raspberry Pi

I would like to use a computer with Labview to send commands to a Raspberry Pi, for the moment I am just trying to get a LED to blink. What would be the best way to proceed ? I have thought of two ...
1
vote
1answer
53 views

Why does my python script work in Thonny but not from the console?

Why does my python script work in Thonny but not from the console? (And yes I've tried running it from the console using python3.) Does Thonny run it in a loop that the console doesn't? Thank you. # ...
1
vote
0answers
717 views

Raspberry 3, python and shared libraries

I want to code something which can remote this robot: Dobot Magician http://dobot.cc/dobot-magician/product-overview.html. I have a Raspberry 3 and I downloaded the precompiled DLL for Linux on Dobot'...
0
votes
2answers
47 views

433mhz Status sockets project

I've been working on getting a Home automation project going for a while, using a Rasp pi 1b (26 pin header). This is a well trodden path by others, as it is a project to control status remote sockets:...
0
votes
0answers
14 views

Can't find my android phone via bluetoothctl scan on

I am currently working on a project that fetches the RSSI of my Samsung Galaxy S8 phone via bluetooth on a Raspberry Pi Zero W. I am running Raspbian and have successfully found other devices via ...
1
vote
2answers
127 views

Rasp Pi, pip error setup.py egg_info

I am new to pi and I wanted to test it out on a python module for talking to building automation devices. Its called BAC0 From the documentation: https://bac0.readthedocs.io/en/latest/getstarted.html#...
0
votes
1answer
2k views

Reading data from MCP3551 via SPI

I am trying to read data via SPI from an ozone sensor that I have connected to the Raspberry Pi's GPIO. This set up uses a Mikro Pi click shield and Mikro Ozone 2 click sensor. The output of the ...
0
votes
2answers
1k views

How to install Numpy in Anaconda on Raspberry Pi 3B with Raspbian Stretch OS?

My goal is to use Numpy inside of Anaconda on the Raspberry Pi 3B. I downloaded Anaconda by following the instructions: https://stackoverflow.com/questions/49170125/cannot-install-anaconda-in-...
0
votes
0answers
33 views

How to create a person or head (not face) detection using open CV that are not too slow when run in Raspberry Pi 3B+?

Hello guys my problem is creating a program that can detect the head(not face) or human detection for my project One of the program that i see is too slow for raspberry pi 3B+ which is this : https:/...
0
votes
0answers
45 views

Raspberry Pi 3B+ successfully connect and pair but can't receive data from OBD II

Hello guys my problem is i cant recieve any data from OBD II to Raspberry Pi 3B+ Here the materials that i use: Raspberry pi 3B+ ELM327 -> OBD II Operating System of Raspberry Pi -> https://medium....
1
vote
2answers
120 views

python start on boot

i am trying to get my WS2812 NeoPixel python sketch to run at boot, i used a tutorial https://tutorials-raspberrypi.com/connect-control-raspberry-pi-ws2812-rgb-led-strips/ it install the correct files ...
1
vote
1answer
69 views

PCF8591 with Analog Joystick I/O error when reading input PYTHON

I have been trying to create a retropie unit, and I'm in the midst of writing a script to inject uinput events for the analog axis values. This is the code I've written so far, but the issue is that I ...
0
votes
2answers
106 views

Take a picture when a light source is disturbed

I would like to use a Raspberry Pi camera to take a picture when a light source sent to the camera is interrupted. I have one Arduino (transmitter) sending an ON-OFF Keying (OOK) signal through an LED ...
0
votes
0answers
28 views

Unable to stop motor through GPIO in Python

I'm using an rPi to send a GPIO signal to a servo motor. When I run the program, the motor starts turning, and then continues without stopping, even if the program has terminated through the use of a ...
1
vote
1answer
892 views

Why is PIR motion Sensor always on?

I'm trying to make an alarm system but the motion sensor is always on as soon as the script is run. I've posted a question about a different problem i was having with this project so it'll confusing ...
3
votes
1answer
53 views

Sending a binary data stream to a GPIO at a certain frequency

I would like to send a random binary data sequence to a rpi GPIO at a particular frequency and then read the data stream off a scope. Is there a way of implementing this through python?
5
votes
1answer
487 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 ...
1
vote
0answers
116 views

Raspberry, flask and missing libraries

I have installed Apache2 on the Raspberry and the idea is to run a Flask app. I managed to write a very simple app: import requests from flask import Flask from flask import make_response from flask ...
2
votes
2answers
960 views

Rpi3 to Arduino Serial UART Communication Tutorial

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 ...
1
vote
0answers
164 views

How to connect ST7789 LCD to Raspberry Pi

I'm trying to connect to this LCD ( sry 4 japanese page:( use translate plz ) This monitor driver is ST7789, 7pins.[GND VCC SCL SDA RES DC BLK] And now I'm connecting to pi like this https://imgur....
0
votes
0answers
744 views

Controlling brushless motor with ESC and Raspberry Pi b+

I'm trying to build a quadcopter and I have one ESC, one brushless motor and one Raspberry Pi B+. I find many tutorials on internet to see how to connect these components but it doesn't work. I'm ...
1
vote
1answer
98 views

Speed up SPI transfer

So I need to transfer a byte on the spi interface on raspberry pi. Here's my code in python import spidev import time import binimp fhandle=open("white.txt") initial=binimp.extract(fhandle,'192','...
0
votes
1answer
42 views

Pi 3 B+ sudden audio failure

A few months ago I bought a RasPi 3 B+ to act as an overglorified doorbell using reed switches to tell the Pi to play a custom MP3 with the "Playsound" Module into the Company's PA system. It worked ...
0
votes
0answers
22 views

How to make more efficient reading of GPIO

My (python) program (on Raspberry Pi zero W) turns on/off a GPIO pin (connected to a relay module) depending on the RSSI signal of my phone (connected via bluetooth) and the status of one more GPIO ...
0
votes
1answer
132 views

How to display a tkinter window while using a push hardware button to capture images?

I have a project in which involves capturing of images. I have to display a UI while capturing an image if a button is pressed. This is the code. def create_window(self): t = tk.Toplevel(self) ...
0
votes
0answers
15 views

How to record and save an ongoing stream from picamera?

I am currently doing this project of streaming a live video into a localhost and then capturing an image after button click using a picamera. Here is my code: For streaming: import io import ...
0
votes
1answer
554 views

Multithreading Python Raspberry Pi 3 B+

My Raspberry Pi 3 b+ is reading by Modbus the values of an irradiation sensor, processing all the data, showing it in a plot and showing some warnings (if the irradiation ramp is higher than 5%). I ...
0
votes
2answers
63 views

How to run a program after reboot

RASPBERRY PI 4 Hello there, I have this script that should shut off a power outlet when it detects a movement. The rpi-rf_send code is from this repo. The question is: if the current goes away, ...
0
votes
1answer
78 views

At what instances do we use the Board mode and BCN mode in Raspberry Pi?

I know about the two modes of working in Pi using python, Board and BCN. However, I am really confused as to the instances or situations where I should use them. An example demonstrating their use ...
1
vote
1answer
357 views

Feh in startup script only displaying images on reboot, not startup?

I have a Python script running on a Raspberry Pi Zero W that calls the image program feh in order to loop through some directories and display the enclosed images. The script is supposed to run on ...
2
votes
0answers
24 views

Permanent Arduino usb address on RPi!

So my project is using to Arduinos slaves to RPI that is master. They communicate through USB. Each time I remove one of the Arduinos I need to modify the .Py script to add the new USB alocated. Is ...
0
votes
0answers
26 views

Timed trigger for GPIO input

I'm running a raspberry pi system that records fish as they swim passed an IR break beam sensor at a fish ladder. So far the system works well but I'm trying to cut down some of the false triggers. ...
1
vote
0answers
64 views

Raspberry Pi always reboots when trying to shutdown

I've been facing this issue for a long time and I haven't been able to find a working solution for it. I've found a few different posts online of people having the same issue but none of the solutions ...
1
vote
2answers
62 views

How to use Config file between multiple pis

I have multiple pi's running a program where they listen for a broadcast message and trigger a python script. My python script that's triggered has config details that is same for all pi's. Whenever ...
0
votes
0answers
30 views

How do I control a GPIO pin with a HTML button?

I am trying to send a temporary signal through one of the GPIO pins on my Pi 4, like to light up an LED for 1 second then turn off. Is there are way to do this by clicking on a button on my HTML web ...
0
votes
1answer
328 views

MPU 6050 Accelorometer Gyroscope code is giving me an angle of 75 degrees when it's suppose to be 90 degrees

I used a bubble level and Angle apps to verify that my MPU 6050 is actually rotated 90 degrees. Even so, my code tells me that the MPU 6050 is rotated ~75 degrees when it is in fact rotated around 90 ...
1
vote
2answers
116 views

AdaFruit ServoKit CircuitPython Blinka Library Installation Problem

I'm follow along with a tutorial to get started with using CircuitPython to control servos on my RaspberryPi (https://learn.adafruit.com/adafruit-16-channel-pwm-servo-hat-for-raspberry-pi/using-the-...
0
votes
1answer
45 views

Raspberry PI UART doesn't work all the time

I am trying to communicate to a UART device using Raspberry Pi (Raspberry Pi 3B with Raspbian stretch) Header pins with pyserial. I have followed all the steps mentioned in https://www.raspberrypi.org/...
0
votes
0answers
15 views

Rasperry Pi 4B LXterminal only runs python after python3.8 installed

I installed python 3.8 on raspberry pi 4b, now every time I open LXterminal, python 3.8 starts up, and using ctrl-D to exit only starts python up again. I am in a catch 22!
0
votes
2answers
581 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 ...
1
vote
2answers
51 views

Cronjobs sometimes fail to run fully when launching many Python scripts

I have about 30 Python scripts that I have scheduled to run via cron. Usually, I can run cronjobs on a Raspberry Pi just fine but I usually also only do a handful only. These scripts are essentially ...
0
votes
1answer
37 views

Control Motor via Raspberry Pi connected to a Laptop (running code via PyCham)

currently working on a project with detecting objects via a Camera Module and controlling motors based on the camera detection (if object is in sector A, move motor B down, etc.) using Python. The ...
0
votes
1answer
71 views

Passing data from output of a function to be used in a function python

I have a few parts of a weather station together and am running into an issue with functions. the humair fuction returns two values hum and airtemp. The problem is when the sendpost function runs it ...
2
votes
0answers
24 views

PWM on pump not working as expected

I am attempting to run a PWM on a pump using rpi.GPIO using the following code: def run_PWM_on_pump(): gpio.setmode(gpio.BOARD) gpio.setup(8, gpio.OUT) p = gpio.PWM(8, 0.5) #also works at ...