I connected an ADS1015 to my Raspberry Pi 4B like this:
But VDD is 5 V in this case.
I got a stable connection via I2C and can read and write to the registers.
I am trying to use the Unosquare Libs like this:
using System;
using System.Threading;
using Unosquare.RaspberryIO;
using Unosquare.WiringPi;
using Unosquare.RaspberryIO.Abstractions;
namespace TestBasysPiCSharp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Starte Lesezyklen Analogwerte...!");
Pi.Init<BootstrapWiringPi>();
var myDevice = Pi.I2C.AddDevice(0x48);
var a = new ADS1015(myDevice)
{
Gain = ADS1x15.AdsGain.GAINTWOTHIRDS
};
while (true)
{
Console.WriteLine("READING...");
Console.WriteLine(a.ReadChannel(1));
Console.WriteLine("READING DONE");
Thread.Sleep(500);
}
}
}
}
The problem is that a.ReadChannel(1) gives back totally wrong values. I can't properly scale them.
If i change the gain, the values change, but still make no sense:
I connected an ADS1015 to my Raspberry Pi 4B like this: But VDD is 5 V in this case.
I got a stable connection via I2C and can read and write to the registers.
I am trying to use the Unosquare Libs like this:
The problem is that a.ReadChannel(1) gives back totally wrong values. I can't properly scale them. If i change the gain, the values change, but still make no sense:
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
Gain | 6144 | -- | -- | -- Input voltage | Raw (expected) | Raw (real) 4.811 | 3207 | 1734 4.095 | 2730 | 1476 2.984 | 1989 | 1067 2.149 | 1432 | 775 1.019 | 679 | 367 0 | 0 | 0