viernes, 17 de marzo de 2017

K thermocouple conditioner with lm358




http://shin-ajaran.blogspot.com.co/2013/07/quick-and-dirty-way-wiring-k-type.html

The quick and dirty way of wiring of LM358 is at the self explanatory figure below, drawn by hand from yours truly.

















http://electronics.stackexchange.com/questions/202648/problems-with-op-amp-thermocouple-circuit

Next, I looked for a schematic, even though I don't understand it. It doesn't have two resistors in the voltage divider that is familiar to me. I tried to duplicate it but didn't have a 100k potentiometer or a 270k resistor, so I tried 120k ohm resistor that was handy instead. I didn't bother with the source follower on the output since it's going to my DMM which is high impedance.
enter image description here


http://hobbyist86.rssing.com/chan-9523472/all_p2.html

Thermocouple 

Thermocouple
I got a type K thermocouple and tested that directly with a voltmeter.  It only show a couple of mV with a flame on the tip.  I added a simple 100X amplification circuit and connected that to the analog input.  Now I see a range around 300-400mV and see a clear increase when the flame is on it.  One problem I saw is that the sensor has a fair amount of mass, mostly stainless steel.  Once it heats up, it takes a while for it to cool off.  As long as there is a distinct increase when the flame comes on, this could also be used for the flame sensor.
100X Amplification Circuit for Thermocouple
The item that I struggled with the most was how to make a reliable flame sensor. This is covered in the Flame Sensor Update post. Note - the drawing for the amplifier circuit in that post has the resistor values reversed. Here is the corrected drawing.

The gain formula for a LM358 non-inverting circuit is

               gain = 1 + R2/R1

In this case, R1 = 1K and R2 = 200K, resulting in a gain of 201. This means that a thermocouple output of 5mv will produce an output of just over 1V. Using a gain of 500 would allow for better resolution of the temperature, but 200 is adequate for this purpose. I don't care about the actual temperature. I just need to see if the value is increasing to verify that the flame actually lighted.
                                                                

sábado, 11 de marzo de 2017

Infrared heart-beat sensor Arduino

Infrared heart-beat sensor

http://electronics.stackexchange.com/questions/45529/ir-receiver-signal-almost-constant

I have followed the tutorial from Makezine about an Infrared heart-beat sensor, and I have essentially used the same components listed on the video (that is, the same resistors and the same IR Emitter and Detector).
The schematics
So, with a simple source-code just reading the analog output and printing it to the Serial Monitor, I see that the sensor is working fine by just analyzing how the amplitude changes as I move the emitter around the sensor.
The problem begins when I try to put my finger on the sensor (I've tried many different component angles, even 180°), and in my serial monitor, the amplitude is almost constant, that is, it doesn't even make sense comparing to my real heart beat rate. It looks something like (10ms delay):
34,34,34,34,34,34,34,35,34,34,35,34,34,34,34,34,34,34,34,34,34,35,34,34...
Now, I want to know if there is a way to amplify the sensibility on this sensor, if possible without using any op-amps, or if I'd have to change the IR components to something stronger, like the ones that look like a usual color LED.
Or even if the ambient light is interfering (which I don't think so, because I cover pretty much the entire IR pair with my fingers), or if the unamplified current has too much resistance (which I also think it doesn't influence in this specific problem, but I may be wrong).
Other than that, any solution is appreciated.
shareimprove this question


up vote 1 down vote accepted
A smaller resistor than 270 ohms will result in more current to your LED which will make it shine brighter... that might work a little bit, but don't go past what is spec'd in the datasheet for the LED.
Honestly, I would probably buy a transimpedance amplifier from somewhere like texas advanced optoelectronic solutions (TAOS) as they're made specifically for this type of application... amplifying small light-->current signals often the result of biological phenomenon. The other thing you could try is a different wavelength of light.
Red and IR LEDs are used in conjunction for a pulse oximeter but to detect heartbeat you only need one. You could try switching to a red LED to see if you get better results. I know from personal experience that positioning this type of sensor is extremely important. You need to make sure the detector is positioned right over an artery or else there will be no variation in light absorption when your heart beats.
shareimprove this answer

    
I'll give these methods a try in the lab tomorrow, then I'll let you know by accepting your answer, thanks. – Flávio Toribio Oct 26 '12 at 4:08


http://makezine.com/2009/11/30/collins-lab-infrared-heart-sensor/

Collin’s Lab: Infrared heart sensor

 

 

Infrarred IR LED and Photodiode with Arduino

http://startrobotics.blogspot.com.co/2013/05/how-to-use-ir-led-and-photodiode-with-arduino.html

How to Use IR LED and Photodiode with Arduino

      In this post I am going to show you how to use and program IR LED and Photodiode pair with Arduino to detect obstacles in a short range. Before going to do the project let us have a brief look at the IR LED and Photodiode.

IR LED:

How-to-Use-IR-LED-and-Photodiode-with-Arduino                   IR LED means Infrared Light Emitting Diode. The IR LED emits Infrared light which is not visible to human eye. we can find these IR LED's in our TV Remotes. IR LED's works like normal LED's but the material used in the core is different, it emits Infrared Light when current passed through it. These IR LED are used to detect obstacles ahead of the robot. The IR LED emits IR light which gets reflected if any obstacle is present in the direction of emitted IR ray, the reflected IR ray caught by Photodiode which calculates the reflected light strength. The higher the reflected IR
ray strength, the closer is the obstacle and vice-verse

Photodiode:

How-to-Use-IR-LED-and-Photodiode-with-Arduino                  Photodiode is a light sensitive semi-conductor diode which converts the light energy into voltage or current based on the mode of operation. In general Photodiodes are operated in reverse bias condition. The clear Photodiode can detect visible and IR rays to limit the Photodiode to detect only IR rays a black cotting is applied to the glass of the Photodiode. The photodiode allows the current to pass through it if the photodiode is exposed to IR rays and it doesn't allow current to pass through it if no IR rays falls on it. The amount of current passed through the photodiode is directly proportional to amount of IR rays falls on it.

IR LED and Photodiode Project:

                  In this project I am going to show you How to use the IR LED and Photodiode pair to detect the obstacle in-fornt of it. I am going to program the Arduino such that, If an obstacle is present before the IR LED and Photodiode pair with in the threshold range then a buzzer will ring.

Materials required:

1) Arduino                        2) IR LED                      3) Piezo buzzer                         4) some Wires.

Circuit diagram:

How-to-Use-IR-LED-and-Photodiode-with-Arduino

How circuit works:

                 In the above circuit the Photodiode is operated in Reverse bias condition i.e., the long leg of photodiode goes to ground and the short leg is connected to 5 Volts supply through 3 K ohms resistor. When the photodiode detects IR rays from the IR LED which is reflected by an obstacle the photodiode conducts then, the current goes to the ground through the photodiode so, the current to the analog pin A0 of Arduino is low so that, we will get low values (around 500) from the analog pin A0 of arduino. In case of no IR rays falls on the photodiode the photodiode doesn't conduct so the current from the digital pin 2 goes to analog pin A0 through the 3 K ohms resister so, the readings from the analog pin A0 of Arduino will be around 900.

Program :

  int pd=2;                      //Photodiode to digital pin 2
 int buzz=13;                   //piezo buzzer to digital pin 13  
 int senRead=0;                 //Readings from sensor to analog pin 0  
 int limit=850;                 //Threshold range of an obstacle  
 void setup()    
 {  
  pinMode(pd,OUTPUT);  
  pinMode(buzz,OUTPUT);  
  digitalWrite(pd,HIGH);       //supply 5 volts to photodiode  
  digitalWrite(buzz,LOW);      //set the buzzer in off mode (initial condition)  
  Serial.begin(9600);          //setting serial monitor at a default baund rate of 9600  
 }  
 void loop()  
 {  
  int val=analogRead(senRead);  //variable to store values from the photodiode  
  Serial.println(val);          // prints the values from the sensor in serial monitor  
  if(val <= limit)              //If obstacle is nearer than the Threshold range  
  {  
   digitalWrite(buzz,HIGH);     // Buzzer will be in ON state  
   delay(20);  
  }  
  else if(val > limit)          //If obstacle is not in Threshold range  
  {  
   digitalWrite(buzz,LOW);      //Buzzer will be in OFF state  
   delay(20);  
  }  
 }  

How program works:

                 The program starts with Initializing variables photodiode 'pd' with digital pin 2, buzzer 'buzz' with digital pin 13, sensor readings 'senRead' to analog pin 0 and the limit variable is set to 500 (reading from the sensor). In the 'void setup()' method the pin mode is definde with the function 'pinMode(variable,OUTPUT/INPUT)'. In the 'void loop()' method the 'val' variable stores the readings from the sensor. The 'Serial.println(val);' method is used to print the values from the sensor to the serial monitor. I had used an if - else ladder to set the buzzer in ON state when the obstacle is in the Threshold range otherwise the Buzzer will be in OFF state.

                If you have any trouble related to this post then, express it in the comment box below.

http://henrysbench.capnfatz.com/henrys-bench/arduino-sensors-and-input/arduino-ir-obstacle-sensor-tutorial-and-manual/

Arduino IR Obstacle Sensor: Tutorial and Manual

Contents [show]

 Arduino Infrared Collision Avoidance

Collision Detector ModuleThis is yet another one of those modules with cool possibilities.   You could for example, sound an alarm when something got too close or you could change the direction of  a robot or vehicle.
The device consists of an Infrared Transmitter, an Infrared Detector, and support circuitry.  It only requires three connections. When it detects an obstacle within range it will send an output low.




How to Purchase

There are several different styles of these modules available.   If this particular one suits your needs,  you can purchase one from the sellers below:

IR Obstacle Detection Module Pin Outs

The drawing and table below identify the function of module pin outs, controls and indicators.
Arduino IR Collision Detection Module Pin Outs
Pin, Control IndicatorDescription
Vcc3.3 to 5 Vdc Supply Input
GndGround Input
OutOutput that goes low when obstacle is in range
Power LEDIlluminates when power is applied
Obstacle LEDIlluminates when obstacle is detected
Distance AdjustAdjust detection distance. CCW decreases distance.
CW increases distance.
IR EmitterInfrared emitter LED
IR ReceiverInfrared receiver that receives signal transmitted by Infrared emitter.

Arduino IR Obstacle Collision Module Tutorial

Connect the Arduino to the Detection Module

Use the picture below.  It only requires three wires.

IR Collision Detection Module Arduino Tutorial Hook UpCopy, Paste and Upload the Sample Sketch

// IR Obstacle Collision Detection Module
// Henry's Bench

int LED = 13; // Use the onboard Uno LED
int isObstaclePin = 7;  // This is our input pin
int isObstacle = HIGH;  // HIGH MEANS NO OBSTACLE

void setup() {
  pinMode(LED, OUTPUT);
  pinMode(isObstaclePin, INPUT);
  Serial.begin(9600);
  
}

void loop() {
  isObstacle = digitalRead(isObstaclePin);
  if (isObstacle == LOW)
  {
    Serial.println("OBSTACLE!!, OBSTACLE!!");
    digitalWrite(LED, HIGH);
  }
  else
  {
    Serial.println("clear");
    digitalWrite(LED, LOW);
  }
  delay(200);
}

Test the Tutorial Sketch

Move your hand towards the IR LEDs.  As you near them, the Output LED on the module and the LED for pin 13 on your Arduino will illuminate.  Open your serial monitor and vary the distance of your hand while viewing the serial monitor.   The output should look like the picture below:








IR Obstacle Detection Module Arduino Tutorial Output 



https://tkkrlab.nl/wiki/Arduino_KY-005_Infrared_emission_sensor_module

Arduino KY-005 Infrared emission sensor module

WARNING this page is a copy/past of a bad google translation so it might contain errors. If you see a error help us to make it better and log in and change it. Big thanks!
Arduino KY-005 Infrared emission sensor module Sku 135040.jpg
Buy on deal extreme sensor or kit

Contents

Infrared transmitter module

This is their specific physical map
This time we want to introduce infrared transmitter and receiver modules, in fact, they are now in our daily life. They play an important role in lots of household appliances and are used in devices such as air conditioning, TV, DVD, etc., It is based on wireless sensing, but also can be a remote control, very easy to use.

Products

  1. Infrared emitter converts electrical energy into near-infrared light. It is also known as infrared emitting diode. Its structure is similar with a general light emitting diode, but made of a different semiconductor material.
  2. The infrared receiver is set to receive, amplify, and demodulate the near-infrared light into a digital signal.
  1. The principle of infrared communication Let's look at the structure of the infrared receiver: there are two important elements insaide an infrared receiver, named the IC and PD. IC is the receiver processing element, mainly composed of silicon crystals and circuits, is a highly integrated device, its main function is to filter, shape, decode. Photodiode PD's main function is to receive the optical signal Number.
The following is a brief schematic work The modulated infrared emitting diode emittes a signal, infrared receiver, after receiving decodes, filteres, and a series of operations.

Raspberry Pi experiment

Notes

  1. Infrared emitting diodes:
parameters during operation must not exceed limit values positive To current: 30 ~ 60 mA Pulse Forward Current: 0.3 ~ 1 A reverse voltage: 5 V power dissipation: 90 mW working temperature Range: -25 ~ +80 ℃ storage temperature range: -40 ~ +100 ℃ soldering temperature:260℃
infrared emission tube and then Closed head should be paired with, otherwise it will affect the sensitivity;


  1. Infrared receiver:
Storage and use: in a low humidity environment Please pay attention to protect the infrared receiver receiving surface Contamination or wear will affect reception, and do not touch the surface Do not wash this; polluting gas or salty environment may affect the quality of reception.

Use

We first look at the diagram, to understand the infrared transmitter and receiver module specific connection with the Arduino Note: The above circuit is based on our above that kind protel schematic structures, and meet the specific pin assignment Shown in the schematic. Well, the test circuit there, look at the code under test right now This time we use to two Arduino control board, a main transmitter (Master), one as a slave receiver (Slave), Own specific set. We can according to the above schematic wiring and fixed infrared transmitter and receiver modules, here I We can work together to test it.

Hardware Requirements

  • Arduino controller × 1
  • USB data cable × 1
  • the infrared transmitter module × 1
  • the infrared receiver module × 1
Here follow the above means to build our test circuit Well, the whole test code is not long, we understand the code for those specific function of usage, then a Cut will become simpler, Come. Another point I must say is: we see the physical map will know, this used a two Arduino Board, the above code in the download time do to make it clear which is the launch, which was received? The program also Have noted, if the download is wrong, is not getting the results! Code download is complete, we open the Serial Monitor window, if you can see the following data show that It shows you are successful, ^ _ ^ From the receiving part of the code

Example Code

# Include <IRremote.h>
int RECV_PIN = 11; // define input pin on Arduino
IRrecv irrecv (RECV_PIN);
decode_results results;
void setup ()
{
Serial.begin (9600);
irrecv.enableIRIn (); // Start the receiver
}
void loop () {
if (irrecv.decode (& results)) {
Serial.println (results.value, HEX);
irrecv.resume (); // Receive the next value
}
}
Main emission part of the code:
# Include <IRremote.h>
IRsend irsend;
void setup ()
{
Serial.begin (9600);
}
void loop () {
for (int i = 0; i <50; i + +) {
irsend.sendSony (0xa90, 12); // Sony TV power code
delay (40);
}
}
The amount of points we can hand to block receiver module, see also the normal communication between them do? The following is the receive window Ah, looked at the window, and we all know it. . . . .

Conclusion

The reason why we feel that infrared is really a wonderful thing, it is because we are invisible, intangible, but Okay, we do not need that, too, can control it and make it serve us, in fact, we are more magical, Is not? Oh. . . . . . Well, today's introduction on to this, and if you are interested you can contact us, thank you!
 

jueves, 2 de marzo de 2017

Método de la Bisección para encontrar raices de una ecuacion tambien se tiene numero de iteraciones con error

Método de la Bisección para encontrar raices de una ecuacion tambien se tiene numero de iteraciones con error:

Doc
http://www.epsem.upc.edu/~fpq/numerico/resum/ceros-resum.pdf


http://portales.puj.edu.co/objetosdeaprendizaje/Online/OA10/capitulo5/5.htm


5.1. MÉTODO DE BISECCIÓN

Ver Animación...
Si f es una función continua sobre el intervalo [a,b] y si f(a) f(b)<0, entonces f debe tener un cero en (a,b). Dado que f(a)f(b)<0, la función cambia de signo en el intervalo [a,b] y por lo tanto tiene por lo menos un cero en el intervalo. (Véase la figura 5.1)
Esta es una consecuencia del teorema del valor intermedio para funciones continuas, que establece que si f es continua en [a,b] y si k es un número entre f(a) y f(b) , entonces existe por lo menos un c (a,b) tal que f(c)=k.
(para el caso en que f(a)f(b)<0 se escoge k=0, luego f(c)=0, c (a,b)).
El método de bisección consiste en dividir el intervalo en 2 subintervalos de igual magnitud, reteniendo el subintervalo en donde f cambia de signo, para conservar al menos una raíz o cero, y repetir el proceso varias veces.
Por ejemplo, suponga que f tiene un cero en el intervalo [a,b].
Primero se calcula el punto medio del intervalo ; después se averigua sí f(a)f(c)<0. Si lo es, entonces f tiene un cero en [a,c].
A continuación se renombra a c como b y se comienza una vez más con el nuevo intervalo [a,b], cuya longitud es igual a la mitad del intervalo original.
Si f(a)f(c)>0 , entonces f(c)f(b)<0 y en este caso se renombra a c como a.
En ambos casos se ha generado un nuevo intervalo que contiene un cero de f, y el proceso puede repetirse.
Ejemplo.
La función f(x) = xsenx – 1 tiene un cero en el intervalo [0,2], porque f(0) = -1 y f(2)=0.818595.
Si se denota con entonces c1 = 1. Ahora f(c1) = f(1) = -0.158529, luego la función tiene un cero en el intervalo [c1, b1] = [1,2] ; se renombra a2=c1 y b2=b1 .
El nuevo punto medio es y f(c2) = f(1.5) = 0.496242, el cero esta en el intervalo [a2, c2] y se renombra como [a3,b3].
En la tabla de abajo se muestran las primeras nueve iteraciones del método de bisección para f(x)= xsenx –1 con a=0 b=2.
n
Extremo izquierdo an
Extremo derecho bn
Punto medio cn
Valor de la función f(cn)
Error Relativo
1 0 2 1 -0.158529
2 1 2 1.5 0.496242 0.333333
3 1 1.5 1.25 0.186231 0.2
4 1 1.25 1.125 0.015051 0.111111
5 1 1.125 1.0625 -0.071827 0.0588235
6 1.0625 1.125 1.09375 -0.028362 0.0285714
7 1.09375 1.125 1.109375  -0.006643 0.0140845
8 1.1093750 1.125 1.1171875 0.004208 0.0069930
9 1.1093750 1.1171875 1.11328125 -0.001216 0.0035087
(c = 1.114157141 es el cero de f(x) = xsenx - 1)
Para detener el método de bisección y dar una aproximación del cero de una función se pueden usar varios criterios (llamados criterios de parada).
Uno de los criterios de parada consiste en examinar si |f(cn)| < , donde es una tolerancia previamente establecida (por ejemplo = 10-3). Otro criterio que puede utilizarse es examinar sí
También se puede usar como criterio de parada el error relativo entre dos aproximaciones del cero de f ,
En el ejemplo anterior si =0.005, el procedimiento se pararía en la octava iteración con el criterio |f(cn)|< , ya que:
         |f(c8)| = |f(1.1171875)| = 0.004208 < = 0.005,
pero si se usa el criterio , el procedimiento se detendría en la novena iteración porque:
Cuando se generan aproximaciones por medio de una computadora, se recomienda fijar un número máximo de iteraciones N que debería realizar la máquina. Esto con el fin de contar con un resguardo para evitar la posibilidad de que el proceso de cálculo caiga en un ciclo infinito cuando la sucesión diverge (o cuando el programa no esta codificado correctamente). Un algoritmo para el método de bisección es:

Teorema. (Error en el método de bisección).
Si f es continua en [a, b] y f(a) f(b) < 0, el método de bisección genera una sucesión que aproxima un cero c de f con la propiedad que: , n 1 (Prueba)

Ejemplo.
Para determinar el número de iteraciones necesarias para aproximar el cero de f(x) = xsen x - 1 con una exactitud de 10-2en el intervalo [0,2], se debe hallar un número n tal que:
< 10-2, es decir , n > 7.643...
se necesitan aproximadamente unas 8 iteraciones.
Observe en la tabla de aproximaciones que el cero de f(x) = xsen x - 1 es c=1.114157141 y c8=1.1171875.
El error real es = 0.003030359 3x10-3.
El error real es menor que el error dado por el teorema; en la mayoría de casos la cota de error dada por el teorema es mayor que el número de iteraciones que realmente se necesitan. Para este ejemplo, = 0.004782141<10-2 = 0.01

Notas:

  • El método de bisección tiene la desventaja que es lento en cuanto a convergencia (es decir que se necesita un n grande para que sea pequeño). Otros métodos requieren menos iteraciones para alcanzar la misma exactitud, pero entonces no siempre se conoce una cota para la precisión.

  • El método de bisección suele recomendarse para encontrar un valor aproximado del cero de una función, y luego este valor se refina por medio de métodos más eficaces. La razón es porque la mayoría de los otros métodos para encontrar ceros de funciones requieren un valor inicial cerca de un cero; al carecer de dicho valor, pueden fallar por completo.

  • Resolver una ecuación en una variable como por ejemplo: xex=1 es equivalente a resolver la ecuación xex-1=0 , o a encontrar el cero de la función f(x) = xex-1. Para aproximar el cero de f o la raíz de la ecuación se puede hacer la gráfica de f en una calculadora o usar matlab para determinar un intervalo donde f tenga un cero. También se pueden ensayar números a y b de tal manera que f(a)f(b)<0. Para el caso de f(x) = xex-1 por ejemplo f(0) = -1, f(1) = e-1 1.71828 entonces f tiene un cero en el intervalo [0,1].

  • Cuando hay raíces múltiples, el método de bisección quizá no sea válido, ya que la función podría no cambiar de signo en puntos situados a cualquier lado de sus raíces. Una gráfica es fundamental para aclarar la situación. En este caso sería posible hallar los ceros o raíces trabajando con la derivada f’(x), que es cero en una raíz múltiple.

viernes, 17 de febrero de 2017

Blender Arduino Communication Animation Serial BGE Blender Game Engine


http://robologs.net/2016/02/29/tutorial-de-arduino-y-blender/
http://blendersushi.blogspot.com.co/2014/03/arduino-interfacing-with-thinker1.html

https://www.blendernation.com/2016/10/27/arduino-blender-animated-movements/
http://blender.stackexchange.com/questions/6494/how-to-move-an-arduinos-servo-motors-using-blender
http://opendevice.criativasoft.com.br/

https://www.youtube.com/watch?v=b6JQXXdF_e8

https://www.youtube.com/watch?v=6R3lfR2NX88
https://www.youtube.com/watch?v=iPv5TrYNCF0
http://labdeeletronica.com.br/arduino-blender-python-uma-combinacao-perfeita/
https://github.com/OpenDevice/opendevice-examples/tree/master/opendevice-3d-blender

https://www.youtube.com/watch?v=tyH8HswHh0Q

https://www.youtube.com/watch?v=oYv7JFUlVU0

https://www.youtube.com/watch?v=b3PbOPIMHmY
https://www.youtube.com/watch?v=k2prOyRfimg

https://www.youtube.com/watch?v=KeAN6b02dMw

https://hackaday.io/project/9851-controlling-a-robot-arm-with-blender
https://www.reddit.com/r/blender/comments/5ef2dd/blender_3d_arduino_and_accelerometer_with_pyserial/