RC Filter at the ADC input pins of beagle bone black - filtering

I am trying to read a thermistor with the beagle bone black.
I have a voltage divider circuit that feeds a unity gain Opamp. The O/P of the opamp is connected to a simple RC Low pass filter that feeds voltage to the ADC pin.
The problem I have noticed is that the voltage sensed by the beagle bone is always 0.02V higher than the actual voltage at the opamp output.
At first I thought this was a software issue, but on further investigation I found out that the voltage at the ADC pin is actually raised by 0.02V. If I feed the ADC pin directly from the opamp, without the RC filter I do not have this issue.
Has anyone else experienced anything similar?
Thanks in advance!

The resistance in the RC filter is too high which is causing a voltage drop because of the internal impedance of the ADC pin. You can use an active low pass filter to resolve this problem:
http://en.wikipedia.org/wiki/Low-pass_filter#Active_electronic_realization

Related

Error in blinking led using GPIO_12 of ESP32

Here is my code:
#define LED_BUILTIN 12
// the setup function runs once when you press reset or power the board
void setup()
{
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop()
{
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW);// turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
The above code works perfectly fine for GPIO_2 but fails for GPIO_12. I want to ask whether it is giving fault because I am using touchpad pin or there is some other error?
I have attached an LED to GPIO_12 of ESP32 and after program uploading, my led is not blinking. I have tried to connect voltmeter to GPIO_12 and it is giving 0.5 volts with minor fluctuation. I was expecting a change of voltage after each second as per HIGH/LOW conditions of my code but unfortunately, I am not getting the desired result. What could be the possible reason?
Now I have found out the solution so let's share so that others can also get benefit. The code for which I was following the reference website contained 36 pins which mean 18 pins on each side but in my version of the board there were total 30 pins on my board which mean 15 pins on each side. Now that I have got pin out reference of that board and my board also, everything is fine, aligned and makes perfect sense. Problem was that the hardware which the reference website referred to had different hardware version with 36 pins and my hardware contained 30 total pins and was a different version of ESP32.

Why is 'GPIO.setup(6, GPIO.IN)' throwing an error?

I'm trying to read the state of the input pin (BOARD pin 6, which is a ground pin) and I receive the error "ValueError: The channel sent is invalid on a Raspberry Pi".
Am I misunderstanding the definition of an input pin? My understanding was that it is simply the ground/negative pin, connecting back 'in' to the pi?
I'm trying to read the state purely for tinkering purposes, to see the value change when it's floating (not using a pull-down).
The Ground pin is connected, literally, to ground. It is impossible to read or write values to ground or power, as these are the circuit components. You have to connect to a GPIO pin (the green(ish? I'm colorblind) dots at http://pinout.xyz).
It is possible for the input of a GPIO pin to be set to HIGH or LOW, depending on the circuit you wish to use. If you expect the GPIO to be normally LOW and HIGH when your input is triggered (such as with a pushbutton switch), then you have to set the state to pulldown.
I would recommend you read some of the background on microcontrollers: https://embeddedartistry.com/blog/2018/06/04/demystifying-microcontroller-gpio-settings/

Stm32 spi write on rising edge and read on falling edge, possible?

i have application ic which needs to write on rising egde and read on falling edge . Write now i get both on rising egde?
I am using bidirectional mode so only 3 wires
Thanks
needs to write on rising egde and read on falling edge
Look at the SPI timing diagram in the Reference Manual. (This is for the F4 series, but AFAIK other series have compatible SPI controllers)
It does what you want when CPHA == 1 and CPOL == 0. Data lines are written at the rising edge, and captured at the falling edge of SCK.

How to use IR leds that is not working on Pi camera

For a night vision camera, I bought NoIR Pi camera and IR leds(Can be attached to both sides of the camera).
But I found that my Pi camera doesn't have metal part on the attaching part. So I cannot use my IR leds with pi camera. Can I use it with pi's gpio? Actually I only need to turn on the leds, so I wonder if I can supply power to leds with raspberry pi or arduino's pins.
Additionally If I connect the leds with jumper cable or something, should I solder it or is it okay just tying it.
You can connect your leds to any DC power source, just be sure to limit the current by using a suitable series resistor to avoid destroying your leds. And don't look into them to prevent eye damage, as your eyes will not accomodate to invisible light.
In good approximation:
I = U / R
with:
I is maximum allowed current trough LED (ampere)
U is power supply voltage (volt)
R is value of resistor (ohm)
Or more exact:
https://www.sparkfun.com/tutorials/219

Get position from accelerometer

I am working in a monocular 3D Mapping project, and I need every time both position and rotation (angle).
To filter Gyroscope Data, I decided to use the "compass" and set 0 value to the angle if it's north.
But to get the position, I will need to double integrate the accelerometer value with a small sampling step (1ms) and 7 values mean filter.
I think this will make position more accurate. But does someone have an idea about the error range ? for example, in 10 meters, How much the error will be.
And does anyone have a better idea?
The sensors are from STM32F3 Discovery Board
Thanks
The STM32F3 has two sensors you'd be using:
LSM303DLHC accelerometer and magnetometer
L3GD20 3-axis digital gyroscope.
The sensor accuracy should appear somewhere in the datasheet. Since you'll be using several sensors, you'll have to calculate the total error over the time your measuring. Note, the error won't be a single number like 10 meters because it will accumulate over time. If you had a GPS or some other way of determining your position you'd be able to limit your accumulated error.
What you're doing sounds like an Inertial Measurement Unit. If you haven't already, I'd recommend reading up on that and also Dead Reckoning.