How the final year project works
For this electrical engineering final year project, we are basically using the two relays to control our home appliances, which are a lamp and a fan. However, we use LEDs to check out if the program works or not in the process. The main idea is to control the home appliances by the text message sending by the predefined phone number.
After the text message is received, it would be stored in the SIM card. The program will keep tracking if there is a new message delivered. If there is a new text message delivered, the program would read the message and check if the phone number completely matched to the predefined phone number stored in the program. If the number does not match, the program would just simply delete the message, and then keep tracking for the next message to come in. On the other hand, if the phone numbers match, the program would go to the next step: check if the message matches to a string stored in program.
In order to do the task correctly, there will also be some predefined strings stored in the program, such as “Turn on lamp”, “Turn off lamp”, and so on. If the message in the text message matches one of the predefined strings, it would perform the task which the predefined string indentifies. For example, if the user sends the message “Turn on lamp”, the program would turn on the relay 1, so that the lamp would be turned on. However, if the message does not match any one of the predefined strings, the program would send a text message back saying “Wrong command”.
When the program has done the task, it would send a text message back for confirmation. The content of the text message is different in different situations. For example, if the user sends a text message to turn on the lamp when lamp is off, the program would send a text message “Lamp is now on” back to user after it turns on the relay. But if the user sends a text message to turn on the lamp when the lamp is already on, the program would send a text message “The lamp is already on”.
No matter which return text message is sent, the program would delete the text message read before. Then the program will go back to keep tracking if a new text message comes in. The program keeps running in the loop for five functions:
- Track the new text message coming in
- Check the phone number
- Check the string in the text message
- Send a text message back to the user
- Delete the message read already
How to use our senior project
First, the program needs to be downloaded into the board. Then, setting up the hardware is the next step. One external power supply is needed; however, when plugging the external power supply, the status of the jumpers on the board needs to be confirmed. The safety information about the jumpers and power supply will be talked about in the next section. After plugging in the home appliances which are going to be controlled, the system is ready to go.
When the system is active, send a text message which is exactly the same as one of the predefined command strings stored in the program. The message must be sent from the phone number which is exactly the same as the predefined phone number stored in the program as well. If the phone number and the command are matched, the board will do the task indentified by the command string and send a confirm message. The table of the command string in different relay status is shown below:
| Command | Current State of Appliance | Return strings |
| “Turn lamp on” | Lamp is already on | “Lamp was already on!” |
| Lamp is off | “Lamp is now on!” | |
| “Turn lamp off” | Lamp is on | “Lamp is now off!” |
| Lamp is already off | “Lamp was already off!” | |
| “Turn fan on” | Fan is already on | “Fan was already on!” |
| Fan is off | “Fan is now on!” | |
| “Turn fan off” | Fan is on | “Fan is now off!” |
| Fan is already off | “Fan was already off” | |
| “Appliance status” | Lamp on, fan on | “Lamp is on. Fan in off.” |
| Lamp on, fan off | “Lamp is on. Fan is off.” | |
| Lamp off, fan on | “Lamp is off. Fan is on.” | |
| Lamp off, fan off | “Lamp is off. Fan is off.” | |
| (Anything else) | - | “Unknown command!” |
Table 2- Relationships between commands and return strings in different situations
After the return message is sent, the board will wait for next message. It will do the task only if the phone number and the text message match the predefined ones.
Safety information
Power
The power supply for this board is done in two different ways: power from a 12VDC either with an internal backup battery or without it. According to the user manual of the board, when power is from 12VDC with an internal backup battery, the jumpers’ set up must be:
- Jumper of BAT_E must be open
- Jumper of 5V_CHE_E must be open
- Jumper of 4V_E must be closed
- Jumper of 4V_VBAT must be closed
On the other hand, the second condition is power from a 12VDC without an internal backup battery. In this case, the jumpers must be set up by the opposite way:
- Jumper of BAT_E must be closed
- Jumper of 5V_CHE_E must be closed
- Jumper of 4V_E must be open
- Jumper of 4V_VBAT must be open
According the user manual, connect an external +12V power supply only when the jumper of BAT_E is open. Also, the voltage of the battery should be higher than 3.8V.
When set up
Because the connection cables, such as the ICSP connection, did not come with the board when delivered; we made a connection on our own. However, the connections are really easy to lose and easy to touch each other.
Also, in order to set up a loop for the relays, we cut an extension cord in half to assemble it. By this way, it is easier to set up the home appliances we want to control, and we just need to plug the appliance into the extension cord. Because there is a current flow limitation, about 50MA, for the extension cord, plug the home appliance and the extension cord needs to be done cautiously as well. The figure below illustrates all power that enters the board.
The top of the figure shows where the 12VDC enters the board. Before plugging the 12VDC power supply in, effectively energizing the circuit, you should be certain that the wires are not touching. Next to the 12VDC the power that runs through the relays is supplied. In our project this power is 120VAC. The method of implementing this power is with an extension cord that has been cut, as mentioned previously. Before energizing the extension cord by plugging it into the wall you should be certain the AC wires will not touch each other. Sparks will result from touching which can cause a disaster. Fire could possibly result, or damage to the board may occur.
