@▷ Ethernet based Security System | Diagram for Schematic

Ethernet based Security System


The need for Security systems have rapidly grown from being specialized for high-risk areas (like banks, companies , governmental institutions), to be available and demanded rapidly by the average public. In the last ten years, small businesses have rapidly grown and expanded and the need of reliable, cheap and effective security system is becoming a must ,not only for the business owners ,but also at homes . One of the offered way of security systems offer the SMS notification service , nice but not that reliable . SMS center could have a congestion at the time the thief was sleeping in your company (or home) borders . Well another method of creating a security system and which would be very effective is to use the Internet or Ethernet Notification system . It is reliable, when using TCP, and effective where most internet services are always on demand and it is very rare , and very unlikely to have a sudden failure.





Commercially available Security systems are too expensive



Unfortunately, this could be a little pricy since most embedded Ethernet devices cost a large amount of money and they are usually hard to deal with . That’s why I was so interested and a little bit surprised with wiznet offering of the W5100 Hardwired TCP/IP Ethernet chip . I was so amazed of its various features especially the support for TCP and UDP protocols essential for an Ethernet based security system . And what shock me the most was its price ($5.20) . You can actually build a security system over the internet using an Ethernet device that would cost you about the same as any microcontroller. Simply amazing !


Now, why to even bother to create such a system while it could be commercially available ? Well, here the problem arises, Despite their commercial success, most if not all commercially available devices target large corporations and companies ,neglecting the need for this system to the home residents and small business owners . I am not saying it is not available for them , but it is way pricy for normal consumers. Here comes my project into place .


My Solution



I have constructed a TCP based security system using the Ethernet module offered within the contest , an ATmega16L microcontroller , a PIR as a sensor and few other peripheral devices , which is specially targeted for homes and small business owners.

I have used through for my final design a combination of the WIZ810MJ module , an ATmega16L microcontroller , a 7.3728 MHz crystal (compatible with my bootloader programmer), a DS1302 timekeeper , a PIR to sense the human movement through the body heat , a keypad for initial configuration and a 2×16 LCD for display. The design also include regulators to power up the circuits.


See ! it is really a simple but effective design . It is a compact, complete, and easy to install security system designed with home users and small businesses, since it is affordable as you can see that it was built using an handful of inexpensive and cheap parts.


How it works



Well , the system should be installed near an internet source and a cable (crossover or straight-through as it depends) should be plugged in to the module’s Rj-45 jack.

If the system is in rest mode (acting as TCP server) . It waits for commands from the client (its IP address can be programmed or change initially or during operation) and execute them (after a password is entered obviously )while still inspecting for any Alarm which would arises from the PIR sensor . When any Alarm triggers , it switches into client mode (acts as a TCP client) and starts sending warning signs.

The system uses motion sensing (based on human body heat) to trigger an alarm which sends a message to the server containing a timestamp presenting the exact time the Motion was detected acting as a real-time surveillance system . For increasing safety from the risk arising from a false alarm , it sends the alarm signals for about 5 minutes and then it stops for 10 minutes and so on assuming the alarm was still active ... Clearing the way for the costumer to stop the alarm if he noticed some kind of a failure as the system acts as a server in these 10 minutes. This false alarm is very rare and it could occur as a result of maybe a passing squirrel maybe or some relative passed by and forgot to turn the alarm off .. etc .. So although it is rare but should be taken care of.

Once it is connected and powered on , (it takes power from 3 sources ,3.3v ,5v,and 12 v for the PIR) the system enters into the configuration mode .


Configuration mode



In the first start-up of the system, it enters the configuration mode . It is just a feature that I added for the design to be more flexible. The System asks you first (through the LCD interface) to enter a 4 digit password , I didn’t do a masking feature because I sense there would be less error when you can really see the password written on the LCD , and there isn’t off course any viruses or key loggers are there ?!

The system will also ask you about the current date and time which is necessary for the validity of the timestamp associated with the Alarms. Otherwise, if the time was miss-entered ,the customer may lose track of when the alarm was really triggered.

After entering the current date the system asks the customer to chose between accepting the default IP setting or reconfigure them depending on his own needs . The customer will be asked to enter the System IP Address ,the subnet mask, the default gateway address , the MAC address desired , and the destination or Server IP address in which will give commands remotely to the security system and will also receive Alarm signals when the motion is sensed . and here ends the configuration , I didn’t really see any more necessary feature to add to the configuration ,but this doesn’t block the way for future improvement as minor adjustments could be made and the user could be given more flexibility in the future versions.


Server Mode : what happens when the alarm isn’t on



Well , in this mode , I added some features which I guess were essential and primary for this application . When I first thought about the design , I said hey ,, lets control all the damn house ,, why not right ? especially that the wiznet chip can tolerate such feature . But as time ran over I decided to stick to the main idea of security system . why would anyone control his home while he isn’t there ?!! He would just need to protect it ,,, and thus I optimized the control for security purposes only.

OK, what happens when the customer connects to the system . Off course everyone would expect there will be a password so not anyone who would connect to the system would mess up your house. So you must enter a password before you can send commands. The command set is limited actually for the purpose I mentioned above to be dedicated only for security. Therefore , you can turn the lights on and off . This feature looks at the first time as control but it is an effective way to say to the burglar stop , I am in the house and fully alert ... The burglar wouldn’t expect that you have my product.

Anyway, you can also change the destination IP address of the server in which it is eligible to connect to the system as you could change your location and as a result you may have to change the server address remotely. Off course, you have to logout after you finish configuration to be safe and secure that no one but you could log in to your system.

One nice feature I added is the ability to turn Lights on and off to convince any potential thief that the house is already occupied, so he would forget the whole operation from the start , and while it is a control feature , it is a very good security feature. PS: the led’s o/p could be connected to any relay’s input and it will work splendidly .



Client Mode : When a movement is sensed



When the system detects any motion through the PIR , It directly switches into the client mode . It reads the current time and sends the alert message containing the timestamp . As I mentioned before it keeps doing so for 5 minutes, stopes for 10 minutes and resume the operation if the alarm was still triggered and so on . Through these 10 minutes , it goes back to server mode just in case the customer know that it was a flow and wanted to turn it off.


Block Diagramm



I was really interested since I went to college to study communication systems ( I am now in the junior year in college in the CEE department, Communications and Electronic Engineering), to be able to monitor my home in my absence. This is a big issue here since most people in my country own summer homes in the mountains which remains unprotected and empty all winter . There were I first decided to build a compact remote security system designed for ordinary people to protect their valuables . I did chose the Internet as the abstract though, since through my search on the net it seemed very complicated and expensive . Therefore when I heard about the contest from my colleague I was both thrilled and surprised. Thrilled to find my call and surprised to hear about such a product. When the wiznet module first came three weeks ago I was so enthusiastic I began developing the module adapter right away .(The PCB was already published on the net , I just did the fabrication)

As I run over the datasheet I was really relieved that the module supports SPI as I usually chose components in embedded design to be compatible with SPI and I worked a lot with it on the past. It was really easy to control W5100 sing SPI and after I initialized The PORTS and the SPI registers , the rest was easy using the following function :


unsigned char spi_transfer(volatile unsigned char data)
{
SPDR = data; // Start the transmission
while (!(SPSR & (1<<SPIF))); // Wait for the end of the transmission
return SPDR; // return the received byte
}


It was a little disappointment though the lack of support for the SPI Interrupt handler . But It worked smoothly nevertheless .

After we have forgotten all about SPI using this function the next thing to do is to write functions which would be able to read and write to the module’s registers, and as you can see below, this wasn’t a hard job to do either .

unsigned char wiz_rd(unsigned int address)
{
unsigned char data = 0x00;
PORTB &= ~(1<<PIN_SLAVE_SELECT) ; //enable slave
spi_transfer(WIZNET_OPCODE_READ);
spi_transfer((address>>8) & 0x00FF);
spi_transfer(address& 0x00FF);
data = spi_transfer(DUMMY_DATA);
PORTB |= (1<<PIN_SLAVE_SELECT) ; // Disable slave
return data;
}
void wiz_wr(unsigned int address, unsigned int targetValue)

"Ethernet based Security System Search Tags"
circuit, alarm, security
Advertiser