Tutorial: Salida digital PWM. LED y potenciómetro.


Pulse Width Modulation (PWM), es una técnica utilizada para recrear un comportamiento analógico mediante señales digitales. Dicha señal digital es una onda cuadrada, la cual tiene dos valores: valor alto (5V en el caso de las placas Arduino) y valor bajo (0V).

La relación entre el tiempo que la señal está en nivel alto y nivel bajo se conoce como ciclo de trabajo (Duty Cycle, expresa en %). Por lo tanto, una señal que está 1ms en nivel alto y 1ms en nivel bajo, será una señal con 50% Duty Cycle. Entonces, ¿qué porcentaje queremos utilizar? Dependiendo de la tensión final que queramos tener. Es decir, se multiplican los 5 V de nivel alto que tienes por el % del ciclo de trabajo y tendrás la tensión final que tendremos en la salida PWM. 

Ejemplo: 5V*50%= 2,5 V.

Ahora bien, ¿cómo generar la señal deseada en Arduino? Primero, hay que tener claro que no todas las salidas digitales valen, sólo las que están señaladas en la placa con las siglas PWM. Segundo, el generador PWM de la placa tien una resolución de 8 bits, por lo tanto, podrá trabajar con 256 valores (de 0 a 255). 

Con estas dos premisas claras, basta con utilizar la función «analogWrite(pinPWM, valor);» y así obtener la señal cuadrada deseada. En la siguiente imagen se recogen ejemplos de la función analogWrite con la relación directa entre %DutyCycle y valor del generador PWM.

Leer más

Tutorial – Huertos Inteligentes (DHT11 + Sensor de humedad de suelos)

Huertos Inteligentes (Herramientas básicas)

 En este tutorial llevaremos a cabo una simple monitorización de nuestras plantas. Esto, es aplicable a los huertos urbanos que cada vez más gente acostumbra a tener en casa. Monitorizaremos la humedad de la tierra, la humedad del ambiente y la temperatura ambiente para llevar de manera más eficiente el control y el cuidado de nuestras plantas.

Leer más

Tutorial-Review Sensor de Temperatura y Humedad DHT11 en LCD 16×02

Sensor DHT11de Temperatura y Humedad

 Para el tutorial de hoy contamos con el sensor cedido por Electrón Perdido DHT11.

Este sensor nos medirá tanto humedad como temperatura con un error en la primera de un 5% (sobre el rango 20 – 95%) y un error en el segundo de 2ºC. Se trata de errores moderados pero siempre depende de la finalidad de nuestro sensor. 

Así pues los materiales que utilizaremos para el tutorial de hoy son:

– 1 x Arduino UNO,

– 1 x Resistencia de 220 Ohmios

– 1 x Protoboard (BreadBoard)

– 1 x Sensor DHT11

– 1 x Potenciómetro de 10K

– 1 x LCD 16×02

– Cables

Leer más

Tutorial: LCD + Temperature sensor (English)

Spanish Version

The objective of this tutorial is modeling and programming an outdoor thermometer. To do this we will represent the data measured by a LM35 temperature sensor on a 16 x 2 LCD.

The components that we use will be:

1 x Breadboard 

1 x Arduino one (controller) 

1 x LM35 temperature Sensor  

1 x potentiometer (Variable resistor) 

1 x resistor of 220 Ohm 

1 x LCD 16 x 2

To begin our Assembly, we will prepare the Breadboard. First of all We will connect a wire joining our positive pole of the Breadboard with 5V PIN. Then, We will connect the negative of the Breadboard with GND in our controller. Finally, to avoid future problems we will make two bridges in the middle of the board to attach each other positive and negative each other ranks. 

Now that we have the Breadboard part will connect the LCD. So the LCD be prepared previously to connect it to a Breadboard. If you missed this tutorial you can access it here (Spanish).

We will place the LCD with the pins as in the picture setting as much as possible to the right side leaving space for the other components. Then, we will place our potentiometer and our sensor more or less as shown in the image. 

We have already placed all components in our breadboard, so we will have to start with the connections.

First step we will connect the contrast of the LCD screen. This part affects to the potentiometer and LCD components. Connecting the left leg of the potentiometer to the positive of the Breadboard (5V) row. 

To the right leg we will connect a wire to the negative (GND) Breadboard row. The center leg is that interacts with the LCD. We will connect the central leg with the third PIN of the LCD (starting on the left looking at the sketch).

Leer más