M09 Digital D2.1

 Exercici D2.1  

1. Instal·lació del suport per ESP8266 a l'Arduino IDE

Starting with 1.8.10, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit).

  • Install the current upstream Arduino IDE at the 1.8 level or later. The current version is at the Arduino website.
  • Start Arduino and open Preferences window.
  • Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
  • Open Boards Manager from Tools > Board menu and install esp8266 platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).

Recomanació d'utilització de les GPIO's:

GPIO Consell
ADC0 ENTRADA ANALÒGICA
GPIO4 I2C (SDA)
GPIO5 I2C (SCL)
GPIO9 NO UTILITZAR MAI
GPIO10 UTILITZAR PER SENSORS
GPIO0 PER SORTIDA, AMB PULL-UP
GPIO2 PER SORTIDA, AMB PULL-UP
GPIO13 PER SORTIDA
GPIO15 PER NEOPIXEL
GPIO1 NO UTILITZAR
GPIO3 NO UTILITZAR
GPIO16 BUILTIN LED

nodeMCU

2. Comprovar el funcionament

Assegurat del funcionament de l'IDE amb aquest codi:

//fitxer: intermita.ino
//cpu: esp8266 nodeMCU
//data: 28.12.2019
//@rPrimTech Jaume Nogués

void setup() {
  pinMode(16, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(16, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100);                       // wait for a second
  digitalWrite(16, LOW);    // turn the LED off by making the voltage LOW
  delay(100);                       // wait for a second
}

3. Estructura del sistema

4. Sensors analògics, digitals  i relés

Aquí tenim un seguit de sensors analògics i digitals per utilitzar amb la nodeMCU.

  • Sensor de temperatura DHT11/DHT22

  • Sensor de temperatura DS18B20

  • Sensor de temperatura analògic LM34

  • Sensor de temperatura, humitat i pressió atmosfèrica BMP/BME 280

  • Sensor de nivell de llum LDR

  • Neopixel

  • Relé