Jump to content

Recommended Posts

Geschrieben

When I look at the spec-sheet for the analog in bricklet I find the following values:

Voltage 0V - 45V in 1mV steps, 12bit resolution

Measurement Range

Automatically switched

0V - 6.05V, ~1.48mV resolution

0V - 10.32V, ~2.52mV resolution

0V - 36.30V, ~8.86mV resolution

0V - 45.00V, ~11.25mV resolution

 

However when I look at config.h and the schematic of the bricklet I find this:

#define VALUE_RESISTOR_0 0    // in  in  in

#define VALUE_RESISTOR_1 12000 // gnd in  in

#define VALUE_RESISTOR_2 4700  // in  gnd in

#define VALUE_RESISTOR_3 1000  // in  in  gnd

#define VALUE_RESISTOR_4 772  // gnd gnd gnd

 

#define MAX_VOLTAGE_0    3300

#define MAX_VOLTAGE_1    6050

#define MAX_VOLTAGE_2    10320

#define MAX_VOLTAGE_3    36300

#define MAX_VOLTAGE_4    46071

 

Does this mean that this Bricklet has one more Measurement Range than published on the website namely:

 

0V - 3.30V, ~0.81mV resolution

 

from: #define VALUE_RESISTOR_0 0    // in  in  in

and  #define MAX_VOLTAGE_0    3300

 

Please confirm this, it would be great if this is the case.

 

Geschrieben

In theory the Bricklet could measure in the 0-3.3V range (by not using any of the resistors). But the smallest range currently can't be enabled by the API.

 

We disabled the smallest range since there were problems with jumps in the measurements when a voltage of about ~3.3V (which is a common voltage) was measured. The range was switched back and forth too often.

Geschrieben

We disabled the smallest range since there were problems with jumps in the measurements when a voltage of about ~3.3V (which is a common voltage) was measured.

So if I understand this correctly it's been disabled because 3.3V is a value at which a lot of sensors happen to linger?

 

Could a solution than be that the maximum value for the MAX_VOLTAGE_0 is set at lets say 2.5V or even lower, or does that require a hardware change as well?

Geschrieben

So if I understand this correctly it's been disabled because 3.3V is a value at which a lot of sensors happen to linger?

Yes

 

Could a solution than be that the maximum value for the MAX_VOLTAGE_0 is set at lets say 2.5V or even lower, or does that require a hardware change as well?

That would be better, but is still think the smallest range doesn't make much sense for the autoranging. While looking at the source code, i thought that  we should have allowed the 0-3.3V range when the auto range is disabled: http://www.tinkerforge.com/en/doc/Software/Bricklets/AnalogIn_Bricklet_Python.html#AnalogIn.set_range

 

We can't break the API now, so we would have to add the new range as constant "5".

Geschrieben
We can't break the API now, so we would have to add the new range as constant "5".

 

That's great at least there is a possible solution.

 

Let me explain the motivation behind my original question. A lot of sensors produce an extremely low Vmax but at the same time amplification of the signal is not desired because this would adversely affect the measurement.

 

The sensor in this case produces a Vmax of about 250mV and measurement needs to have a reasonable resolution of anything less than 0.80mV.

 

The project I'm talking about http://www.instesre.org/construction/pyranometer/pyranometer.htm  measures solar isolation and the effects aerosols have on it's intensity. Since that value is constantly changing, it would be great to know the actual conditions at any given time and place.

 

I don't need to emphasis the importance of this in a today's world with it's need for natural and renewable energy sources. This could even be a Kit project from Tinkerforge as other values like temperature, pressure and RH also play a role in the whole process.

 

 

  • 2 weeks later...
Geschrieben

Analog In Bricklet 2.0.3 supports manually selecting the 3.3V range. The auto range selection will not pick it as before for the mentioned reason.

 

Also be aware that in the 3.3V range there is no pull down resistor from the voltage divider anymore. So VIN is really floating by default and the ADC can measure everything up to 3.3V if nothing is connected to VIN.

 

An updated bindings version will be released later today.

Geschrieben

Hello Photron,

This is what I did in PHP

<?php

require_once('Tinkerforge/IPConnection.php');
require_once('Tinkerforge/BrickletAnalogIn.php');

use Tinkerforge\IPConnection;
use Tinkerforge\BrickletAnalogIn;

$host = 'localhost';
$port = 4223;
$uid = 'di9'; // Change to your UID

$ipcon = new IPConnection(); // Create IP connection
$ai = new BrickletAnalogIn($uid, $ipcon); // Create device object

$ipcon->connect($host, $port); // Connect to brickd
// Don't use device before ipcon is connected

// Sets the measurement range. Possible ranges: 0 to 5
$range = $ai->setRange(5); // 5: 0V - 3.3V, ~0.81mV

// Get current voltage (unit is mV)
$voltage = $ai->getVoltage() / 1000.0;

echo "Voltage: $voltage V\n";

echo "Press key to exit\n";
fgetc(fopen('php://stdin', 'r'));
$ipcon->disconnect();

?>

I added the following lines to the Simple Example in PHP

// Sets the measurement range. Possible ranges: 0 to 5
$range = $ai->setRange(5); // 5: 0V - 3.3V, ~0.81mV

This seems to work but since I'm not that experienced with programming there may be a better way to do this

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...