ECE4006B
From GanjaLinux
This is the senior design project page for ECE 4006 Section B, Group 9
Group Members:
- Matt Gochnour
- Carter Harrison
- Brandon Remus
- Ryan Revels
Contents |
Project Overview
For our senior design project, we created a 'smart automated dog door'. We feel that such dog door has many uses, especially in home automation and security as well as general convenience. The technology within the dog door could easily be applied to automate other home appliances and services.
The door contains a microprocessor which allows the user to program a schedule through a wireless web-based interface as to when the door is able to be unlocked. The dog wears an infrared transmitter on its collar that communicates with two receivers, one on each side of the dog door. The receivers will alert the door when the dog is in proximity of the door and will unlock to allow the dog to either go outside, or come back into the house. When the door is scheduled to be locked, it will not allow the dog to go outside, but it will always allow the dog to come back inside. The desired functionality of the dog door is illustrated below in the following state machine.
Obviously, not all of the different possible states are connected. This is because of the scheduler. Given a schedule, the dog will be in one of four states with relation to the outdoors.
Technical Overview
Hardware
The dog door contains a small PCB mainboard which houses many of the electrical components necessary for the operation of the door. A list of the electrical components necessary are listed below, but the most important components are the Atmel ATMega128L AVR Microprocessor and the TrendNet Compact Flash 802.11b Wireless Card. The AVR is responsible for keeping track of the time and schedule as specified the user. Additionally it is responsible for communicating directly with the wireless card, in order to provide a web interface for the user to configure the dog door. The list of parts is as follows:
- Atmel ATmega128L 8-bit Microprocessor
- Matched Infrared Emitter and Phototransistor Detector
- Cypress Semiconductor IC SRAM 128KX8
- Compact Flash Connector / Header
- Trendware TrendNET Compact Flash 802.11b Adapter
- 7.37 Mhz Oscillator
- 32.768 Khz Crystal Oscillator
- 3.3 Volt IC Voltage Regulator
- Octal Tristate Address Latch (IC)
- Various Capactiors / Resistors
- Servo
The PCB board was designed by Fred Eady of EDTP Electronics and author of Implementing 802.11 with Microcontrollers. The PCB Board is powered by a DC power supply capable of delivering between 5 to 9 Volts with a current of at least 500 mA. A DC voltage regulator circuit drops this voltage to 3.3 Volts which is within the acceptable voltage range for the ATMega128L as well as the rest of the components on the board.
The board is equipped with two infared phototransistors, one for each side of the dog door. The dog has a small keychain attached to its collar that contains a matched infrared diode. When the dog comes into the proximity of the dog door, the IR diode triggers the phototransistor on the dog door and signals that the dog is either trying to exit or enter the house.
A servo mechanism housed within the dog door will lock and unlock a deadbolt allowing the dog to pass through the door should the owner's schedule permit it. The servo and deadbolt assembly serves to keep the dog inside when it is not allowed to go outside, as well as to keep other animals or intruders from coming inside.
Upon powering up, the ATMega128L immediately instructs the wireless card to associate with a specified 802.11b network. Currently the owner must own a wireless access point and may not use an adhoc network. While adhoc capability is possible, it was not implemented in this prototype. Once associated with a network, the ATMega128L starts its internal clock and begins keeping track of the time using the 32.768 Khz crystal oscillator. The user must program the time into a configuration webpage to set the internal clock. Additonally at this point, the user can program a schedule into the dog door.
Software
The software that runs the dog door is written entirely in C, and can be downloaded into the ATMega128L via a JTAG programmer attached to a PC. In order to serve a webpage, an 802.11 driver and TCP/IP stack were necessary. Our implementation of a TCP/IP stack is based on a 4 layer model as illustrated to the right. The physical layer is compact flash 802.11b wireless card. The software is constantly looping, waiting for a new frame to arrive from the network. Upon the arrival of a new frame and if the protocol is IP (as opposed to ICMP), the IP layer diagnoses the specific layer transport protocol to be used based on the IP header. If the protocol is determined to be TCP, the packet is passed to a TCP function in the transport layer. This TCP function communicates with the application layer to gather data and to send it back up the stack and back out to the network.
Overall the software is mostly monolithic, meaning all interrupt handling is handled within a main loop. The only exception to this is the interrupt for the real time clock, which is handled outside the main loop. It is important that the dog door keep accurate time, and it cannot do this effectively when handled within the monolithic structure.
The application layer consists of a scheduling system which can be programmed to allow the dog to exit the house at certain times. The application layer is constantly polling the realtime clock, checking to see what the dog is allowed to do at that time. The application layer is also responsible for building real time dynamic webpages by constructing strings of HTML.
A zip file containing our commented code can be seen here. <-- LINK.
Cost Analysis
Over the course of 4 years, our team projects an overall profit of $518,458.33 can be made from selling the automated dog door. Weâve projected to sell at least 16,200 units during the time frame. Given the fact that there are over 40 million dog owners in the United States alone, we feel that this is a reasonable goal. In an aim to gain market attention, we will market the dog door at an introductory price of $500 for the first year. We plan to increase the price to $550 and $575 during our second and third years respectively. During our fourth year, we will drop the price down to $500 so we can empty our inventories of any unsold units. While we understand that the price of our product is high, we also feel that this is a product of convenience and luxary and is thus marketed towards the high end of the market. A detailed cost analysis can be seen here. <-- LINK.
Additional Considerations
There are many additional features and considerations that could have been implemented should time and money allow it. Below is a short list of features that we would like to add in the future.
- Backup battery for internal clock
- Storing user settings and schedule in onboard non-volatile EEPROM.
- Implement an unobtrusive hard-wired strategy for powering the dog door.
- More friendly user interface.
- Adhoc network mode would be desireable for users who own a wireless laptop, but do not have an access point.
Obstacles
During the course of developing the dog door, there were several unforseen obstacles that we had to overcome in our design. Below are some details regarding the obstacles and how we overcame them.
- At one point in the project, the PCB board flat out stopped working. After several days of trying to debug the problem, we realized that one of the pins coming from the microcontroller had become unsoldered. We aren't sure how this occured, but after 2 weeks of debugging, the issue was finally discovered.
- The device that was purchased to program the ATMega128L at one point malfunctioned and no longer worked. This created a huge bubble in our development pipeline because we could not continue to work on the software while we waited for a new programmer to arrive. Luck would have it that the new programmer that arrived did not work either. After careful examination, we realized that there was a resistor missing from the surface of the new programmer. We pulled the corresponding resistor off the old programmer and soldered it to the new one, and the new programmer began to work. Amazing!
- For a reason unbeknownst to us, the webpages served by the dog door do not always refresh correctly. We feel that this issue lies within the TCP stack or application layer, but we have been unable to diagnose it at this point.
Useful Links
- Resources for embedded linux devices
- ATmega128L Data Sheet
- AVR Freaks.com - Everything Atmel
- Infrared Decoder Circuit
- An affordable Atmel Programmer & Debugger
- The people that make the collar "key"
- Controlling the Servo with our Board using PWM
- Open Source Modular Calendar Libraries in C
- HTML Calendar Generating Software (free)
- Real Time Clock software and specifications

