Retrieved from https://studentshare.org/information-technology/1691374-embedded-systems-seeeduino
https://studentshare.org/information-technology/1691374-embedded-systems-seeeduino.
Embedded Systems and DrivesIntroduction: With the increasing need for dedicated computer functionalities to solve specific problems, the importance of embedded systems cannot be overlooked. As explained by (Marwedel, 2006), embedded computer systems are helpful in solving specific problems. The author further points out that; embedded computer systems make it possible to satisfy specific end user’s needs. In the project, the main aim was to implement a domestic security and monitoring system.
In its development, it required the building and setting up of real nodes. A small board was to be built with an ‘ATmega328 microcontroller, a sensor and a radio transmitter. The system was to be comprised of (1-16) sensor nodes and one central hub. The following code blocks show the implementation of the project. The codes as explained in the comment box. Node:For this exercise, each node was to be identified as an 8-bit code. Four bits compromised of a system code which are all from the same number while the other four bits were used to identify a node within the system.
Void settingtheTime(){……..}This function set Unix based operating system time, both date and hours. Delay (1000) Time changes are displayed after 1 second. There are 1 second increments in the time.(screenshot 4)Void processSyncMessage() {…..} This function sets the arduino system time based on user input for both date and hoursVoid Receivedata(): Takes received data from array and stores as integers. (screenshot 5)Void Dumphtml() This function received data and then turns them into equivalent output format.
The following data is printed: System ID, Node ID, Temperature ( C), Humidity (%), and Time.(screenshot 6)For the condition, from if (sysIdS== sysId), is that the value received for systemID matches the value set for the systemId, nodeId check is true, and is within value of 0 to 16 in terms of arrays, then the condition is True, the n the commands with the curly braces are therefore executed. For this case, the immediate action is to display date, temperature, Humidity etc. for (int m = 0; m < array_size; m++) The for command, in this, defines a variable called m and gives this variable an initial value of 0.
The text m < array_size appears after the semicolon. This is the representation of the condition required in staying within the loop. Therefor in other words, when m is less than array_size, things inside with the curly brackets will repeat.(screenshot 7)For the condition, from if (z== 2), is that the value of z is 2. If this condition is true, then z is reset and an html output is displayed with table having the title Menu.(screenshot 8)Exactly the same as dumphtml but for a comma (,) separated value format.
(screenshot 9)Screenshot (11)#include and #include introduce the required libraries for time for the system sleep and Transmitter respectively.#define sleep_time 10000 –This is the value of the assigned time for sleeping that is 10 seconds.#define DHTPIN 11 – Points where the temperature sensor is connected.#define DHTTYPE DHT11 – The type of DHT sensor that was being used. Voild nodename () allows for the user to give a node a name which will be printed in both dumpcsv and dumphtml.
nodesNaames Is an array. [NodeNameSell] selects an element within that array that is then given the name stored in nodename0.(screenshot 12)Void deleteNode () deletes a node from the system by setting the value relating to the nodes ID in the boolean array to false. (screenshot 14)(transmitter screenshot 1)Void loop () {….} initialises port initial state and data direction registers(transmitter screenshot 2)Explanation and improvementsThe project implementation started with the identification of the required variables.
The variables were then declared, with their relevant libraries also called. To ensure that the 16-nodes are identifies, each node was declared as an integer, and assigned a name. The blocks of codes are explained in the comment box. The comment section explains why certain codes were used in a given section of the program. The transmitter and receiver snapshots are also provided. The codes are well structured, and well explained by use of comments. For this reason, no notable improvement concern in the coding.
ReferenceMarwedel, P. (2006). Embedded system design. New York: Springer.
Read More