The file contains M file which connect 2 Arduinos platform; One for input serial data of 4 sensors (2 DHT22 and 2 LDR) from Arduino and another for output which control two continuous servo motors and LED brightness. The main decision module for the project was governed by artificial intelligence technique, namely fuzzy controller using MATLAB software (Fuzzy Logic Toolbox).
3 inputs and 3 outputs were considered in the Fuzzy Inference System (FIS).
Inputs: Temperature inside, temperature outside and light level outside.
Outputs: Blind angle, blind length and LED
Triangular membership function was used. This FIS has total of 27 rules.
All the set up and FIS were built at the MATLAB command line.
‘fuzzy3.m’ defines the FIS inputs and outputs variables, membership functions and rule list.
‘FIS rule based.xls’ defines the Fuzzy rules that will be added into the rule of FIS.
‘serialread2.m’ reads the data in serial from the 4 sensors (2 DHT22 amd 2 LDR) connecting to Arduino and convert the string into numbers.
‘nearest.m’ convert the value to the nearest defined value of the blind angle and blind length in every 90degree rotation of motors.
(Blind angle = [0 7 8 14 19 27 30 37 42 52 57 73]
Blind length = [38.7 36.5 34.5 32.4 30.2 27.8 25.3 23.2 21.3 18.7 16.3 14.0 11.5 8.8 6.8 5.0])
The purpose of this conversion is to make the response turn more effectively and accurately as well as to save the energy if the difference of the next rotation of the motor is very small.
‘DEMO.m’ is the main coding consists of all the functions. From setting up Arduino, defining FIS, collect sensors data, evaluate FIS from the detected FIS inputs, and upload the data to ThingSpeak.
Minor correction in description.
Create scripts with code, output, and formatted text in a single executable document.