| Arduino Forum ::  Members :: arduinoadrian
 Show Posts Pages: [1] 2 3 ... 19
 1 Topics / Science and Measurement / Re: ranging cap meter not quite correct on: March 11, 2014, 05:45:39 pm Thanks for letting me know all that. Quoteuntil I get my hands on some suitable relaysThat will definitely help. I would also try to get a BIFET opamp just in case... Good luck and enjoy your project.
 2 Topics / Science and Measurement / Re: ranging cap meter not quite correct on: March 11, 2014, 09:36:55 am QuoteHowever I would expect any impedance mismatch to be constant during the  cap discharge as I can't  imagine the circuit  impedance changing as the  DC voltage falls or the capacitance is changed.That makes a lot of sense; but still better nor to have it neither having to compensate. On the other hand, the impedance could behave non linear still at such low currents. Testing will tell. I don't know.Although I have not clear idea of the connections you have made and I need to put more time analyzing the circuit. It looks, the resistors connected to pins 9 and 12 could be creating a voltage divider connected to the cap. When one of the pins let's say 9 goes to LOW, the other (12) I guess is HIGH to suppress the ground path. That in reality connects it to 5V and with the other to ground there is a voltage divider. If both are LOW or HIGH then they are simply in parallel to either ground or 5V. I think Arduino digital outputs can't take 3rd state of high impedance and they are either low or high??
 3 Topics / Science and Measurement / Re: ranging cap meter not quite correct on: March 11, 2014, 03:31:12 am One thing at a time.The method in theory should work as it is already proven science. Implementing it in practice is a different story. Trying to achieve "auto ranging" at the same time is introducing additional problems, before implementing the basic solution to have a working circuit. So, I would try to go step by step and have a working thing first and then auto ranging.-It looks this is a typical case where the measuring method is affecting the variable being measured.The Arduino A0 and pin 13 are connected to the cap under test. Maybe  in the picofarad  region for the tested caps, the effect of the leakage currents involved are in the same orders of magnitude as the discharge currents through the discharge resistors. That could be contributing to the nonlinearities and errors you are getting in the results.Possible solutions:-Use a buffer OpAmp (as voltage follower) with BIFET high input impedance to tap the voltage on the cap and send it to A0. This will minimize loading the cap with the instrument of measurement. -The discharge resistor should be high as to provide enough time for the readings to take place; but not too high as to be comparable with the leakage currents of the cap being measured. Also if the discharge takes too long then the voltage presented to the Arduino A/D converter may take too long to change one quantifiable step, reducing the resolution in the time measurement. -Make sure when the measurement is done only the discharge resistor and the OpAmp input are connected to the cap. For that, you can use relays as the switching devices to avoid any leaks which will influence the measurement.-Concentrate on having a working circuit first and then move into auto ranging.
 4 International / Proyectos / Control de Voltaje Computarizado (Mejorado con alta resolucion PWM) on: March 10, 2014, 06:59:24 am Esta es una version mejorada del Controlador de Voltage (iluminacion) construido anteriormente.http://forum.arduino.cc/index.php?topic=223712.0En el caso anterior, al utilizarse analogWrite() para manejar las salidas, la resolucion de la senal de PWM y los pasos de voltaje obtenidos estaban limitados a 256. Esto pudiera no ser suficiente en algunas aplicaciones donde se requiera mas precision. En la nueva version aqui mostrada, la senal de PWM y el voltaje pueden cambiar en 1000 pasos diferentes. Hay una pequenisima inestabilidad como se observa en el video; pero aun asi, en mi opinion es mejor que solo disponer de 256 pasos diferentes.. La inestabilidad puede ser causada por varios factores, tales como: el tiempo que demora Arduino en leer los valores recibidos desde la computadora, es decir, el tiempo de comunicacion o el ruido introducido por las lamparas entre otros. La frecuencia de la senal de PWM seleccionada es de 1/15msec~66Hz y el ciclo util varia de 0 a 100%, como se muestra en el video. Se emplearon para manejar las lamparas los pines de salida 8,9,10,11 correspondientes a Dim 1,2,3,4. Este fue un projecto construido rapidamente, asi es que si encuentran algun problema, por favor dejenme saber.Construido con Processing 1.5.1 y Arduino UNO.Gracias.http://www.youtube.com/watch?v=271qPIFaC2E&feature=youtu.be
 5 Topics / Science and Measurement / Computer Dimmer (Improved with higher resolution PWM) on: March 10, 2014, 01:26:51 am This is an improvement of the previous computer dimmer (voltage controller) here: http://forum.arduino.cc/index.php?topic=223709.0In that case, since I was using analogWrite() to drive the outputs the resolution of the PWM signal generated and the voltage steps were limited to 256. That could be not enough for some voltage control applications where more precision is required. In this update, the PWM signal generated and the voltage can change in 1000 steps. There is a little instability though, as can be observed in the video; but still its better than having only 256 steps only, I think. The instability may be caused by different factors, such as: the time it takes for Arduino to read the values coming from the computer and the noisy lamps being used. The PWM frequency selected in this case is about 1/15 msec ~ 66 Hz and the duty cycle is changed from 0 to 100% as shown in the video. The digital output pins used are 8,9,10,11, corresponding to Dim 1,2,3,4.Built with Processing 1.5.1 and Arduino UNO.http://www.youtube.com/watch?v=271qPIFaC2E&feature=youtu.be
 6 Topics / Science and Measurement / Re: ranging cap meter not quite correct on: March 09, 2014, 02:30:48 pm I have been working for a long time now on something which even when is for a different purpose; is very similar in operation. I ran into several of the same problems you are having now.Some of the experiences learnt while doing it are these:-To gain in accuracy, the loop should be as fast as possible or at least  the reading and comparison with the target voltage, has to be performed several times within the same loop. That will allow you to detect when the threshold is surpassed almost immediately, otherwise the error introduced in the measurement will be too much and probably unacceptable.- Increase the discharge time (increase the discharge resistor) as much as possible. That will make any delays in the detection insignificant with respect to the total time, thus reducing the error. In my case, the discharge time is about 100 sec; but its a different application though.-Try using micros();-Create a function to read the voltage and make the comparison. Call that function inside the loop several times, whenever you think there has been too much time elapsed which may compromise accuracy.-Set a target loop or inter-readings time, that will satisfy the speed required for the readings and comparisons intervals which will introduce an error in the measurement, acceptable for your needs. For example, less than 1% of the time constant you are determining.-Use precise 1% or lower discharge resistors. They should also be high stability and low temp coefficient. If not, there will have unacceptable temp drift.You can increase the loop speed by:-Reducing the info sent to se serial monitor, both in length and quantity.-Avoid complicated math operations. I'm not sure; but floating point math may be slower.-delay() is forbidden!-Do not use while(). If there is no other option call the ReadAndCompare() function from inside it.-Reduce the amount of instructions to a minimum possible. Perform any non essential tasks after the discharge time has been measured. Then there is plenty of time for non essential calculations, etc.-Another possibility is to set a while loop to ReadAndCompare() only and when the value is found the exit condition is met. That way, it will search constantly in very short time intervals, which may increase your accuracy. In this case, you need to guarantee the condition will be met at some point. Set an alternative exit route from the while loop with a push button or similar, in case there is a failure and the program gets stuck.Hope this help you with your Project.
 7 Topics / Science and Measurement / Re: ranging cap meter not quite correct on: March 08, 2014, 07:45:00 am -unsigned long timevariable???  time can't be negative I think, so better only long timevariable.-Do you really need long variables. Does your time can get longer than what an int can take? Please check that.-Try using micros() instead. You may be able to boost accuracy, but you will probably need longs, which you already have.-From the results, the loop is taking about 214msec. Isn't that too slow?. That can be contributing to the jumps from 0-1022 although I don't think that's the only reason. There maybe more.-Sending tons of huge strings to the serial monitor is good for step by step checking or presenting examples as the case now. But...,it slows down the thing, I guess. Communication is slow. Can your system take that slow motion even when you want accurate time readings with small jumps intervals?
 8 International / Proyectos / Control de Voltaje (Iluminacion) Computarizado on: March 05, 2014, 06:30:00 pm Hola:Este es un controlador de voltaje (iluminacion en este caso) desde la computadora construido con Arduino y Processing 1.5.1. El voltaje aplicado a las lamparas varia de 0 a 10V utilizando Modulacion de Ancho de Pulso (PWM), a traves de las salidas digitales 3,9,10,11 de Arduino.y analogWrite(). En el ejemplo mostrado,, se controla el voltage aplicado a las lamparas; pero en realidad es un controlador de voltaje que puede ser utilizado para otros tipos de cargas tambien. Las lecturas de voltaje indicadas por los Galvanometros, representan los valores de voltaje establecidos que se quiere aplicar a las lamparas. Estos no leen el voltaje real que esta siendo aplicado, lo cual es muy diferente a esto. El multimetro en la imagen esta conectado unicamente a la lampara manejada por Dim 1 y esta midiendo el voltaje aplicado a esa sola lampara como ejemplo. El voltaje aplicado a las otras lamparas, no esta siendo medido en el video. Gracias.
 9 Topics / Science and Measurement / Computer Dimmer (Voltage Controller) (Arduino+Processing) on: March 05, 2014, 06:16:26 pm Hi:This is a computer dimmer built with Arduino UNO and Processing 1.5.1. The voltage applied to the Lamps is varied from 0-10V using PWM Arduino outputs 3,9,10,11. and analogWrite(). In reality it is a voltage controller that can be use to drive many other different loads. The voltage readings indicated in the Galvanometers on the screen, represent the voltage settings and they are not measuring the actual voltage applied to the Lamps, which is very different from that. The Multimeter in the image, is connected to the Lamp driven by Dim 1 only. It is measuring the voltage applied to that Lamp as example. The other Lamps voltages are not being measured.Thanks,
 10 Topics / Science and Measurement / Re: ranging cap meter not quite correct on: March 04, 2014, 10:57:36 am I know how it is man, I had the same questions not too long ago... It took me while to figure it out though, so I tried to save you some time  . In very little you will realize, this kind of coding is even easier than BASIC and the others. The computer will save you a lot of time resolving the lines numbering and jumps (I don't know how) without you having to do it. I suggest you start by looking at some examples first ,to get a better idea about how to do it and not make the same mistakes I did, trying to program in Basic at first.  A few days ago, I posted an example which might help you figuring it out: http://forum.arduino.cc/index.php?topic=217512.0Good Luck with your Project.
 11 International / Proyectos / Nivel de Burbuja GUI (Arduino+Processing) on: March 03, 2014, 10:47:11 pm Hola:Este es un nivel de burbuja (GUI) construido con Processing 1.5.1 para ser utilizado en Proyectos basados en Arduino. Las variables X, Y estan siendo manejadas por potenciometros conectados a las entradas analogicas A0 y A1 de Arduino. Las mismas estan expresadas en pulgadas (inches) lo mismo que la distancia (D).Construido con Processing 1.5.1 y Arduino UNO.Espero les ayude a encontrar ideas y soluciones para sus propios proyectos.Gracias.
 12 Topics / Science and Measurement / Bubble Level GUI (Arduino+Processing) on: March 03, 2014, 10:40:55 pm Hi:This is a Bubble Level GUI built with Processing 1.5.1 to be used in Arduino based Projects. The X and Y variables are being driven by potentiometers connected as voltage dividers to the Arduino analog inputs A0 and A1. They are both expressed in inches, likewise the Distance (D).Built with Processing 1.5.1 and Arduino UNO.Thanks,
 13 Topics / Science and Measurement / Re: ranging cap meter not quite correct on: March 03, 2014, 07:14:00 pm Something like this;int ValueRead=analogRead(0);// its better this way as you may need to use the value later on avoiding having to read it again. That's if you can live with the old value. If the loop is slow you might need to read again to update.if(ValueRead>0){ Discharge();}else{StopDischarge()}void Discharge() //the function or method Discharge {//Anything you need to do to keep discharging}void StopDischarge() //the function or method StopDischarge {//Anything you need to do to stop discharging}The Arduino loop will do whaetver you say Discharge() is and it will continue right there when that (subroutine as you call it) finishes. It will check again in the next loop though and will keep discharging until so, without clogging the program as while() does.In "modern times" they call what you (and me) knew as "subroutines" functions or methods a more appropriate term for Object Oriented Programming  . I haven't found an equivalent for GOTO though. The lines are not numbered as they were before or at least you can't see it, so there is no reference where to jump. The way to do a GOTO is just calling a "function" or "method" when you need it. The program returns automatically to where it was. No need for Return or End. You need to forget about BASIC.  . I had to do it too. Takes a while to "unlearn" it though.
 14 Topics / Science and Measurement / Re: ranging cap meter not quite correct on: March 03, 2014, 10:35:13 am On a quick look:-Serial.begin(9600); should be on the void setup() and not in void loop(). There is no need to repeat that constantly.-while (analogRead(ledPin)>0){ //until full discharge. Doing nothing while that condition is true can result problematic.}. Getting a real zero reading maybe difficult as the cap discharge takes a long time. Noise could also be blocking the program from exiting that while loop.-Too many while() loops is risky. The loop gets stuck very easily unless its properly done and the exit condition can be satisfied at some point.-Try replacing the while() loops by if() whenever possible and check the results. I suspect one of them is blocking the whole thing all together; but I haven't checked thoroughly.