I am creating a mobile robot at my work using a Raspberry 3b+ as microcontroller. To determine the robot displacement I am using a motor with encoder sensors.
The problem is: I need to read the Encoder channel changing to count the pulses and also determine the direction. To do this I was using a callback to read the pulses edge, but the callback it is not fast enough to get all the edges and I lost information because of that.
A solution that I could think it was to use a C program using the WiringPi library to read the encoder, I tested it and it worked. Now I need to use this C program in my Python project.
Any idea in how I can do that?
Related
This is my first post. I am trying to make a drum kit using a raspberry pi. The drum triggers are some peizoelectric sensors. I have used pygame inside python to play sounds. When the script detected gpio inputs, it played drum sounds. It was fine for the most part but due to latency issues, I took another approach and decided to use puredata.
I want python to detect gpio inputs and then send signals to puredata, which will play the desired sounds.
My question is, how can I get python to send simple signals to puredata??? I am running both python and pd on the same pi.
Also, what do you think of this approach i.e. using puredata directly from gpio inputs? Can having a microcontroller like arduino to send the signals as midi signals to pd affect anything???
Thank you in advance!
I'm going back about a decade but I used Python to send data from the 3d modelling software Blender to PureData using the socket library.
This article might help a bit more with packaging up and sending across.
If you know what your components within PD are expecting as an input that will help you know how best translate your input triggers into packages to ship over socket to PD.
Hi I have XBee RF mode S2C which does not have internal storage to run micropython. So I need to get data from KY-001 sensor connected its iolines. With python library I didnt get anything just get_adc_value(ioline) function which seems doesnt do anything. I need to check sensor in local device for now .After I gonna use same solve to remote devices (I only use Python XBee library). Or exactly can I use Xbee iolines directly to get data from sensor without external MCU?
I don't think you'll be able to interface to this 1-Wire sensor, it's intended for a microprocessor that can handle timing requirements and uses a tristate I/O line (IIRC).
You should be looking at temperature sensors with an analog voltage output (like this TMP36) that you can tie to one of the analog inputs of the XBee, and then read that input with a remote ATIS for a single sample or ATIR for periodic sampling.
I'm trying to output video in parallel format to a display using a Raspberry Pi.
To accomplish this, I need to set 8 pins to YUV422 data, and then clock them in at 54 MHz via the GPIO.
I've read that it's unlikely this is possible using a high-level library like Python's GPIO library, so I'll need to go down to a C-level library to get the performance that I need.
As someone with a C++ background, setting the GPIO pins to a a YUV422 color is pretty straightforward; what I've found intimidating so far is how to set the clock.
I know this feels like a simple question, but I'm having trouble figuring out how to set the clock to such a high speed, or even finding out if it's possible with a library like WiringPi or if I'll need to go straight to the hardware clock.
Can anyone provide me with a pointer to either documentation or a code snippet that can help me?
thanks!
This is not a good application for a Raspberry Pi. It is probably impossible to generate 432 Mbit/sec of output at a consistent clock rate from any userspace application, Python or otherwise.
You should probably consider using a different development board which explicitly supports parallel video output.
That being said, it might be possible using the parallel display interface, which will generate parallel video output (as a Linux video device!) directly on a set of the Pi's pins. It's really intended for RGB video output, but it can probably be repurposed for YUV output with an appropriately modified image.
I'm making a Skeeball program and boards that both work off of a raspberry pi and GPIO sensors with a tkinter gui. The first table and program is working great and now I was thinking about the possibility of adding a second table with multiplayer games.
Each pi would have to talk to each other, preferably over a LAN network instead of using I2C or serial pins. Basically I just need something mostly to pass variables from one pi to another.
My first thought was to use pickle to save to a shared network folder since I'm already using pickle to save my highscores. I just have no clue how to set up a shared folder over raspbian and I'm guessing that probably a pretty bad approach to solving the problem.
I'm also really new when it comes to python and raspbian so sorry if this problem is something super easy all I could find online was how to have a pi talk with a windows pc or an arduino.
Thanks for any help you can give me!
I'm currently doing a project in which I'm making an ADS-B flightradar on a led matrix, which is controlled by a Raspberry Pi. I've found a program called dump1090 which receives and decodes the data from my SDR receiver. I can find lots of example on how to use to forward that data to a webserver or whatever, but I can't seem to find anything on how you can programmatically listen to the data dump1090 produces. Does anyone know how you can programmatically receive dump1090's data in order to use the data in a program? (any language would do, but perhaps python would be the most obvious choice)
You should be able to start dump1090 using a programming language of choice (c/c++/java/python/etc.) and and read the std out pipe.
Personally, on Raspberry Pi, I find Python nicer to use since it's easier to test/reiterate without needing to compile. Python provides the subprocess package which allows you run dump1090(or any other application) from within Python and have a look at the output (using subprocess.check_output('dump1090') for example). Have a look at check_output and Popen options to see what works best with your application.