blackfox Geschrieben August 17, 2013 at 17:34 Geschrieben August 17, 2013 at 17:34 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. Zitieren
borg Geschrieben August 18, 2013 at 16:56 Geschrieben August 18, 2013 at 16:56 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. Zitieren
blackfox Geschrieben August 19, 2013 at 01:07 Autor Geschrieben August 19, 2013 at 01:07 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? Zitieren
borg Geschrieben August 19, 2013 at 09:25 Geschrieben August 19, 2013 at 09:25 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". Zitieren
blackfox Geschrieben August 19, 2013 at 11:59 Autor Geschrieben August 19, 2013 at 11:59 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. Zitieren
photron Geschrieben August 28, 2013 at 10:11 Geschrieben August 28, 2013 at 10:11 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. Zitieren
blackfox Geschrieben August 28, 2013 at 12:16 Autor Geschrieben August 28, 2013 at 12:16 Hello Photron, I update to version 2.0.3 but I don't find a "new" range in the Brick Viewer. Does the Brick Viewer need to be updated as well in order to see that new range? Zitieren
photron Geschrieben August 28, 2013 at 12:28 Geschrieben August 28, 2013 at 12:28 Brick Viewer doesn't know about this new range yet, but you can use your own program to set it. Zitieren
blackfox Geschrieben August 28, 2013 at 17:00 Autor Geschrieben August 28, 2013 at 17:00 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 Zitieren
photron Geschrieben August 29, 2013 at 07:25 Geschrieben August 29, 2013 at 07:25 That's just fine. You could use the symbol RANGE_UP_TO_3V instead of the magic value 5, but that's just a matter of taste: $range = $ai->setRange(BrickletAnalogIn::RANGE_UP_TO_3V); Zitieren
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.