I have 2 questions.
1º - I have a raspberry pi that has connected to itself a ultrasonic sensor, a rfid reader and a pi camera. The problem I'm facing is that after like 10 reads of the rfid reader, it starts reading really slow ( takes probably 10 seconds to read 1 card ) or even stops reading.
2º - I would like to aplly interrupts in the devices mentioned above, but I dont know how to do it even though I have been searching a lot about this.
Does anybody knows why is this happening?
Related
I am using a GPS module for precise positioning. It's going to be autonomous and we need to make a fail-safe in case the GPS loses its rtk fix.
To do that, I am employing a Raspberry Pi 4b connected via UART to the GPS module. The GPS sends a message, GNGGA, where one of the parameters informs the status of the fix, then the Raspberry Pi monitors these parameters and keeps checking if the fix type stays as rtk fixed and sends an alert if not.
So far I have the code below that connects the Raspberry Pi to the module
#!/usr/bin/env python
import time
import serial
ser=serial.Serial(
port='/dev/serial/serial01'
baudrate=460800
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
counter=0
while 1:
x=ser.readline()
If I print x, I get something like this:
�6ȶ< �>�r�%���a���5��PFpx���� zR�b�qI��#ǃy�v����$p���`X�w�?Ĉ*�����>��G;
A���
O���������r[���nlB>X$GNGGA,202538.90,2156.26451,S,04753.49406,W,1,12,0.52,751.9,M,-6.2,M,,*53
The unreadable part of the code is some other messages the GPS needs, while the readable part is the part I want to extract.
I believe I know the logic behind what needs to be done: I need to recognize the start of this string, and since the size of this is fixed, I should be able to use its length to extract the whole string or just the parameter I need.
I don't have much experience dealing with serial communication with python so I don't know how to employ this logic. After a few hours of trial and error, I managed to find the start of the string with a few if's, but I don't how to go from here.
Can anyone give some advice?
I'm trying to read data from this GPS through python. This GPS is hooked up to my Raspberry Pi 3 B+ via I2C. I need to use I2C communication, as my serial ports are going to be used by a different device.
So far my endless googling has brought me nowhere. I can't seem to find any python libraries that will let me do this. Can anyone here help me get started? Thanks!
I have my circuit hooked up correctly. It's a simple python script running on my RPi 2.
I've done this countless times and I decided to mess around with it today since it's been a while but I know I have the circuit correct and if I hook it up with my 5V, it will stay lit. But if I connect it to a GPIO and use my python script, the LED blinks for a random amount of times (usually for about 3-5 seconds) and then it just stops.
I've tested it with a multimeter and the jumper wires are all working. I tested continuity on the GPIO pin w/ GND and it would beep for as many times as it would make the LED blink and then continuity would stop.
My script continues to run and if I print something during the loop, it will continue to loop.
Everything is pointing to my RPi being broken but I've done nothing to it to break it and it's been sitting quietly since I've last used it.
Does anyone have any insight into this? This is really frustrating because this is just a simple script that should not have any issues.
Occasionally, when I messed with the wires, the LED would momentarily flash but it would be a very weak flash and then nothing. I've also tried to connect it directly to the RPi and skipping the extra wires and it still doesn't work. It seems like the GPIO pin is messed up but I've tried it with multiple GPIO pins.
When I try with other pins (currently using GPIO-07), it will tell me that the pin is already in use, even though it is most definitely not.
I'm also using the same script that I have saved on my Pi from a long time ago. 0 changes made to it but it's no longer looping infinitely, it stops after 4 seconds.
I am doing a project that involves using a Raspberry Pi to control all the switchboards in my house. I will start by wiring three switchboards first.
I am planning to use one 8-channel and one 2-channel relay for each of the switchboards, as each of these switchboards contain 10 switches. So, that amounts to 30 relay units.
However, I do not have as many as 30 free GPIO pins on my Raspberry Pi. I can use a port expander, but the Pi is installed with a camera and stationed near a door and fixed there. So, all the 30 wires from the switchboards need to be brought to the Pi, which will make the walls look messy. I was wondering if I could install an Arduino mini for each of the switchboards and control the relays using the Arduinos.
The Arduinos in that case need to the connected to the Raspberry Pi somehow such that when I want to switch on a specific light in my bedroom, I send a command to the Pi. The Pi sends the corresponding information to the Arduino in some well-defined format, like JSON, mentioning the switch number and the action to be performed. The Arduino switches on or off the switch and returns a message to the Pi.
Can this be done? I would be grateful if anyone could help me with this.
Thanks in advance.
I'm trying to create a clock in python that runs in minecraft pi. It's functional apart from the fact that each minute, it updates the numbers on minecraft another half second later than it should. I'm pretty sure that python knows it's changed, it just hasn't sent the message to minecraft to change anything yet - this is very bad in the long run, as you can imagine! I honestly don't know what's causing the lag - is it the limitations of the Raspberry pi? I've checked my code for any rogue 'sleeps' and I can't find any. Any suggestions as to why it's gone wrong?
http://pastebin.com/XfUk5TmH
PS - it's a very large program - the better part of 1000 lines, so be warned..