This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:iot-open:remotelab:sut:generalpurpose2 [2019/10/29 11:37] – pczekalski | en:iot-open:remotelab:sut:generalpurpose2 [Unknown date] (current) – external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| ===== Introduction | ===== Introduction | ||
| - | The lab consists of a mechanical airflow indicator going from the pipe (connected to a neighbour, TX lab). The indicator is a vertical flap, which changes position depends on airflow. The position of the flap is observable, using the camera and measurable using photoelectric proximity sensor. The signal from the sensor is sent to the AD converter and additionally is displayed on needle gauge. | + | The lab consists of a mechanical airflow indicator going from the pipe (connected to a neighbour, TX lab). The indicator is a vertical flap, which changes position depends on airflow. The position of the flap is observable, using the camera and measurable using a photoelectric proximity sensor. The signal from the sensor is sent to the AD converter and additionally is displayed on needle gauge. |
| ===== Prerequisites ===== | ===== Prerequisites ===== | ||
| Line 11: | Line 11: | ||
| * physical effect of the airflow, | * physical effect of the airflow, | ||
| * elementary rules od light propagation, | * elementary rules od light propagation, | ||
| - | * work of unbalanced bridge. | + | * work of the unbalanced bridge. |
| - | ==== Sensors ==== | + | ===== Sensors |
| - | The sensor of flap position is made which photoresistors. For reference, next to the flap there is immovable surface made with the same material like the flap. Like in case of flaps, here is identical photoresistor. Both of resistor make an unbalanced bridge, with is balanced, if the flap is in the start position (without airflow). For balancing bridge in the start position, two another resistors in the bridge, are build which potentiometer. | + | The sensor of flap position is made which photoresistors. For reference, next to the flap there is an immovable surface made with the same material like the flap. Like in case of flaps, here is an identical photoresistor. Both of resistor make an unbalanced bridge, with is balanced, if the flap is in the start position (without airflow). For balancing bridge in the start position, two another resistors in the bridge, are build which potentiometer. |
| - | ===== Technical details for the flap position monitor ===== | + | |
| - | End of the air duct is fitted to rectangle flap, The flap is hanging loosely and can be pushed by the airflow. The flap is lighted by LED form the top, and at the opposite side of the flap, there is the photoresistor, | + | |
| - | {{: | + | ==== Technical details for the flap position monitor ==== |
| + | The end of the air duct is fitted to a rectangle flap, The flap is hanging loosely and can be pushed by the airflow. The flap is lighted by LED form the top, and at the opposite side of the flap, there is the photoresistor, | ||
| - | Independent, | + | {{: |
| - | {{: | + | Independent, |
| + | {{: | ||
| - | ==== Actuators ==== | + | |
| + | ===== Actuators | ||
| There are no mechanical actuators in this laboratory.\\ | There are no mechanical actuators in this laboratory.\\ | ||
| LCD Display is 4x20 characters. LCD is controlled via I2C extender: LCM1602. The I2C extender address is 0x3F and the I2C bus is connected to the pins D1/GPIO5 and D2/GPIO4 (D1 is SCL and D2 is SDA).\\ As you do not have any access to the serial console, use LCD to visually trace the progress of your program, connection status, etc. By the LCD display, there are two LEDs that can be used to trace status. One LED is connected to the pin GPIO 16 while the other one to the GPIO pin 2. The former one (GPIO 2) is connected to the Serial Port TX as well so expect it flashing when communicating over serial protocol (i.e. flashing new firmware that is beyond the control of your code). | LCD Display is 4x20 characters. LCD is controlled via I2C extender: LCM1602. The I2C extender address is 0x3F and the I2C bus is connected to the pins D1/GPIO5 and D2/GPIO4 (D1 is SCL and D2 is SDA).\\ As you do not have any access to the serial console, use LCD to visually trace the progress of your program, connection status, etc. By the LCD display, there are two LEDs that can be used to trace status. One LED is connected to the pin GPIO 16 while the other one to the GPIO pin 2. The former one (GPIO 2) is connected to the Serial Port TX as well so expect it flashing when communicating over serial protocol (i.e. flashing new firmware that is beyond the control of your code). | ||
| Line 31: | Line 32: | ||
| <note tip> | <note tip> | ||
| - | ==== Software, libraries and externals ==== | + | ===== Software, libraries and externals |
| LCD display requires a dedicated library. Of course, you can control it on the low-level programming, | LCD display requires a dedicated library. Of course, you can control it on the low-level programming, | ||
| The LCD I2C control library can be imported to the source code via: | The LCD I2C control library can be imported to the source code via: | ||
| Line 39: | Line 40: | ||
| Then configure your LCD controller: | Then configure your LCD controller: | ||
| <code c> | <code c> | ||
| - | LiquidCrystal_I2C lcd(0x3F, | + | LiquidCrystal_I2C lcd(0x3F, |
| + | // | ||
| </ | </ | ||
| - | === Platformio.ini | + | ===== Communication |
| - | < | + | |
| - | ; PlatformIO Project Configuration File | + | |
| - | ; | + | |
| - | ; Build options: build flags, source filter | + | |
| - | ; | + | |
| - | ; | + | |
| - | ; | + | |
| - | ; | + | |
| - | ; Please visit documentation for the other options and examples | + | |
| - | ; http:// | + | |
| - | + | ||
| - | [env: | + | |
| - | platform = espressif8266 | + | |
| - | board = d1_mini | + | |
| - | framework = arduino | + | |
| - | lib_deps = Wire, EmonLib, Adafruit NeoPixel, Encoder,DHT sensor library, Adafruit Unified Sensor, LCD, PubSubClient, | + | |
| - | </ | + | |
| - | + | ||
| - | ==== Communication | + | |
| You can connect your ESP8266 microcontroller via its integrated WiFi interface to the separated IoT network. Then you can communicate with other nodes and players, 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. | You can connect your ESP8266 microcontroller via its integrated WiFi interface to the separated IoT network. Then you can communicate with other nodes and players, 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. | ||
| Line 76: | Line 59: | ||
| The same MQTT server/ | The same MQTT server/ | ||
| - | ==== Limits ==== | + | ===== Limits |
| At the same time, only one user can be programming the controller, although analysing the signal by others (unlimited number) the user has sense. Model is provided to work continuously, | At the same time, only one user can be programming the controller, although analysing the signal by others (unlimited number) the user has sense. Model is provided to work continuously, | ||
| - | ==== Support ==== | + | ===== Support |
| - | gabriel.drabik@polsl.pl | + | 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): | ||
| + | <code c> | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | LiquidCrystal_I2C lcd(0x3F, | ||
| + | |||
| + | void setup() | ||
| + | { | ||
| + | pinMode(4, | ||
| + | pinMode(5, OUTPUT); | ||
| + | digitalWrite(4, | ||
| + | digitalWrite(5, | ||
| + | delay(2000); | ||
| + | pinMode(5, INPUT); | ||
| + | pinMode(4, INPUT); | ||
| + | delay(2050); | ||
| + | lcd.init(D2, | ||
| + | lcd.backlight(); | ||
| + | lcd.home(); | ||
| + | lcd.print(" | ||
| + | } | ||
| + | void loop() | ||
| + | { | ||
| + | |||
| + | } | ||
| + | </ | ||
| + | Finally, you should see Hello World message on the LCD and I2C bus should be recovered now. | ||