Das sechste Türchen

Oh, my dear Santa Claus,
Come into our house very quickly.
I thought so much about you!
You brought me something, didn't you?

And with it we cordially welcome you to the Advent mini blog behind door number six. The Christmas elves from AZ-Delivery and Santa Claus have joined forces and today they have brought the surprise box M for you.

What exactly is inside the Santa boot?

The boot contains the following “gadgets” to sweeten the day:

  • NodeMCU Lua Lolin V3 Module with ESP8266 12F
  • 1x Jumper-Kabel M2M/M2F/F2F
  • 1 x HD44780 1602 LCD Module Display with I2C adapter
  • 1 x KY-036 Touch Sensor Module
  • 3 x KY-013 Thermistor Sensor Module
  • 3 x KY-029 Bi-Color LED Modul 3mm

For programming, you need the program libraries for the Arduino IDE LiquidCrystal_I2C and NTC_Thermistor. We'll show you how to do this. here

Small output of sensor data

In today's mini-blog a very simple output of the digital values of the KY-036 Touch Sensor Module and the KY-013 Thermistor Sensor Module is implemented. The values should not be displayed on the serial monitor, but on the already known HD44780 1602 LCD module display with I2C adapter and the KY-029 bi-color LED module.

Unfortunately there are no Fritzing parts for some parts of the modules, therefore the connection via table 1 and figure 1.

Pin module

Pin MicroControler

KY-013 Thermistor “-“-Pin

GND

KY-013 Thermistor “Mittlere”-Pin

5V

KY-013 Thermistor ‚S‘-Pin

A0

KY-029 Bi-Color LED “S”-Pin

13

KY-029 Bi-Color LED “-“-Pin

GND

KY-036 Touch Sensor “GND”-Pin

GND

KY-036 Touch Sensor “+”-Pin

5V

KY-036 Touch Sensor “S”-Pin

7

I2C adapter “GND”-Pin

GND

I2C adapter “VCC”-Pin

5V

I2C adapter “SDA”-Pin

A4

I2C adapter “SCL”-Pin

A5

Table 1: Connection to Micro Controller Board with ATmega328P

Figure 1: Connection to the Micro Controller

Then connect the Micro Controller to your PC and copy code 1, remembering to download and include the required libraries first. Download the program to the micro controller and after a short time you can see the temperature in degrees Celsius and Kelvin on the LCD display.

//-----------------------------------------------------
// Little example for surprise box M from Az-Delivery
// Autor: Joern Weise
// License: GNU GPl 3.0
// Created: 27. Nov 2020
// Update: 27. Nov 2020
//-----------------------------------------------------
#include <Thermistor.h>
#include <NTC_Thermistor.h>
#include <LiquidCrystal_I2C.h>

#define SENSOR_PIN A0
#define REFERENCE_RESISTANCE 8000
#define NOMINAL_RESISTANCE 100000
#define NOMINAL_TEMPERATURE 20
#define B_VALUE 3950
#define INTERVAL 1000

Thermistor* thermistor;
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
const int PinDigitalTouch = 7;
const int PinLED = 13;
unsigned long iLastUpdate;

// the setup function runs once when you press reset or power the board
void setup() {
  Serial.begin(115200);
  pinMode(PinDigitalTouch, INPUT);
  pinMode(PinLED, OUTPUT);
  thermistor = new NTC_Thermistor(
    SENSOR_PIN,
    REFERENCE_RESISTANCE,
    NOMINAL_RESISTANCE,
    NOMINAL_TEMPERATURE,
    B_VALUE
  );
  lcd.init(); // initialize the lcd
  lcd.backlight(); // backlight on

  lcd.home(); // set cursor to 0,0

//Write some text
  lcd.print("Suprisebox");
  lcd.setCursor(0, 1);
  lcd.print("az-delivery.de");
  delay(2000);
}

void loop() {
// put your main code here, to run repeatedly:
  if(digitalRead(PinDigitalTouch) == HIGH)
  digitalWrite(PinLED,HIGH);
  else
  digitalWrite(PinLED,LOW);

  int celsius = int(thermistor->readCelsius());
  int kelvin = int(thermistor->readKelvin());

  if(millis() - iLastUpdate > INTERVAL)
  {
    lcd.clear();
    lcd.home();
    lcd.print("Grad: " + String(celsius));
    lcd.setCursor(0,1);
    lcd.print("Kelvin: " + String(kelvin));
    Serial.print(String(celsius) + " C, ");
    Serial.println(String(kelvin) + " K, ");
    iLastUpdate = millis();
  }
}

 Code 1: Surprise box code

In addition, if you touch the Touch Sensor, the LED lights up green.

The NodeMCU Lua Lolin V3 module with ESP8266 12F

Now that you've gotten to know a first experiment with the components, there still remains the NodeMCU Lua Lolin V3 module with ESP8266 12F. This small (almost) all-rounder is also shown on figure 2.

Figure 2: NodeMCU Lua Lolin V3 module with ESP8266 12F

If you take a closer look at the pinout, see Figure 3, becomes clear quite quickly what the small micro controller can do.

Figure 3: Pinout NodeMCU Lua Lolin V3 module with ESP8266 12F

Currently, not too much is to be revealed, but the Christmas elves rumor that there will be an exciting Christmas article about exactly this micro controller, hence the short briefing on how to make the NodeMCU Lua Lolin V3 module with ESP8266 12F available in the Arduino IDE.

Start the Arduino IDE and open the preferences via File -> Preferences.

For the additional board manager URLs, add the address http://arduino.esp8266.com/stable/package_esp8266com_index.json added. Immediately after that, open Board Management and search for "ESP8266" and install "esp8266 by ESP8266 Community". After that, the Micro Controller is ready to be programmed.

Further projects for AZ-Delivery by me can be found at https://github.com/M3taKn1ght/Blog-Repo.

 

The AZ-Delivery team wishes you a nice Advent season!

 

Specials

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN