I am writing software for a Raspberry Pi based robot device.
I want the robot to stop and react when it moves too far from the wifi transmitter before it loses signal completely.
Is there an easy way in Python to get a value of the strength or quality of the current wifi connection so I can monitor this?
Related
This question already has answers here:
Directly send signals to USB using Python
(2 answers)
Closed 10 months ago.
I am trying to create a USB device that vibrates whenever a key is pressed on the computer it is connected to. I have a working Python script that detects key presses, but I need it to send a signal to a USB device (which hasn’t been made yet). How would I go about this?
This may help a little bit: Directly send signals to USB using Python
To minimize what might be helfup:
Controlling components like LEDs from devices like Arduino and Raspberry Pi are done using GPIO pins. In contrast, USB is designed for data transfer and not for maintaining more constant high or low signals like GPIO. It also consumes different voltage and current levels than GPIO pins and could potentially damage components meant for GPIO.
However, you can get USB to GPIO adapters for this purpose (see here for an example discussion on these options).
In terms of Python, you can use packages such as PyUSB or the libusb Python wrapper to control/transfer data/communicate with USB devices (such as the USB to GPIO adapters). The companies providing the adapters might also have designed their own easy-to-use Python package to wrap around a lower-level driver (probably written in C). See this USB controlled LED device as an example with its own Python driver. The drivers are just software programs that take in relatively simple commands from the user for what they want a device to do. They then encapsulate the lower-level complexities required for following a protocol to communicate the user's intention to the USB device and controlling the USB port at the lowest possible software level.
Using pyserial you can read from a serial device and also write to it.
import serial
ser = serial.Serial('/dev/ttyUSB0') # open serial port
ser.write(b'hello') # this would depend on the protocol for the USB device
ser.close() # close port
I'm working with BLE on raspberry pi right now and I'm using bluepy library for python.
Scanning for devices works fine, but I want to find just few beacon devices without wasting time for searching all other devices available nearby.
In other words - I have a list of my beacons addresses and I want to check if any of them are in area. Can I simply walk throw that list and check if this specific device is in area to avoid time consuming scanning all devices?
I've managed to write a Python program for my Raspberry Pi that interacts with BLE via D-Bus and can register GATT services and store data in chatacteristics that external devices can read. However, my goal is to send images from my Raspberry Pi (peripheral) to an Android/iOS device (central). I've started searching for information on how to do that and discovered that there is a pretty low limit on how much data can be stored in a GATT characteristic (answers range from 20 to 512 kB). Because of this limit, the larger data must be split into chunks and transferred using a rather complicated algorythm involving GATT notifcations. That made me wonder if I'm on the right path. It looks like an overhead to implement such a complicated algorythm to send an image via Bluetooth and the low data size limit makes me think that BLE isn't meant for this. Maybe I should just use classic Bluetooth with sockets? Or maybe someone can point me to an example of an application which sends image via BLE, because I couldn't find anything useful on the internet. I mainly chose to use BLE because I want to write the Android/iOS application using React Native and it only supports BLE client. Does iOS even support Bluetooth classic?
First, thank you all for your useful posts. I can usually find what I need from SE without needing to make a post.
I'm hoping to make a timer/sensor device that I can control from a web browser.
I'm planning to hook up a set of sensors by USB or pinouts to a Raspberry pi, then having the Pi host a web server. I have experience writing web servers from scratch in python, so I intend to use python as my programming language for this application as well.
I want to be able to visit the server from another device that will run at a time-keeper's station. By selecting options on the web site, you could control the display portion of the timer or the values of variables (timer reset) also the sensors could trigger update events to show information on the web page.
My primary obstacle in this case is the hardware interface. I imagine I would need to look up how sites like OMSI allow users to control the motors that move their webcam, or other online control of hardware.
What should my search terms be, or do you know of any libraries for python to read and write to external (adafruit-style) sensors?
Thanks!
Anthony
(https://i.stack.imgur./RzWIl.png)
"Raspberry pi python gpio" "Raspberry pi python i2c" "Raspberry pi python spi"
i want to perform communication between (Python on raspberrypi) and (Matlab on PC). Raspberry pi performs face detection and crop faces. i need to send these faces to matlab on pc for processing (face recognition) and retrieve back the label from matlab to python on raspi i have searched all over the internet but couldn't find a detail explaination.
The easiest alternative is using TCP/IP socekts:
There's also the Serial Port, but the RPI doesn't come with a usb2com adaptor, so you'll need to purchase one.
You could also transmit over USB by configuring the usb port as a virutal serial port. I've only done it on bare metal ARM cortex, but it should be possible to do that on the RPI too.