How do I setup one GPIO of raspberry to receive float numbers - raspberry-pi

So, how do I connect a wire to a gpio on my raspberry and start receiving data, like an int or a float number

Raspberry got great documentation for wiring a simple button to the Raspberry Pi GPIO on https://www.raspberrypi.org/learning/physical-computing-guide/pull_up_down/
To receive float numbers, you could use the Raspberry SPI peripheral. Mathworks got a great example for creating a digital voltmeter with Raspberry and the MPC3008 Analog to Digital converter on https://www.mathworks.com/examples/matlab/mw/raspberrypiio_product-raspi_build_a_digital_voltmeter-build-a-digital-voltmeter

Just to mention since it's not there yet (or only implicitly in the above answer): For actually reading values you need to use an AD converter, since the RPis GPIOs are digital IOs only. So, you cannot receive more then a high or low signal from them. AD conversion instead will use the I2C-Bus for reading the values comming from the converter.

Related

Do I need a level converter for Raspberry Pi and STM32 to communicate via GPIO(UART) port?

I want to connect an STM32F407 Discovery board with a Raspberry Pi 4 Model B.
And I want to use UART as communication so I plan to use PD5&6 on STM32 and Pin8&10 on RPi. But after looking up online it says that the voltage of a STM32 port is 5V and RPi is 3.3V, so it seems that I need a level converter between them?
And there are also some articles says that not all the STM32 port are 5V, some are 3.3V. But I cannot find any of that information in the datasheet. Can anyone tell me where can I find these information?
Thank you very much ~ ~
The STM32 uses 3.3V as well. But it's 5V tolerant.
Just go ahead and connect them. There is no voltage difference.
You should have a look at the reference manual for that discovery board. It is here: STM32F407 Reference Manual.
There should be no issue connecting UARTs between those boards. Just remember to connect the TX from one to the RX of the other and vice versa. You can also use the CTS/RTS for flow control, but that isn't necessary as long as you are using baud rates of 115200 or slower.
Something else that I would recommended is to power the Raspberry Pi from the Discovery board. There should be pins for suitable power on the discovery. This is important because it gets both boards using the same power and ground so that the UART logic levels are consistent between the two. This may not be necessary, but I have had issues trying to connect two Nucleo boards SPI busses together if I didn't power one board from the other.

How to make Raspbian recognize SPI input from ADC as a soundcard

I have an analog to digital converter (ADC) MCP3008 connected to Raspberry PI 4 via SPI interface.
I need to process the signal from ADC in ODAS library (Open embeddeD Audition System).
ODAS is capable to process signal from a device in real time, but requires the device to be a soundcard.
Therefore I need to make Raspbian recognize SPI input from ADC as a soundcard.
After googling I found out that I need to write a device tree overlay to describe the soundcard.
I read about device tree overlays and viewed the device tree specification, but still can't figure out, which nodes and properties should I describe in the overlay?

Regarding Raspberry Pi Zero W - USB Access from GPIO Header

I am using Raspberry Pi Zero W for my project. I want to use GPIO Pins as USB instead of the on-bard MicroUSB connector. Is it possible?
Thanks in advance.
Sorry, the GPIO connector does not include any USB signals.
There are some USB hubs that connect to the test pads on the back side of the zero, e.g this one sold by Adafruit: https://www.adafruit.com/product/3298
If you are happy with just one USB port but don't like the micro connector, you could probably solder your own connector with a short pigtail lead to the same test points.
You can't use the micro usb connector at the same time as a hub or usb connector attached to the test pads as they are the same signals as in the micro connector.
The test pads p22 and p23 can be seen in this schematic:
https://github.com/raspberrypi/documentation/blob/master/hardware/raspberrypi/schematics/Raspberry-Pi-Zero-V1.3-Schematics.pdf

Coding Raspberry Pi with an ADC - SPI

I am trying to connect an analogue to digital converter to the raspberry pi. As far as I am able to understand, the RPi doesn't support Bi-directional SPI mode. The adc I am using says it is SPI compatible but only has the inputs SCLK, CNV and outputs CLKOUT+ and CLKOUT- and SD0+ and SD0-. This leads me to understand that it will only work with bi-directional SPI as there is only the serial data out. I am thinking of using a PWM for CNV (which I think CE), GPIO clock for SCLK and then an interrupt on the falling edge of the GPIO clock to just digitally read each bit from the adc. I don't understand SPI in detail but from what I've read quite often it requires sending data in order to receive it. Do you know if the setup I mentioned (without using SPI) will work? Or am I missing something about SPI and the adc will work with that while not in bi-directional mode?
We are using the Raspberry Pi 3 b
adc - http://cds.linear.com/docs/en/datasheet/232316fa.pdf
Thanks for any help you can provide.
Read the data sheet carefully, in particular pages 8 and 9. I suggest that you tie CMOS/LVDS pin to ground to enable CMOS mode. Then use only the "+"-pins. Use the SCK for SPI clock, SD01+ for SPI data input to the Rpi. Connect a GPIO pin to CNV.
Also observe that the RPi runs at 3.3V, and the ADC's max rating is also 3v3, that is running the IC right to the edge.

arduino +odroid (linaru ubuntu with eclipse and opencv) + usb camera

I hope you can help me. I am trying to build a robot but I am kind of stuck. The Arduino Mega is controlling the stepper motors drivers of the robot. The odroid-x is a single board computer that has installed linaro ubuntu and eclipse c++. All the programming is done in C++ and OpenCV is an image processing library.
The odroid-x has only as input a color camera. Therefore, the information from the camera is received and is processed in eclipse. Then, according to the information that is received, the odroid-x should send different integers to the arduino. The arduino should have a program already uploaded in itself, so it will be waiting for an integer and that integer is going to determine what the arduino is going to send to the drivers.
My questions are the following:
How can I do a serial communication between the arduino and the odroid-x?
How can I send information from eclipse to the arduino with a serial connection?
Thanks so much for any guide you can give me
First, be very, very, very careful. The ODROID boards use 1.8V signalling, so hooking up your 3.3V or 5V Arduino to the pins that expect no more than 1.8V will give you a burnt ODROID-X. It is possible to hook these two boards together if you put a level converter between them, and Sparkfun and Adafruit have some of those converters available. There is even a 1.8V reference voltage pin available... one of the pins that go to the LCD panel RGB-to-LVDS converter board puts out a constant 1.8V.
You could use either the four pins of the little white connector, or UART1, as a serial port, or you can use some of the pins in the 50-pin GPIO block as UART4. There are board schematics available on Hardkernel's website. These two UARTs show up as /dev/ttySAC0 (UART1) and /dev/ttySAC3 (UART4).
I don't know how to talk to those UARTs from a program, personally, but I know there are serial communications libraries available for python from watching threads pop up on the ODROID forums.