VREL #2 and #4: General Purpose IoT Laboratory, air pushing nodes 2 and 4

The laboratory is located at Silesian Technical University, Poland, Gliwice Akademicka 16, room 310.

Introduction

The node is an airflow generator, connected to the appropriate air receiving node. There is an air duct that connects nodes (node 2 send air to node 1, while node 4 send air to node 3). The lab consists of the fan which is a source of airflow going to the air duct. The beam of the airflow can be regulated in two ways:

  • by changing the rotation speed of the fan,
  • by changing the position of the closing flap, mounted in front of the fan.

The voltage on the fan is visible on needle multimeter.

Prerequisites

The user needs to know:

  • physical effect of the airflow,
  • PWM control method,
  • working od servo-motors and its control.

Technical details

End of the pipe is fitted to fan which is covered by rectangle flap. The flap is hanging on servomotor lever. Both fan and servomotor, are connected to the PWM outputs (each has its pin, enabling to control them independently) from the SoC. It is possible to change the rotating speed of the fan, and also the position of the flap. Parallel, the voltage on the fan (effective value), is displayed on analogue spindle voltage meter and can be observed via camera.

Sensors

There is a temperature and humidity sensor in the lab node: DHT11, connected to the GPIO0 (D4).

Actuators

There are two actuators (fan, servo) and LCD display.

  • The fan is a DC controlled one, where using PWM one can change rotation speed.
    • the pin is GPIO 15/ D8
  • The servo is an analogue servo, Emax ES08A II:
    • min timing 1500us max timing 1900us
    • the pin is GPIO 14 / D5
  • LCD is I2C controlled, present under address 0x3F on the I2C bus
    • I2C bus is connected to the:
      • SDA GPIO5 / D1
      • SCL GPIO4 / D2

Software, libraries and externals

LCD display requires a dedicated library. Of course, you can control it on the low-level programming, writing directly to the I2C registers, but we do suggest using a library first. As there are many universal libraries, and many of them are incompatible with this display, we strongly recommend using ''LiquidCrystal_I2C by Tony Kambourakis''. The LCD I2C control library can be imported to the source code via:

#include <LiquidCrystal_I2C.h>

Then configure your LCD controller:

LiquidCrystal_I2C lcd(0x3F,20,4);  // set the LCD address to 0x3F 
                                   // for a 20 chars and 4 line display

Communication

You can connect your ESP8266 microcontroller via its integrated WiFi interface to the separated IoT network. Then you can communicate with other, already connected devices and even provide some information to the cloud. In details, there is a dedicated MQTT broker waiting for you. You can also set up your soft Access Point and connect another node directly to yours.

The communication among the devices can be done using MQTT messages: exchanging data among other nodes (M2M) and you can even push them to the Internet.

Reference data

Using your Node, you can access it and publish/subscribe to the messages once you connect your ESP to the existing wireless network (this network does not provide access to the global internet and is separated, but please note there are other developers and IoT nodes connected to this access point:

  • SSID: internal.IOT
  • Passkey: IoTlab32768
  • Setup your microcontroller for DHCP, to automatically obtain an IP address, your ESP will obtain the address from the 192.168.90.X pool.
  • MQTT server is available under the fixed address: 192.168.90.5, and the credentials to publish/subscribe are:
    • User: vrel
    • Password: vrel2018

Limits

At the same time, only one user can program the controller, although analysing the signal by others (unlimited number) the users is reasonable. Model is provided to work continuously, without service breaks. For more interesting experiments, the user should be access to complementary Rx lab at the same time (applies to the advanced lab scenarios).

Support

In case the LCD display hangs and you are sure that your code should work but it does not, it may be the case the I2C bus is stuck and hang the I2C to LCD controller converter.
In this case, please use the following code to reset the I2C bus (you can embed it to your source code or run separately, then run your original code, again):

#include <Arduino.h>
#include <LiquidCrystal_I2C.h>
 
LiquidCrystal_I2C lcd(0x3F,20,4); 
 
void setup()
{
  pinMode(4,OUTPUT);
  pinMode(5, OUTPUT);
  digitalWrite(4,LOW);
  digitalWrite(5,LOW);
  delay(2000);
  pinMode(5, INPUT);       // reset pin
  pinMode(4, INPUT);
  delay(2050);
  lcd.init(D2,D1);
  lcd.backlight();
  lcd.home();
  lcd.print("Hello world...");
}
void loop()
{
 
}

Finally, you should see Hello World message on the LCD and I2C bus should be recovered now.

en/iot-open/remotelab/sut/generalpurpose.txt · Last modified: 2021/06/11 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0