Pages

Wireless Drawing Device







Introduction:

For our final project, we want to build a wireless drawing device. The user uses a keypad or a mouse to draw on the TV through a wireless communication medium (RF - 433.92 MHz). The user should be able to move the drawing pointer to anywhere within the four border lines. One should also be able to draw or erase images on the TV screen.

In designing this project, we have two goals - a primary, which is realizable, and a secondary, which is feasible. Our realizable goal is to build a wireless keypad interface with the television. In this interface, we want the keypad to be able to draw and erase on the TV. When we accomplish our primary goal, we shall attempt to achieve our secondary goal: to build a wireless mouse having the same functionality as the keypad. Due to time constraints, we ended up only being able to complete the primary goal. We chose this project because we were inspired by wireless communication technology. 






Before we begin our design, there are some issues that we need to be be considered.  There are two major parts to this wireless drawing device - a TV side and a keypad side.  Therefore, there are two microcontrollers used:  one for the TV side and one for the keypad side.  The user interface (keypad side) of our drawing device consists of three buttons, left, right, and middle buttons, and a keypad or a mouse chassis.  There is also a drawing pointer of size one pixel to ascertain where the drawing will occur on the TV.

Drawing Functions

There are three things that must be done in order to draw properly on the TV screen.  The first is the drawing pointer movement.  The pointer should be able to move up, down, left, right, and diagonally in all directions.  The second thing is to draw on the TV screen. One needs to press the left button to draw wherever the drawing pointer is.  Lastly, one needs to be able to erase the TV screen. One must press the right mouse button to erase wherever the mouse pointer is.  If one presses the middle button, it will clear the TV screen and reset the drawing pointer to the center of the screen.

Wireless Communication

The connection is made via Universal Asynchronous Receiver and Transmitter (UART).  We based our design on the Atmel Mega163 data sheet.  On the keypad side, the microcontroller sends directional and button press signals to the transmitter via the TxD pin (PORTD.1), which is in turn received by the receiver on the TV side. These received signals go into the RxD pin (PORTD.0). 


Also, the transmitter sends data at 433.92MHz.  It has a maximum data rate to 4800bits/sec.  We calculate the baud rate by using the formula given in the data sheet, UBR = fck/16(UBR+1), where fck is the crystal clock frequency.  This UBR equation can be found in table 27 in the data sheet.  For a 8MHz crystal, UBR = 103 will give a baud rate of 4800. 

In order to get optimal transmission and reception, one needs to make the antenna approximately the size of one-quarter the wavelength of the transmitted signals.  In our case, the wavelength is approximately 70 centimeters, and one-quarter of that is about 17 centimeters.

Basic Setup


Our drawing device consists of three functions. The first function is the movement the drawing device. For a keypad, one can press keys 1 through 9 for directions.  Examples of these directions are 1 is move up and left, and 6 is move right. On the TV screen, the drawing pointer will move in the corresponding directions.  The second function is to draw and erase on the TV depending whether the left or right button is pressed.  Lastly, we need to encode the button presses and directional movements into a signal and send the encoded signal to the television side via the transmitter-receiver pair. On the TV side, we then need to decode the received signal in order to show the graphic on the TV screen.

The basic hardware connection is shown below:









Materials used:

  • 2 Atmel Mega 163
  • 1 keypad
  • 3 buttons
  • 1 transmitter: RCT-433-AS from Radiotronix
  • 1 receiver: RCT-433-RP from Radiotronix
  • 1 TV
  • 4 AA batteries
  • Two 0.1uF,and two 27pF capacitors
  • Two 0.01uF,and two 4.7uF capacitors
  • Two 330, two 1k, one 160, and one 75 Ohm resistors
  • One 3-terminal Positive Regulator: LM340
  • One operational amplifier: LMC7111

Hardware Design

The hardware design for this project is slightly tricky. The hardest and most time-consuming part of this design was getting all the hardware parts to communicate properly with each other. Constructing the keypad side microcontroller design, an off-board microcontroller, was interesting.
We followed the diagram given on the Build your AVR Starter Kit page. We place one 27pF capacitor to pin 12 (XTAL2) and one to pin 13 (XTAL1) with a 8MHz crystal between those two pins.  We place a 160 ohm resistor at pin 9 (reset') to pull the reset' to high to prevent constant resetting.  Usually, reset' does not require a pullup, but with the RF transmissions, there is added RF distortion on the chip, which requires the pullup at reset'.

 After many tries with different resistor values, we found that a 160 Ohm resistor gave the best result at pulling up reset'. This does cause a decent amount of current to be sucked from the battery source, but when we tried using a 10k Ohm resistor, there was still constant reseting. To program the chip Pins 6 to 11 are connected to SPROG3.  Between Vcc and Gnd, there is a 0.1uF capacitor.
On the TV side, there were a few connections needed between the TV MCU and the TV-side hardware. Here are the port/pin connections for the TV side:






PORT D
PORTD.0 to Receive data pin
PORT A
for TV Images
PORTA.6 to video
PORTA.5 to sync
NOTE: We place an operational amplifier between the receiver data pin and PORTD.0 to amplify the received signal. We amplified the signal from 3.8V to 4.6V.
On the keypad side, there is more hardware used. We use four AA batteries as our power supply for the keypad off-board MCU. We also use a voltage regulator to keep the voltage constant at 5V. The connection of the regulator to the board is shown in the diagram below.
The input pin is connected to the positive side off the battery and the output pin is the 5V power supply of the board.
The keypad port/pin connections are listed below:



PORT BPORTB.0 to button 1PORTB.1 to button 2
PORTB.2 to button 3
PORT Cto Keypad
PORT DPORTD.1 to transmitter data pin

Keypad and TV are connected as used in labs 5 and 3, respectively.




Transmitter and receiver connections to their respective MCU's are shown below:









Our software design can be divided into two different components. 

Keypad Side
On the keypad side, we need to be able to detect whether the push buttons are pressed or not, and which one is pressed.  These are taken care of in our "check_button" function by our state machine.  The state diagram can be found in the Appendix page.  Additionally, we need to find the direction that the drawing pointer is moving.  Below is a table that shows how each key press gets mapped into up, down, left, and right. This encoding scheme is done in our "encode_direct" function, which takes in four directions from the keypad. Our "get_direct" function determines which keypad directions are pressed. This state machine's state diagram can also be found in the appendix page. 


Key PressUpDownRightLeft
11001
21000
31010
40001
50000
60010
70101
80100
90110

We use timer1 for the directional movement and timer2 for checking button presses. Both timers are run at 2ms.

Like we described on the High level design page, we use UART to transmit signals. We set the UART control register to Transmit Enable by setting UCRSB = 0x08. We also need to set the baud rate to 4800 by making UBR = 103. And we set UDR = data_to_be_transferred when we want to transmit data.


TV Side
On the TV side, we need to take care of the actual drawing. On reset or when the board first initializes, the television screen draws four lines, one on each edge of the screen, to signify the borders of the screen's drawing region. It also places the drawing pointer at the center of the drawing region. Using some code that we had implemented in laboratory three for the TV drawing, we got our television to display images. We want our drawing device to draw anywhere within the four border lines.  We only use timer1 and run it at full speed on the TV side. Timer1 is interrupted after 509 timer ticks to make each frame exactly 1/60 of a second.

We use the "video_line" function to draw the border lines, "video_pt" function to draw any other images, and "video_set" function to determine whether a pixel is drawn on the screen or not. Each of these functions can be found in the laboratory three code and on the Video Generation with AVR microcontroller page.


During the vertical blanking (from line 231 to 262), We need to decode the received signal to determine what we want and where we want to draw on the television. We need to decode the drawing pointer direction and button presses for draw, erase, and clear screen. One can draw on the TV when the left button is pressed and erase when the right button is pressed. Pressing the middle button will clear the screen.

As described in the High level design page, we also use UART to receive signals. On the reception side, we set the UART control register to Receive Enable by setting UCRSB = 0x10. We also need to set the baud rate to 4800 by making UBR = 103.  We set the received_data = UDR.


RESULTS:




After much debugging and tweaking, we finally got our project to work as we specified.  All the hardware testing and debugging took a great amount of time.  Our wireless drawing device is able to transmit and receive data and draw anywhere on the TV.  We did not get to implement it so that it will work like a mouse. 
One thing that is worth mentioning here is that we had to make sure that the antennae for both the transmitter and receiver were fully extended in order get best transmission and reception results. In fact, in testing our range, we could draw on the television from anywhere in the laboratory, which is about 15 meters. We were also able to walk out of the laboratory, all the way to the water fountain outside all the labs' area, and still draw on the television; that is about 20 meters. As long as there is not much RF interference, our range and reception are pretty good.

We could draw rather quickly - no measurable delay between movement direction and resulting television image. Our drawing mechanism was also rather accurate. When trying to draw, what we wanted to draw appeared as the image on the television.

Below is a picture of our entire setup working - transmission, reception, and images being drawn on the television. On the oscilloscope, one can see that the receiver is receiving what the transmitter transmitted. On the oscilloscope, the top line with the square waves is the transmitted signal. The bottom line is the received signal. One can see that they are identical with a slight delay of about 60us between transmission and reception.




Conclusion:


After more than four weeks of designing, debugging, and tweaking, we have a fully functional wireless drawing device. We are able to use a wireless keypad to draw on a television screen. This project would have been much more intensive harder had we needed to code all the television timing and blasting to the television code ourselves. We are under our budget limit for the project. We spent a total of $5.77 on the transmitter and receiver only. We got the regulator and op-amp from the lab

If we were to do this project again, we would have initially started with the keypad instead of trying to get the photosensors working. After getting the keypad wireless drawing to work, we would then implement the photosensors, so that the user can use our drawing device like a mouse to draw on the television.

Our project is a wireless design. We are not infringing on anyone's patents by building it, but had wireless mice not been around for so long, we may very well have broken some patent laws. Our wireless medium is RF with transmissions at about 433 MHz. Nothing in this project is too hazardess to one's health. Although, on occasion, the voltage regulator would get rather hot. When that occurred, we would merely disconnect the battery source to let it cool down. So, if this were a real marketable product, we would have to take care of that issue, as well as probably making it prettier to the eye.

When we were working with our RF, there was usually at least one other group using the same frequency as we. Therefore, we needed to share the bandwidth. Obviously, sending all sorts of RF signals around the small lab room will cause interference in each other's transmissions, so we would always need to talk to the other to make sure that when we were running our transmissions, they would not and vice versa. Everyone that we talked with in the labs always seem agreeable to these circumstances.

Our original primary goal was to get the photosensors working and have the wireless drawing occur via the use of a mouse-like device; however, it took us far too much time to try to figure out how an optical photosensor worked. We searched every hardware site that we could find and asked the TA's and the Professor if they knew of a schematic on the device, but we could not find one. Since we had no schematic on this optical photosensor (it was a part laying around in the lab), by the time we got the photosensor running properly, we still needed to get the optical encoder and directional movements working. We truly wanted to make a wireless mouse - one that looked like a mouse, and not a keypad, for this drawing device. we believed that we could feasibly do so. However, the time constraints just got us.

 We had no working drawing device with about a week left, so we ported over to getting a wireless drawing keypad to work first, and then get back to trying to get the optical photosensors working if there was still time remaining. So, we ended up having only a wireless keypad drawing device.

Throughout the lab sessions and extra hour sessions, the TA's, especially Sean and Chris, and the Professor were exceptionally helpful. There were times when some minute thing would just not work or times when we were trying to figure out a best design for our circuits, and we would be stuck trying to debug a tiny bug in our circuit or our program. It did not matter which of those three that we would ask, but each would always be quite able to help us.



Schematic for the keypad side:
Schematic for the TV side:






Parts
       
           
    State Diagrams
    • State diagram for button push:
    • State diagram for keypad:

    CODE: click to download

    0 comments:

    Post a Comment

    Share your knowledge

    Related Posts Plugin for WordPress, Blogger...

    Popular Projects

    program for Dual DAC 8051 Microcontroller Based DC Motor Control A Microcontroller Based Turbidity Meter A m -Controller Based Thermostat ASCII to BCD conversion in 8051 AT90LS8515 Digital Message Machine Audio Frequency Response Analyzer Audio Homing Robot Automated Juice Mixer Automated Pet Feeder Autonomous Car Autonomous Parallel Parking RC Car Autonomous Search Robot Autonomous Tank Autonomous Vehicle Contrast Following Rover Autonomous navigating robot BCD number to ASCII in 8051 Balance Bot Blind Bot Blood Pressure Monitor Bloodshed Dev-C++ 5 Compiler/IDE Breath Alcohol Tester Converters on TI MSP430 CrossStudio MSP430 IDE Design of a Real-Time Digital Guitar Tuner Digital Oscilloscope Digital Stethoscope Digital clock project using PIC16C54A microcontroller Digital thermometer ECG monitoring system GPS Data Logger with Wireless Trigger Handwriting Recognition Systm Home Security System Home energy managment IAR Embedded Workbench IDE INFRARED TRACKING SYSTEM IntelliBOT Laser Communications System Line following van MSP-EXP430FG4618 Development Tool and the eZ430 kits MSP430FG4618 device implement a Buzzer tone generator MSP430FG4618 device implement a Real Time Clock MSP430FG4618 device implement a voltage ramp generator MSP430FG4618 device present a message on the LCD Basic Microcontroller(8051) Lab Mivo- RFID based mobile payment system Multi-Zone Fire Alarm System PC based temperature control PIC 16f877 RPM Meter PIC16C54 dual dice electronic project circuit PIC16F84A digital thermometer microcontroller project PIC16F886 horn driver PWM motor contoller with MSP430 Program Block data transfer in 8051 Program to add two BCD numbers in 8051 Program to check whether a 4th bit of a byte is 1 Program to convert ASCII to hex in 8051 Program to count from 0-9 in 8051 Program to count number of 1's in a given data byte in 8051 Program to divide an 8 bit no by another 8 bit number in 8051 Program to find largest of n numbers in 8051 Program to find the LCM of two numbers in 8051 Program to find the square of an 8 bit number in 8051 Program to generate 50msec delay in 8051 Program to implement BCD counter to count from 0-99 in 8051 Program to implement BCD counter to count from 99-0 in 8051 Program to interchange two blocks of data in 8051 Program to multiply 16 bit number by 8 bit number in 8051 Program to search an element in an array in 8051 Program to sort an array of 10 elements in 8051 Programming the ez430 Proximity Security System RAMP wave in 8051 RC Car Controller RObo Dog Radio-controlled Truck Retina color tracker Robotic Arm Controller with GUI Robotic Car Traction Control Safety-sensor vehicle Security Entrance System Self-Powered Solar Data Logger Snake Arm Ultrasonic Positioning Control System Store FFh if 1 Super Train Controller TI MSP430 Microcontrollers Timers on the MSP430 TouchPad Drawing Board Ultra-Sonic Parking Assistant Ultrasonic Parking Controller Ultrasonic Range finder Voice Activated Alarm Clock Voice Recognition Robotic Car Voting Machine Weather Station Web-Monitored Thermostat Wireless Drawing Device Wireless Telemetry Wireless message Communicator Write a C program to display the code of the key pressed in 8051 Zigbee Wireless Relay Control and Power Monitoring System add two multibyte numbers in 8051 convert a decimal number to hex number in 8051 convert an 8bit Hex number to decimal number in 8051 convert hex number to ASCII number in 8051 eZ430-F2013 Development Tool use SD16_A ADC eZ430-RF2500 Development Tool use ADC10 else store 00 in the same location in 8051 find the GCF of two numbers in 8051 find the average of 10 numbers in 8051 generate Fibonacci series in 8051 metal detector project microcontroller using IAR Embedded Workbench program for Elevator Interface in 8051 program for Stepper motor interface in 8051 spectrum analyser square wave in 8051 triangle wave in 8051 voice recognition security system

    Sites U missed

    Hint

    Open Pictures in new page by right click on it, if it is not shown full image.