Learning Center
Plans & pricing Sign in
Sign Out
Your Federal Quarterly Tax Payments are due April 15th Get Help Now >>

Wireless Programmable Timer_1_


									Wireless Programmable Timer
       Design Review
        Designed by:
       Jonathan Bitzer
       David Winkler

                         TA: Dwayne Hagerman


Introduction …………………………………………………………………...             3
    Background                                       3
    Motivation                                       3
    Features and customer benefits                   3
Design …………………………………………………………………………                   4
    Block diagram and description                    4
    Schematics                                       6
    Program Flow                                     8
    Wireless protocol state diagram                  9
    Wireless Choices: Advantages and Disadvantages   10
Performance Requirements ………………………………………………..         11
Preliminary Simulation Results ……………………………………………      12
    User interface example                           12
    Battery Backup Execution                         13
    Current Limits for AC/DC converter               13
    Interference/packet destruction                  14
Testing Procedure …………………………………………………………..            14
Tolerance Analysis ………………………………………………………….            15
Ethical Considerations ……………………………………………………..         15
Cost Analysis ………………………………………………………………..              16
Schedule ……………………………………………………………………..                 17


       Our plan is to create a wireless programmable timer that you would put between
an appliance and the wall outlet. It will turn the appliance on and off according to a
schedule. The idea would be to program the timer using a computer over some form of
wireless technology instead of using the dial and pins present on traditional timers.

        This design is, in our opinion, a very good capstone project, integrating several
different topics that the both of us have covered in our coursework and experienced in the
working world. The project incorporates pieces from power, communications, circuit
design, networking, and software design to create a complex end product. We also chose
it because it presented new challenges that we didn’t get the opportunity to undertake,
such as Windows programming and using PIC microcontrollers. It is a multi-faceted
design with a useful function for the everyday end-user.

Benefits to customer:
    Simplify programming of timers, so that the user can just set it on the computer
       and the timer is automatically programmed
    The device will be relatively small and unobtrusive due to it not having the
       standard programming dial present on most timers.
    Allow lamps or other appliances to be pre-set to turn on and off at specific times,
       great for vacations or any time you will be away from home.
    Using remote desktop technology, users could access their home machines
       remotely and reprogram their home timers.

Product Features:
    Battery backup to maintain schedule and time in event of temporary power
    Wireless on/off switch on the timer in order to allow the user to prevent future
    Reset switch to allow for clearing the current timer schedule out of the memory,
       and let the device operate as a simple pass-through.
    Wireless communication to program devices with a Windows PC
    Transmitter device has standard USB interface for maximum compatibility.


                                                                       USB Interface

                                     USB Power

                                                          Wireless Transmitter


                                                                                       Wireless Switch

                        AC:DC Converter                       Wireless Receiver
    AC Power IN                                                                          Backup



Block Descriptions
The transmitter is the generic term for the PC-side component which gets the data from
the software, then takes that information and communicates with the timer devices. Its
components are the USB connector, the USB-to-Serial converter, and the transceiver

          USB connector – A standard connection device which takes the signals and
           power output from the USB port and relays them to the other devices in the

          USB to serial – This block transforms the incoming data from the USB port to
           a serial stream that is more compatible with the Linx devices. The input comes
           from a USB connector and its output is able to go directly to the transceiver.

          Transceiver – This takes the serial stream and transmits the data wirelessly to
           a compatible transceiver on the device side. In the transmitter component,
           there is in fact two-way communication occurring, but its primary purpose is
           to transmit the information to the timers.

          Antenna Switch – Since the transceiver is in actuality separate transmitter and
           a receiver component, there will need to be a switch which dictates the path
           information will flow to and from the antenna.

       Transceiver – This takes the transmitted signal from the computer and outputs it
       serially to the controller. As with the transceiver on the PC-side, there is two-way
       communication occurring, but this side’s function is primarily to retrieve the
       information and send it on to the device. The design includes the antenna switch
       mentioned above.

       PIC Microcontroller – The PIC is the component on which our timing program
       will run. It will coordinate the power management, store the program data (such
       as its unique ID and that of its transmitter), and interpret the clock input.

       AC/DC converter – Since PICS and other small components operate at much
       lower voltages then 120 V, and on DC rather then AC, we will need this part to
       step down our voltage to the TTL level. The converter not only converts the wall
       power to DC but also down steps the voltage to ~5V which would be far more
       suitable for the devices in the timer.



                                                                DIP    CS1
                    USB-B          GND                                 GND
                                   DAT+   USBDP          RI            VCC
                                   DAT-   USBDM          DCD           PDN
                                   VCC    GND            DSR           RSSI


                                          VCC        DATA_IN           DATA_OUT
                                          SUSP_IND   DATA_OUT          RXM-HP3
                                          RX_IND         RTS                      OUT1   VCC
                                          TX_IND         CTS                      GND    IN
                                          485_TX         DTR                      OUT2   Vcont
              TO ALL VCC
                                          SDM-USB-QS-S                 GND        UPD5713TK
                                   220                           DIP   CS1

Program Flow
                     PC Side                                                              Device Side

                    Program                                                                 Program
                    Entrance                                                                Entrance

                      Nà 0

                 Find Device(N)         No     N=Max?


                     N alive?                Yes                                           Signal Alive

                Output: Device not



                   Load First
                   Available N

                     Valid?                                                                Wait for data


No                 Wireless                                                                 Wireless
                 Communication                                                            Communication


                                                                                          Calculate time
                      User                                                                   offsets


                                                               Turn                Turn                    Interrupt
                                                                Off                 On

                                                                                          Time reached?
                                                                      On or Off?

Wireless Protocol State Diagram
                      Transmit Side
                                                                                           Receiver side



                      Wait for Alive           notAlive/alert program                     On program start

                    All accounted for
                                                                                            Wait for query

                       Wait for data
                      from program

                                                                  Recd(notquery)          Send(response)

                                                                                            Wait for query

   Timeout on

                     Wait for Query                                                          send(ACK)

                                                                                            Wait for data

                Recvd(response)/SendData      Recvd(notAC
                                                   OR                    Recd(data)/    Recvd(data)/Send(Ack)
                                                timeout/                  sendACK           ActOn(data)
                      Wait for ACK
                                                                                              Wait for



                        Wait for

Wireless Options
The primary options for our wireless system were
    Zigbee
    Bluetooth
    Linx
    WiFi
    TI

Option         Data rate, bps    Price (TxRx)     Range     Security?               Fop, MHz
Linx           10,000            $21              <3000ft   No                      418;900
Zigbee         100,000           $19              <300ft    Zigbee protocol         2400
WiFi           Up to 54Mbps      *                <300m     Various                 2400
Bluetooth      700,000           30.00            <100m     Bluetooth protocol      2400
TI CC2400      10,000            *                *         No                      2400

*feature not researched; option determined to be inappropriate before it was found.

    Zigbee            Low power, low data rate
    Bluetooth         Widely accepted standard, available for PC
    Linx              Simple, transparent operation, allows for creation of own protocol
    WiFi              Widely available, OS-independent, reliable, good encryption
    TI                single-device transceiver, transparent operation, no protocol
    Zigbee            Designed for mesh networking; protocol more than needed.
    Bluetooth         Needs constant connectionàhigher power use.
    Linx              No high functionality; simply sends/receives.
    WiFi              High power; congested; overkill for our purposes.
    TI                Basically single-chip Linx, just not readily available like Linx.

In the end, we chose to go with Linx, because it was easily accessible, and because it
allows us to create our own protocol. We originally intended to use the LR series, which
operates at 418 MHz, but since the lab had HP chips on-hand, we switched to those; thus
the cost-efficiency of the updated design is no longer biased towards Linx, since the HP
series is significantly more expensive as outline in the cost analysis($75 versus $21 for a
transceiver pair).

Performance Requirement
The range is very important to the timer and may be the most important requirement. We
are aiming for a range of 200 feet. We feel this is more range then the vast majority of
houses would ever need. Also, we want to keep the cost down to a reasonable level,
which is another driving for choosing to cap the range at 200 feet. To be specific, we are
requiring the device be programmable 95% of the time at 100 feet and 75% of the time at
200 feet.

The battery backup will need to hold the current time and schedule in the memory. This
needs to have a relatively long life to it. After researching, we found that typical power
outages last between 30-90 minutes. After much consideration, we feel that 12 hours will
be the goal for the life of the battery backup. This takes into account very rare, long
outages and will probably not be used to its full extent in practice.

Since we are using wireless communications, wireless performance is a big concern.
However, we would most likely be transmitting bits of data at a time so we feel
performance will be more then adequate for transfer speeds.

Additionally, since we are using the controller to keep the time, we need to set a drift
tolerance over the course of a year. We feel that the timer can lose up to 1 minute a year
with out being adversely affected or even noticeable. Although for practical
considerations, it will be difficult to test that accurately over our timeframe of a day or
days at most.

Preliminary Simulation Results

Timer Control GUI

This is a simple, yet effective GUI for controlling the timers. In our mock-up, only two
timers are present in the program, but more can easily be added to the interface. To
program the timers, the user just needs to enter a start time and end time for the program
along with AM or PM. They can choose a number from the combo box or enter it
manually. Also, a user may not want to update both timers during the session. To take
this into account, there is a checkbox for each timer so the user can specify which timer
they wish to program during the current session.

In our design, we will be hard coding identification codes into the timers themselves and
the Timer Control application. This will be to simplify the prototyping and testing
process for the timers. However, if this were a shipping product, this may not be
practical. For a shipping product, one solution would be to ship each timer with a label
showing its unique identification code and when the application is run, the user enters the
code into the program, allowing the timer to enter the network. Other solutions such as
letting the application “sniff” the network can be a security risk as it might inadvertently
pick up a neighbor’s device. Entering the identification code into the application is a very
secure way to guarantee you are only using your devices.

Battery backup execution

The function of our battery backup provides a Vout which is:

        Vout = Max[Vconverted,Vbattery]

Thus, the Vout(Vin) =
                          {     Vconverted,
                                              Vin >= 4.5V
                                              Vin < 4.5V

Graphs of Operation: Vout vs. Vconverted , I vs Vin

Red represents the current through the battery, blue the current through the AC-DC

Current Limits for AC/DC converter

Total current available I = 1 A = 1,000 mA
I(load) = I1 +I2 + I3 +… for all components in circuit

Check major components to make sure current is within supplied limits.

I(transmitter) = 19 mA
I(receiver)= 14 mA
I(PIC) = 300 mA
I(ant. Switch) = 0.170 uA

I(load) ~= 0.333 A – We are well within our current limits.

Interference Issues

Due to the wireless communication in our project, there is always the potential for
wireless interference if the device goes into widespread use. Our original proposed range
was 300 feet. However, if during testing we feel the range is too high, we could decrease
it to alleviate interference issues. Adequate precautions have been taken to ensure privacy
and the risk of destructive interference is very low. Each timer is coded with a unique ID
that the user enters when they first set up the timer with the computer. This guarantees
the user cannot “accidentally” program a timer that is not under their physical control.

The communication protocol with the timers is a burst transmission. There is only active
communication when programming the timers. Also, this programming will likely be less
then one second. So, the only interference that can occur is due to destructive interference
from 2 users programming their devices simultaneously. However, the two users would
have to program the devices within a second of each other AND be within wireless
communication distance of each other. We feel the chances of these events occurring
simultaneously are negligible. In addition, the wireless protocol has program verification
built in so if a device were programmed incorrectly, it would retry until it gets it right.

Testing Procedure

We will want to test that our programming is operating correctly. To do this, we would
isolate the microcontroller. Then we would program the microcontroller using a direct
serial connection with a specific timer program. By doing this, we are also testing the
crystal oscillator which is necessary for maintaining the correct time internally.

To test the range of the timer, we can attempt to program the device at various distances
multiple times in order to get an indicator of reliability in the field. By averaging the
success of a wide variety of trials, we can get an indicator of the greatest programming
range of the timer.

Power Supply
We have two requirements for the power supply.
First, when the timer is active, the device must act as a pass through (i.e, Vin = Vout to
within some marginal tolerance level.) We need to examine the output signal on the
oscilloscope to verify it is acceptable to run an appliance off of. The Vin and Vout will not
be identical due to internal resistances.

Second, the AC:DC converter must produce the appropriate ~5V level for Vin’s within a
certain range of the 120V wall voltage. We need to verify the fluctuations around the 5V
level are not too high as to go above the maximum operating voltages for any

Battery Backup
We will have to determine the life of our controller once our battery takes over after an
outage. This can be done by letting the timer run off of the battery for extended periods
of time, then plugging the timer back into the wall and verifying that the schedule and
time were maintained correctly in the memory of the microcontroller.
Also, we will need to monitor input voltage to our controller at the moment of
switchover, to determine the voltage drop that occurs. The drop has to occur within the
normal operating voltages of the PIC or else we risk damaging the part.

Tolerance Analysis
The power supply will be the one component whose proper operation has the most effect
on the device’s performance. It has the most important role in the circuit, since
everything must run off of its power. We must verify that the converter will correctly
transform the high voltage to the ~5V required for operation, so we will test the stated
ratings of the converter to ascertain that it will indeed work under these extremes.

Ethical Considerations

The primary issue of any engineering project is user safety. We are designing a circuit
that uses 120V of AC power and this can be very dangerous if not properly protected. To
protect the user, we are using an AC\DC converter with very few exposed parts for
maximum safety. Also, the relay for controlling the voltage will be adequately protected
from accidental contact.

The main ethical issue raised in the project is the possibility of programming someone
else’s timers inadvertently or purposely. To counter this, we added unique identification
codes to each timer. This prevents accidental programming from occurring.

There is also the possibility of malicious reprogramming. There are many clever people
in the world who, with much work, can figure out how a system works. In an ideal world,
we would employ either symmetric or public-key cryptography in order to make secure
communications with the transmitter. However, to do this we would need a computer
processor capable of handling intensive calculations, where all we have is a PIC, which
has limited computational capabilities. We are employing a system where we shift the
transmitted bits so it isn’t completely obvious what we are communicating with the
device. In addition, we have added a wireless on/off switch to the device. This will
disable wireless communication from the timer when the user leaves his/her home for
example. This helps greatly for preventing unauthorized programming of the timers. We
understand that these are only steps toward a completely secure product, but we think
we’ve come up with excellent solutions given the resources we have at our disposal.

Cost Analysis
Labor Costs:
       Team Labor: $30/hr* x 90 hours x 2 people x 2.5 = $13,500

                                   PC Transmitter
Part                         Manufacturer Price          Quantity   Total    Status
TXM-900-HP3                  Linx             29.50      1          29.45    OH
RXM-900-HP3                  Linx             45.00      1          45.00    OH
SDM-USB-QS-S                 Linx             14.50      1          14.50    TBO
SA58643                      Philips          2.45       1          2.45     TBO
USB-B-connector              Tyco             1.00       1          1.00     TBO
LEDs                         ECE stores       .10        2          0.20     TBO
220-ohm Resistors            ECE stores       .75        2          1.50     TBO
ANT-916-SP                   Linx             2.00       1          2.08     TBO
                                    Timer Device
TXM-900-HP3                  Linx            29.50       1          29.50    OH
RXM-900-HP3                  Linx            45.00       1          45.00    OH
PIC16F877A                   Mircochip       8.50        1          8.50     OH
CFM05 AC-DC Converter        Cincom          17.00       1          17.00    TBO
SA58643                      Philips         2.45        1          2.45     TBO
32KHz Crystal Oscillator     Sparkfun Elec. 1.00         1          1.00     TBO
ANT-916-SP                   Linx            2.00        1          2.00     TBO
Printed Circuit Boards       ECE shop        90          1          90       TBO
Capacitors, various sizes    ECE stores      .50         4          2.00     TBO
220-ohm Resistors            ECE stores      .75         2          1.50     TBO
LEDs                         ECE stores      .10         2          0.20     TBO

TOTAL PARTS:                                                        291.55

Total Cost, Labor and Materials:                                     $13,791.55

OH = On hand
TBO = To be ordered


Week of    Task                                                Person Responsible
2-12           Create wireless protocol flow (complete)       Jon
               Obtain necessary software (VisualStudio,       Dave
                OrCad, Visio…) (complete)
2-19           Research various wireless options, determine   Jon
                best solution (complete)
               Determine form of Battery-Backup               Dave
                Management (complete)
               Acquire/order parts                            Both
2-26           Research VisualStudio programming              Dave
               research PIC programming                       Jon
               Build transmitter prototype                    Jon
               Build device prototype                         Dave
3-5            Begin PIC programming                          Jon
               Begin PC programming (interface, sending       Dave
                data to USB)
3-12           Test w/pre-programmed time (ie, the timer is   Jon
                self contained).
3-19           Spring Break: Debug Code                       Both
3-26           Test wireless transmission (basic send         Dave
                voltage/receive voltage)
               Components should all work in isolation
4-2            Test implementation of wireless protocol on    Jon
                single device
               Continued improvement of both sides’ coding    Both
4-9            Test with two timers in system                 Jon
               Determine system limits (range)                Dave
4-16           Final report document                          Jon
               Final presentation                             Dave


To top