Forum Replies Created
-
AuthorPosts
-
Thanks @shicks. COVID has meant that not everything is available at my end of the world, so I need to compromise sometimes!
Thanks @neilh20. I will definitely be interested in these when they are available.
@aufdenkampe do you have any feedback about YOSEMITECH turbidity sensors? My questions are:1) Are they as reliable as other turbidity sensors, i.e. do they drift more readily, or provide strange values? For $510USD (non-wiper) or $680USD (wiper), they seem like a good deal.
2) Is it worth getting the wiper version over the non-wiper version?
3) We have a YSI multi-sonde deployed for another project using a modbus wing. Our technicians noted that the wiper powers on every-time the Mayfly connects to the probe, draining the battery. Is this the same for the YOSEMITECH sensors or is there a way around this?
3) How much does the RS485-to-TTL interface board cost to build?
Thanks for your help.
James
Hi @shicks. I need a number of turbidity sensors for an upcoming project, and I have a reasonable quote from Yosemitech (~510USD each). What additional interface hardware are you referring to for the Yosemitech probes? Has anyone tested them and can vouch for their accuracy?
Hi everyone,
Just a quick update. The 100k voltage divider worked perfectly. My new voltage water level relationship is below.
Thanks again for your help @shicks.
James
<h2 class=”user-nicename”></h2>Attachments:
Hi all,
Just an update. I sent an email to the tech support team at Millonetech, and we were able to confirm that the eTape sensor I am using is not a resistance to voltage module (as I suggested above), but contains a simple voltage divider. This version works fine with 5v VCC, so that is not a problem.
I purchased some 100k resistors and will build a 1/2 voltage divider tonight. I will let you know if I am successful at eliminating the strange behavior.
Thanks for your help.
James
Hi Shannon,
Yes using the Mayfly ver 0.5b. I am using the ADS1115, and reading 50 ADS readings at 50us intervals and storing them in an array. I am then taking the median of the array and multiplying by 3.3 before dividing the whole thing by 17585.0.
I have the Mayfly jumper on the ADC section set to 5v rather than 3.3.
It was my understanding that there is a voltage divider already built into the eTape. Would I need to create another on top?Relevant code is attached.
Thanks for your help.
James
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191// #include <Arduino.h> // The base Arduino library//// #define RESISTOR 1000// #define SENSORPIN A1//////////// void setup(void) {// Serial.begin(115200);// }////// void loop(void) {//// float reading;// reading = analogRead(SENSORPIN);//// Serial.print("Analog reading ");// Serial.println(reading);//// reading = (1023 / reading) - 1; // (1023/ADC - 1)// reading = RESISTOR/ reading; // 10K / (1023/ADC - 1)// Serial.print("Sensor resistance ");// Serial.println(reading);//// delay(1000);// }#include <EnableInterrupt.h> // for external and pin change interrupts#include <LoggerBase.h> // The modular sensors library#include <Adafruit_ADS1015.h>#define eTapePin 2//#define VREF 3.3 // analog reference voltage(Volt) of the ADC#define SENS_ON 22Adafruit_ADS1115 ads;#define SCOUNT 40 // number of sample points to collect for averaging// the value of the 'other' resistor//#define SERIESRESISTOR 1000// What pin to connect the sensor to//#define SENSORPIN A0void setup(void) {Serial.begin(115200);ads.begin();pinMode(eTapePin,INPUT);digitalWrite(SENS_ON, HIGH);}void loop(void) {float reading; float voltage;int analogBuffer[SCOUNT]; // store the analog value in the array, read from ADCint analogBufferTemp[SCOUNT];int analogBufferIndex = 0, copyIndex = 0;while (analogBufferIndex < SCOUNT) // read the sensor every 50 milliseconds, SCOUNT times and store in array{analogBuffer[analogBufferIndex] = ads.readADC_SingleEnded(eTapePin); //read the analog value and store into the bufferanalogBufferIndex++;// if(analogBufferIndex == SCOUNT)delay(50u); //delay 50 milliseconds between taking sample}analogBufferIndex = 0;for(copyIndex=0;copyIndex<SCOUNT;copyIndex++) // for coppyIndex = 0 to SCOUNT-1analogBufferTemp[copyIndex]= analogBuffer[copyIndex]; // copy analogBuffer to analogBufferTempvoltage = (getMedianNum(analogBufferTemp,SCOUNT) *3.3)/17585.0; // read the analog value,//// // convert the value to resistance//reading = (65536/reading) - 1;//reading = SERIESRESISTOR / reading;Serial.print("Sensor voltage: ");Serial.println(voltage,5);delay(1000);}// calculate a median for set of values in bufferfloat getMedianNum(int bArray[], int iFilterLen){ int bTab[iFilterLen];for (byte i = 0; i<iFilterLen; i++)bTab[i] = bArray[i]; // copy input array into BTab[] arrayint i, j, bTemp;for (j = 0; j < iFilterLen - 1; j++) // put array in ascending order{ for (i = 0; i < iFilterLen - j - 1; i++){ if (bTab[i] > bTab[i + 1]){ bTemp = bTab[i];bTab[i] = bTab[i + 1];bTab[i + 1] = bTemp;}}}if ((iFilterLen & 1) > 0) // check to see if iFilterlen is odd or even using & (bitwise AND) i.e if length &AND 1 is TRUE (>0)bTemp = bTab[(iFilterLen - 1) / 2]; // then then it is odd, and should take the central valueelsebTemp = (bTab[iFilterLen / 2] + bTab[iFilterLen / 2 - 1]) / 2; // if even then take aveage of two central valuesreturn bTemp;} //end getmedianNum// Liquid Level Sensor Sketch// Show the raw resistance values measured from an eTape liquid level sensor.// See details on the sensor at:// https://www.adafruit.com/products/1786// Created by Tony DiCola// Released under an MIT license: http://opensource.org/licenses/MIT// // Configuration values:// #define SERIES_RESISTOR 1000 // Value of the series resistor in ohms.// #define SENSOR_PIN 1 // Analog pin which is connected to the sensor.//// // The following are calibration values you can fill in to compute the volume of measured liquid.// // To find these values first start with no liquid present and record the resistance as the// // ZERO_VOLUME_RESISTANCE value. Next fill the container with a known volume of liquid and record// // the sensor resistance (in ohms) as the CALIBRATION_RESISTANCE value, and the volume (which you've// // measured ahead of time) as CALIBRATION_VOLUME.// #define ZERO_VOLUME_RESISTANCE 0.00 // Resistance value (in ohms) when no liquid is present.// #define CALIBRATION_RESISTANCE 0.00 // Resistance value (in ohms) when liquid is at max line.// #define CALIBRATION_VOLUME 0.00 // Volume (in any units) when liquid is at max line.//// void setup(void) {// Serial.begin(9600);// }//// void loop(void) {// // Measure sensor resistance.// float resistance = readResistance(SENSOR_PIN, SERIES_RESISTOR);// Serial.print("Resistance: ");// Serial.print(resistance, 2);// Serial.println(" ohms");// // Map resistance to volume.// float volume = resistanceToVolume(resistance, ZERO_VOLUME_RESISTANCE, CALIBRATION_RESISTANCE, CALIBRATION_VOLUME);// Serial.print("Calculated volume: ");// Serial.println(volume, 5);// // Delay for a second.// delay(1000);// }//// float readResistance(int pin, int seriesResistance) {// // Get ADC value.// float resistance = analogRead(pin);// // Convert ADC reading to resistance.// resistance = (1023.0 / resistance) - 1.0;// resistance = seriesResistance / resistance;// return resistance;// }//// float resistanceToVolume(float resistance, float zeroResistance, float calResistance, float calVolume) {// if (resistance > zeroResistance || (zeroResistance - calResistance) == 0.0) {// // Stop if the value is above the zero threshold, or no max resistance is set (would be divide by zero).// return 0.0;// }// // Compute scale factor by mapping resistance to 0...1.0+ range relative to maxResistance value.// float scale = (zeroResistance - resistance) / (zeroResistance - calResistance);// // Scale maxVolume based on computed scale factor.// return calVolume * scale;// }</div>
<div class=”adL”></div>Hi Sara,
I worked through this and everything compiles correctly now! Thanks for your help.
I did wonder about the linter in Atom. From what I have read there seems to be an issue with linters working with .ino files in Atom. Have you guys found anything that works?
James
Thanks @srgdamiano! I will try again when I get home from work.
I am using Atom with PlatformIO. How do I turn the linter tools on? thanks also for the tip on ‘extVoltage’. I was going to write a function that did the same thing as the unnecessary repetition was starting to bug me!
James
Hi Scott @ensign,
Thank you for this, and apologies for not getting back to you sooner. For some reason I wasn’t alerted to your reply.
This is exactly what I was after!
Thanks again. I will let you know how we get on.
James
-
AuthorPosts