Is it possible to use beaglebone (black) analog pins as GPIOs? - beagleboneblack

Analog pins of arduino boards can be used as GPIO but is it also possible for the beaglebone boards ? Especially the black model.
And if it is possible, how to do it ?

Please refer to e.g. the BBB SRM (System Reference Manual), specifically: 7.1.2 Connector P9 or "Table 13. Expansion Header P9 Pinout" in the PDF version.
tl;dr: no
Please also note that those pins only tolerate up to 1.8V. Applying any higher voltage will destroy the ADC and possibly affect the whole chip.

Related

Why is NodeMCU triggering gpio in reverse when using Lua?

When using Lua and the GPIO module with my NodeMCU, my the high and low values are occurring in reverse.
I downloaded my build from NodeMCU custom builds: Link
To turn on the blue LED on the ESP8266, normally you set GPIO pin 0 to high. What's happening for me is I have to set it to low.
This is what I'm executing in the serial console to light up the blue LED:
gpio.write(0, gpio.LOW)
If I take this pin and directly connect it to ground, it also lights up the blue LED which I believe is correct.
What's causing my low and high values to be read incorrectly in NodeMCU?
This is normal - the on-board LED turns on with a LOW value and turns off with a HIGH value.
I've programmed these both in Lua and Arduino and the on-board LED works the same way.
Try attaching a regular LED to the same pin. You'll notice that it's inverse -- it will turn on with a HIGH value and off with a LOW value.
HIGH means the pin is set to supply voltage (it is "sourcing" voltage) and LOW means it is set to 0V (it is "sinking" voltage).
Assuming this board is wired like most of them, this is the rough schematic of the LED (note that "0" in gpio.write refers to GPIO16 hardware pin per the diagram here):
Diagram of the GPIO16 pin
You can see the diode is "pointing" in the direction that current should flow through it for the diode to light, which is "towards" GPIO16. So to get current to flow you need to set GPIO16 to LOW (0V) so there is a voltage difference. Otherwise both sides of the diode are at 3.3V and no current flows.

BBB: GPIO signal won't stay high

So I have a BeagleBone Black board, and I want to be able to set some GPIO pin from a low value to a high value.
For achieving this I'm using the BlackLib1 library (a C++ library that offers general access to all beaglebone's pins).
That library haves a class called BlackGPIO that offers the functionality that I want.
BlackLib::BlackGPIO NSLP_pin(BlackLib::GPIO_61, BlackLib::output, BlackLib::SecureMode);
auto NSLP_pinMode = NSLP_pin.getValue();
NSLP_pin.setValue(BlackLib::low);
I expect that this lines of code will set the signal from a low value to a high one (the signal is low by default).
The problem is that the signal goes high only for about ~10ms (measured on a scope), and after that it goes low again.
What I do wrong?
How can I set the some GPIO pin at a certain value, and remain like that until I change it?
[1] link
The link specifies to export the BBB pins from command line and to set it HIGH or LOW. You can develop a small C++ function to send those commands to kernel to export, ON/OFF the BBB pins. I'm using the same method in my C application and it works perfect.
Example code snippet in C to Enable the pin:
FILE *GPIO;
GPIO = fopen("/sys/class/gpio/gpio65/direction", "w");
fseek(GPIO,0,SEEK_SET);
fprintf(GPIO,"61");
fflush(GPIO);
fclose(GPIO);

V4L2 / Beaglebone Black / Radiumboard HD Camera / Controls

I am trying to take snapshots with a Beaglebone Black paired with a RadiumBoards HD Camera Cape. I've noticed that using the built-in application (like cheese) will auto-adjust exposure. However, if I write custom C/C++ code on top of the v4l2 libraries to take a snapshot, the exposure is off (too bright or too dark, rarely correct). I would like to be able to either manually adjust exposure or allow the camera to auto-adjust. How can I do this in C/C++ source code?
Resources online indicate that I can change exposure settings through v4l2-ctl. This doesn't work for me. When I issue v4l2-ctl -l to list available controls, I get none.
The driver is reported as cssp_camera version 3.8.13.
I am not really sure if this is the issue, but you may try to specify the device that you want to control.
Assuming that is /dev/video0, you may do that by:
$ v4l2-ctl -d /dev/video0 -l
I am also assuming that you have granted permissions to the device.
Hope that I have helped.
Cheers

Moving the i2c and SPI physical pin location on Beaglebone Black

I have found descriptions on how to use the GPIO on Beaglebone, but what I am looking for is how to re-assign the pinout of P8 and P9.
I want to assign the SPI to a different pin set to what it already is. I wish to group the PWM's in one area, (as they are currently spread all over the board) and I wish to assign the I2C bus to a different pinset. any ideas?
Thanks Phil
That's not possible. Each pin may have multiple modes that you can enable but that set of modes is fixed for each pin and you can't move them around arbitrarily.

How to disable automatic white balance from Webcam?

I got a webcam and I'm running some algorithm on the received images to find movements in it.
But, the automatic auto white balance is changing the excepted result of the pixels color variance.
That's why I'm trying to disable it.
Some one knows a way to get the web can image with out this automatic color balance or disable it ?
Tks
If you are on Linux, you can test disabling automatic white balance using the uvcdynctrl command line utility. This is not a permanent solution, since these settings are reset every time the webcam is disconnected from the computer. As of OpenCV 2.1, configuring white balance is not supported using cv::VideoCapture::set(). Assuming this is still the case in OpenCV 2.2, you will need to use another library to configure your webcam and capture frames.
If you on Linux, you can see an example of using direct Video4Linux (V4L) syscalls to do this in one of my Github projects.
In my case I found on driver two options that must be disabled, auto white exposure and auto white balance, I disable both of them and the image got as I needed.

Resources