Wireless Keyboard & Mouse Emulator

103
1.INTRODUCTION 1.1 Introduction It is an embedded and cloud computing based project. The main aim of the project is to controlling the functionality of PC peripherals such as mouse, keyboard and media (volume) wirelessly by using ARM microcontroller based hardware emulator. ARM microprocessors are used in embedded devices as well as portable devices like PDAs and some phones. The software ARM emulators listed on this page allow you to run an emulated ARM device on your main computer system, be it Windows, Linux or some other operating system. This allows you to develop and test software using your desktop, and only move the software to a real device when it is more complete. Cloud computing provides computation, software applications, data access, data management and storage resources without requiring cloud users to know the location and other details of the computing infrastructure. In this project, the USBMouse interface is used to emulate a mouse over the USB port, where we can choose relative or absolute co-ordinates, and send clicks, button state and the USBKeyboard interface is used to emulate a keyboard over the USB port, where we can type strings and send keycodes, send keys with modifiers (e.g. CTRL + 's'), function keys and also the media control keys. 1

Transcript of Wireless Keyboard & Mouse Emulator

Page 1: Wireless Keyboard & Mouse Emulator

1. INTRODUCTION

1.1 Introduction

It is an embedded and cloud computing based project. The main aim

of the project is to controlling the functionality of PC peripherals such as

mouse, keyboard and media (volume) wirelessly by using ARM

microcontroller based hardware emulator.

ARM microprocessors are used in embedded devices as well as

portable devices like PDAs and some phones. The software ARM emulators

listed on this page allow you to run an emulated ARM device on your main

computer system, be it Windows, Linux or some other operating system. This

allows you to develop and test software using your desktop, and only move

the software to a real device when it is more complete.

Cloud computing provides computation, software applications, data access,

data management and storage resources without requiring cloud users to

know the location and other details of the computing infrastructure.

In this project, the USBMouse interface is used to emulate a mouse

over the USB port, where we can choose relative or absolute co-ordinates,

and send clicks, button state and the USBKeyboard interface is used to

emulate a keyboard over the USB port, where we can type strings and send

keycodes, send keys with modifiers (e.g. CTRL + 's'), function keys and also

the media control keys.

1

Page 2: Wireless Keyboard & Mouse Emulator

2. EMBEDDED SYSTEMS

2.1 Introductions to embedded systems

An embedded system is a computer system designed for specific

control functions within a larger system, often with real-time computing

constraints. It is embedded as part of a complete device often including

hardware and mechanical parts. By contrast, a general-purpose computer,

such as a personal computer (PC), is designed to be flexible and to meet a

wide range of end-user needs. Embedded systems control many devices in

common use today.

Embedded systems contain processing cores that are typically either

microcontrollers or digital signal processors (DSP). The key characteristic,

however, is being dedicated to handle a particular task. Since the embedded

system is dedicated to specific tasks, design engineers can optimize it to

reduce the size and cost of the product and increase the reliability and

performance. Some embedded systems are mass-produced, benefiting from

economies of scale.

Physically, embedded systems range from portable devices such as

digital watches and MP3 players, to large stationary installations like traffic,

factory controllers, or the systems controlling nuclear power plants.

Complexity varies from low, with a single microcontroller chip, to very high

with multiple units, peripherals and networks mounted inside a large chassis

or enclosure.

2.2 History

One of the first recognizably modern embedded systems was the

Apollo Guidance Computer, developed by Charles Stark Draper at the MIT

Instrumentation Laboratory. At the project's inception, the Apollo guidance

computer was considered the riskiest item in the Apollo project as it

2

Page 3: Wireless Keyboard & Mouse Emulator

employed the then newly developed monolithic integrated circuits to reduce

the size and weight. An early mass-produced embedded system was the

Autonetics D-17 guidance computer for the Minuteman missile, released in

1961. It was built from transistor logic and had a hard disk for main memory.

When the Minuteman II went into production in 1966, the D-17 was replaced

with a new computer that was the first high-volume use of integrated

circuits. This program alone reduced prices on quad nand gate ICs from

$1000/each to $3/each, permitting their use in commercial products.

2.3 Characteristics

Embedded systems are designed to do some specific task, rather than

be a general-purpose computer for multiple tasks. Some also have real-

time performance constraints that must be met, for reasons such as safety

and usability; others may have low or no performance requirements,

allowing the system hardware to be simplified to reduce costs.

Embedded systems are not always standalone devices. Many

embedded systems consist of small, computerized parts within a larger

device that serves a more general purpose. For example, the Gibson Robot

Guitar features an embedded system for tuning the strings, but the overall

purpose of the Robot Guitar is, of course, to play music. Similarly, an

embedded system in an automobile provides a specific function as a

subsystem of the car itself.

The program instructions written for embedded systems are referred to

as firmware, and are stored in read-only memory or Flash memory chips.

They run with limited computer hardware resources: little memory, small or

non-existent keyboard or screen.

2.4 User interface

Embedded systems range from no user interface at all — dedicated

only to one task — to complex graphical user interfaces that resemble

modern computer desktop operating systems. Simple embedded devices use

3

Page 4: Wireless Keyboard & Mouse Emulator

buttons, LEDs, graphic or character LCDs (for example popular HD44780

LCD) with a simple menu system.

More sophisticated devices which use a graphical screen with touch

sensing or screen-edge buttons provide flexibility while minimizing space

used: the meaning of the buttons can change with the screen, and selection

involves the natural behavior of pointing at what's desired. Handheld

systems often have a screen with a "joystick button" for a pointing device.

Some systems provide user interface remotely with the help of a serial

(e.g. RS-232, USB, I²C, etc.) or network (e.g. Ethernet) connection. This

approach gives several advantages: extends the capabilities of embedded

system, avoids the cost of a display, simplifies BSP, allows us to build rich

user interface on the PC. A good example of this is the combination of an

embedded web server running on an embedded device (such as an IP

camera) or a network routers. The user interface is displayed in a web

browser on a PC connected to the device, therefore needing no bespoke

software to be installed.

2.5 Peripherals

Embedded Systems talk with the outside world via peripherals, such as:

Serial Communication Interfaces (SCI): RS-232, RS-422, RS-485 etc.

Synchronous Serial Communication Interface: I2C, SPI, SSC and ESSI

(Enhanced Synchronous Serial Interface)

Universal Serial Bus (USB)

Multi Media Cards (SD Cards, Compact Flash etc.)

Networks: Ethernet, Lon Works, etc.

Fieldbuses: CAN-Bus, LIN-Bus, PROFIBUS, etc.

Timers: PLL(s), Capture/Compare and Time Processing Units

Discrete IO: aka General Purpose Input/output (GPIO)

Analog to Digital/Digital to Analog (ADC/DAC)

Debugging: JTAG, ISP, ICSP, BDM Port, BITP, and DP9 ports.

4

Page 5: Wireless Keyboard & Mouse Emulator

2.6 Debugging

Embedded debugging may be performed at different levels, depending

on the facilities available. From simplest to most sophisticate they can be

roughly grouped into the following areas:

Interactive resident debugging, using the simple shell provided by the

embedded operating system (e.g. Forth and Basic)

External debugging using logging or serial port output to trace

operation using either a monitor in flash or using a debug server like

the Remedy Debugger which even works for hetero generous multicore

systems.

An in-circuit debugger (ICD), a hardware device that connects to the

microprocessor via a JTAG or Nexus interface. This allows the operation

of the microprocessor to be controlled externally, but is typically

restricted to specific debugging capabilities in the processor.

An in-circuit emulator (ICE) replaces the microprocessor with a

simulated equivalent, providing full control over all aspects of the

microprocessor.

A complete emulator provides a simulation of all aspects of the

hardware, allowing all of it to be controlled and modified and allowing

debugging on a normal PC.

Unless restricted to external debugging, the programmer can typically

load and run software through the tools, view the code running in the

processor, and start or stop its operation. The view of the code may be as

HLL source-code, assembly code or mixture of both.

Because an embedded system is often composed of a wide variety of

elements, the debugging strategy may vary. For instance, debugging a

5

Page 6: Wireless Keyboard & Mouse Emulator

software- (and microprocessor-) centric embedded system is different from

debugging an embedded system where most of the processing is performed

by peripherals (DSP, FPGA, co-processor). An increasing number of

embedded systems today use more than one single processor core. A

common problem with multi-core development is the proper synchronization

of software execution. In such a case, the embedded system design may

wish to check the data traffic on the busses between the processor cores,

which requires very low-level debugging, at signal/bus level, with a logic

analyzer, for instance.

2.7 Reliability

Embedded systems often reside in machines that are expected to run

continuously for years without errors and in some cases recover by

themselves if an error occurs. Therefore the software is usually developed

and tested more carefully than that for personal computers, and unreliable

mechanical moving parts such as disk drives, switches or buttons are

avoided.

2.8 Applications of embedded system

We are living in the Embedded World. We are surrounded with many

embedded products and our daily life largely depends on the proper

functioning of these gadgets. Television, Radio, CD player of your living

room, Washing Machine or Microwave Oven in your kitchen, Card readers,

Access Controllers, Palm devices of our work space enable we to do many of

our tasks very effectively. Apart from all these, many controllers embedded

in our car take care of car operations between the bumpers and most of the

times we tend to ignore all these controllers.

In recent days, we are showered with variety of information about

these embedded controllers in many places. All kinds of magazines and

journals regularly dish out details about latest technologies, new devices;

fast applications which make we believe that our basic survival is controlled

6

Page 7: Wireless Keyboard & Mouse Emulator

by these embedded products. Now you can agree to the fact that these

embedded products have successfully invaded into our world. We must be

wondering about these embedded controllers or systems. What is this

Embedded System?

The computer we use to compose your mails, or create a document or

analyze the database is known as the standard desktop computer. These

desktop computers are manufactured to serve many purposes and

applications.

We need to install the relevant software to get the required processing

facility. So, these desktop computers can do many things. In contrast,

embedded controllers carryout a specific work for which they are designed.

Most of the time, engineers design these embedded controllers with a

specific goal in mind. So these controllers cannot be used in any other place.

Theoretically, an embedded controller is a combination of a piece of

microprocessor based hardware and the suitable software to undertake a

specific task.

These days designer have choices in microprocessors/microcontrollers.

Especially, in 8 bit and 32 bit, the available variety really may overwhelm

even an experienced designer. Selecting a right microprocessor may turn out

as a most difficult first step and it is getting complicated as new devices

continue to pop-up very often.

In the 8 bit segment, the most popular and used architecture is Intel's

8031. Market acceptance of this particular family has driven many

semiconductor manufacturers to develop something new based on this

particular architecture. Even after 25 years of existence, semiconductor

manufacturers still come out with some kind of device using this 8031 core.

Military and aerospace software applications:

7

Page 8: Wireless Keyboard & Mouse Emulator

From in-orbit embedded systems to jumbo jets to vital battlefield

networks, designers of mission-critical aerospace and defense systems

requiring real-time performance, scalability, and high-availability facilities

consistently turn to the LynxOS® RTOS and the LynxOS-178 RTOS for

software certification to DO-178B.

Rich in system resources and networking services, LynxOS provides an

off-the-shelf software platform with hard real-time response backed by

powerful distributed computing (CORBA), high reliability, software

certification, and long-term support options.

The LynxOS-178 RTOS for software certification, based on the RTCA DO-

178B standard, assists developers in gaining certification for their mission-

and safety-critical systems. Real-time systems programmers get a boost with

LynuxWorks' DO-178B RTOS training courses.

LynxOS-178 is the first DO-178B and EUROCAE/ED-12B certifiable,

POSIX®-compatible RTOS solution.

Communications applications:

"Five-nines" availability, CompactPCI hot swap support, and hard real-time

response—LynxOS delivers on these key requirements and more for today's

carrier-class systems. Scalable kernel configurations, distributed computing

capabilities, integrated communications stacks, and fault-management

facilities make LynxOS the ideal choice for companies looking for a single

operating system for all embedded telecommunications applications—from

complex central controllers to simple line/trunk cards.

LynuxWorks Jumpstart for Communications package enables OEMs to

rapidly develop mission-critical communications equipment, with pre-

integrated, state-of-the-art, data networking and porting software

components—including source code for easy customization.

8

Page 9: Wireless Keyboard & Mouse Emulator

The Lynx Certifiable Stack (LCS) is a secure TCP/IP protocol stack

designed especially for applications where standards certification is required.

Electronics applications and consumer devices:

As the number of powerful embedded processors in consumer devices

continues to rise, the BlueCat® Linux® operating system provides a highly

reliable and royalty-free option for systems designers.

And as the wireless appliance revolution rolls on, web-enabled

navigation systems, radios, personal communication devices, phones and

PDAs all benefit from the cost-effective dependability, proven stability and

full product life-cycle support opportunities associated with BlueCat

embedded Linux. BlueCat has teamed up with industry leaders to make it

easier to build Linux mobile phones with Java integration.

Makers of low-cost consumer electronic devices who wish to integrate the

LynxOS real-time operating system into their products, we offer special

MSRP-based pricing to reduce royalty fees to a negligible portion of the

device's MSRP.

Industrial automation and process control software:

Designers of industrial and process control systems know from experience

that LynuxWorks operating systems provide the security and reliability that

their industrial applications require.

From ISO 9001 certification to fault-tolerance, POSIX conformance, secure

partitioning and high availability.

9

Page 10: Wireless Keyboard & Mouse Emulator

3. EMBEDDED CLOUD COMPUTING

Embedded systems are on a trajectory that will see billions of

embedded devices in active use in diverse applications- many of which

include communications links between individual embedded devices. This

shift in communications will offer unexpected opportunities and

unanticipated risks. To benefit from the general increase in embedded

systems capabilities in a future interconnected-world, requires “broadcast”

mode communications to become a norm as opposed to peer-to-peer

communications. As these embedded appliances proliferate, they will be

applied in new ways to automotive, avionics/aerospace, industrial

automation (and robotics); telecommunications; consumer electronics and

intelligent homes; health and medical systems.

3.1 Concept of cloud computing

Cloud computing is Internet ("cloud") based development and use of

computer technology ("computing"). It is a style of computing in which

dynamically scalable and often virtualized resources are provided as a

service over the Internet. Users need not have knowledge of, expertise in, or

control over the technology infrastructure "in the cloud" that supports them.

The concept incorporates infrastructure as a service (IaaS), platform as

a service (PaaS) and software as a service (SaaS) as well as Web 2.0 and

other recent technology trends which have the common theme of reliance on

the Internet for satisfying the computing needs of the users. Examples of

SaaS vendors include Salesforce.com and Google Apps which provide

10

Page 11: Wireless Keyboard & Mouse Emulator

common business applications online that are accessed from a web browser,

while the software and data are stored on the servers.

The term cloud is used as a metaphor for the Internet, based on how

the Internet is depicted in computer network diagrams, and is an abstraction

for the complex infrastructure it conceals.

Fig3.1: Cloud computing over view

3.2 Implementation

The majority of cloud computing infrastructure as of 2009 consists of

reliable services delivered through data centers and built on servers with

different levels of virtualization technologies. The services are accessible

anywhere that has access to networking infrastructure. The Cloud appears as

a single point of access for all the computing needs of consumers.

Commercial offerings need to meet the quality of service requirements of

customers and typically offer service level agreements. Open standards are

11

Page 12: Wireless Keyboard & Mouse Emulator

critical to the growth of cloud computing and open source software has

provided the foundation for many cloud computing implementations.

3.3 Key characteristics

Cost is greatly reduced and capital expenditure is converted to

operational expenditure. This lowers barriers to entry, as infrastructure

is typically provided by a third-party and does not need to be

purchased for one-time or infrequent intensive computing tasks.

Pricing on a utility computing basis is fine-grained with usage-based

options and minimal or no IT skills are required for implementation.

Device and location independence enable users to access systems

using a web browser regardless of their location or what device they

are using, e.g., PC, mobile. As infrastructure is off-site (typically

provided by a third-party) and accessed via the Internet the users can

connect from anywhere.

Multi-tenancy enables sharing of resources and costs among a large

pool of users, allowing for:

o Centralization of infrastructure in areas with lower costs (such

as real estate, electricity, etc.)

o Peak-load capacity increases (users need not engineer for

highest possible load-levels)

o Utilization and efficiency improvements for systems that are

often only 10-20% utilized.

Reliability improves through the use of multiple redundant sites,

which makes it suitable for business continuity and disaster recovery.

Nonetheless, most major cloud computing services have suffered

outages and IT and business managers are able to do little when they

are affected.

Scalability via dynamic ("on-demand") provisioning of resources on a

fine-grained, self-service basis near real-time, without users having to

engineer for peak loads. Performance is monitored and consistent and

12

Page 13: Wireless Keyboard & Mouse Emulator

loosely-coupled architectures are constructed using web services as

the system interface.

Security typically improves due to centralization of data, increased

security-focused resources, etc., but raises concerns about loss of

control over certain sensitive data. Security is often as good as or

better than traditional systems, in part because providers are able to

devote resources to solving security issues that many customers

cannot afford. Providers typically log accesses, but accessing the audit

logs themselves can be difficult or impossible.

Sustainability comes about through improved resource utilization,

more efficient systems, and carbon neutrality. Nonetheless, computers

and associated infrastructure are major consumers of energy.

3.4 Components

Cloud computing Components

Applications Mbed, Facebook ,Google Apps, SalesForce , Microsoft Online

Client Browser(Chrome) ,Firefox ,Cloud, Mobile (Android ,iPhone), Netbook (EeePC ,MSI Wind) ,Nettop (Cherry Pal, Zonbu)

Infrastructure

BitTorrent, EC2, GoGrid, Sun Grid, 3tera

Platforms App Engine, Azure, Mosso, SalesForce

Services Alexa, FPS, MTurk, SQS

Storage S3, SimpleDB, SQL Services

Standards Ajax, Atom, HTML 5, REST

Table3.1: Components of cloud computing

13

Page 14: Wireless Keyboard & Mouse Emulator

Fig3.2: Stack of cloud computing resources

3.5 Types

Fig3.3: Types of cloud computing

14

Page 15: Wireless Keyboard & Mouse Emulator

Public cloud

Public cloud or external cloud describes cloud computing in the

traditional mainstream sense, whereby resources are dynamically

provisioned on a fine-grained, self-service basis over the Internet, via web

applications/web services, from an off-site third-party provider who shares

resources and bills on a fine-grained utility computing basis.

Private cloud

Private cloud and internal cloud are neologisms that some vendors

have recently used to describe offerings that emulate cloud computing on

private networks. These products claim to "deliver some benefits of cloud

computing without the pitfalls", capitalizing on data security, corporate

governance, and reliability concerns.

While an analyst predicted in 2008 that private cloud networks would

be the future of corporate IT, there is some uncertainty whether they are a

reality even within the same firm. Analysts also claim that within five years a

"huge percentage" of small and medium enterprises will get most of their

computing resources from external cloud computing providers as they "will

not have economies of scale to make it worth staying in the IT business" or

be able to afford private clouds.

The term has also been used in the logical rather than physical sense,

for example in reference to platform as service offerings, though such

offerings including Microsoft's Azure Services Platform are not available for

on-premises deployment.

Hybrid cloud

A hybrid cloud environment consisting of multiple internal and/or

external providers "will be typical for most enterprises".

15

Page 16: Wireless Keyboard & Mouse Emulator

3.6 SSV Embedded Cloud Computing

It expands the meaning of Cloud Computing into the embedded space.

Access to additional functions using the Internet protocols is made by using

an Application Programming Interface (API) directly from the embedded

software without requiring a browser. The initial services provided by SSV

include cloud services for data logging, firmware update, VPN-based remote

access and remote configuration. Long term monitoring and storage of

industrial control process data can be realized by using a cloud-based data

logging service. In this approach, the measurement data is forwarded to the

cloud service’s storage media by calling an API. Such systems may permit

usage of several Gigabyte of storage for persistent data. Depending on the

application architecture, the logged data sets may be shared between

multiple applications, possibly running on different embedded platforms.

Embedded cloud computing is in the early stages of development, but

for some of the same reasons that cloud computing is projected to become a

dominant piece of general purpose computing, the embedded adoption of

cloud computing concepts are likely to become dominant in some aspects of

embedded systems. Generally, embedded cloud computing will require an

Intel Architecture processor such as the Intel Atom or Intel Core processor

families with networking software for Cloud Computing. CloudStack and

OpenStack, or an embedded software package like SSV Embedded Cloud

Computing provides the essentials to use this new technology. Virtual

Machine technology is a critical part of the cloud computing technology

model. Early adoption of cloud computing for embedded systems may

require bridging between embedded OSes and Windows environments using

software such as TenAsys Intime for Windows. Another TenAsys product,

eVM for Windows embedded virtualization platform, provides a virtual

machine environment that hosts an embedded or real-time operating system

alongside Windows on the same multi-core processor platform. eVM

16

Page 17: Wireless Keyboard & Mouse Emulator

partitions the platform to ensure that critical hardware interfaces aren’t

virtualized, guaranteeing maximum performance and deterministic response

to real-time events.

Fig 3.4: Cloud architecture with end user interface

17

Page 18: Wireless Keyboard & Mouse Emulator

4. BLOCK DIAGRAM

4.1 Receiver Section

Fig4.1: Receiver section along with ARM processor

4.2 Transmitter section

18

Encoder Control Circuitry

Transmitter

Crystal Oscillator

Decoder Receiver

Power Supply

ARMProcessor

USBModule

Computer

Page 19: Wireless Keyboard & Mouse Emulator

Fig4.2: Transmitter module with control circuitry

5. OVER VIEW OF THE PROJECT

The project consists of a transmitter section and receiver section.

Transmitter section is a combination of control circuit, decoder HT12D and

battery supply. Receiver section contains ARM Cortex microcontroller,

encoderHT12E, USB interface with PC.

The receiver is connected to the computer through a serial or USB port.

The newer nano receivers were designed to be small enough to remain

connected in a laptop or notebook computer during transport, while still

being large enough to easily remove.

The transmitter module is on our hand which contains series of controlling

buttons which are designed to perform as mouse controls, keyboard and

media (volume) controls.

Mouse to move in relative or absolute co-ordinates, and send clicks,

button state.

Keyboard to type strings and send keycodes, send keys with modifiers

(e.g. CTRL + 's'), function keys.

The control commands from switches are decoded and ASK modulated signal

is sent to receiver.

The receiver antenna receives the decoded 8-bit data and sent it to

ARM processor on which the emulate program gets compiled and performs

the commands on the PC or Notebook such as mouse control or keyboard

control based on the device needed. The receiver module is supplied by

supply circuit and transmitter gets power supply from PC.

19

Page 20: Wireless Keyboard & Mouse Emulator

6. CIRCUIT DIAGRAM

6.1 Transmitter Module

Fig 6.2: Circuit diagram of Transmitter module

20

Page 21: Wireless Keyboard & Mouse Emulator

6.2 Receiver Module

Fig 6.2: Circuit diagram of Receiver module

21

Page 22: Wireless Keyboard & Mouse Emulator

7. HARDWARE DESCRIPTION

1. ARM Cortex processor

2. RF module

3. Encoder/Decoder

4. USB communications

5. Control circuitry

6. Power supply unit

7. Computer

7.1 ARM Cortex-M0 based Microcontroller

LPC11U2x is a 32-bit ARM Cortex-M0 microcontroller; up to 32 kB flash; up to

10 kB SRAM and 4 kB EEPROM; USB device; USART.

7.1.1 General description

The LPC11U2x are an ARM Cortex-M0 based, low-cost 32-bit MCU

family, designed for 8/16-bit microcontroller applications, offering

performance, low power, simple instruction set and memory addressing

together with reduced code size compared to existing 8/16-bit architectures.

The LPC11U2x operate at CPU frequencies of up to 50 MHz. Equipped with a

highly flexible and configurable Full-Speed USB 2.0 device controller, the

LPC11U2x brings unparalleled design flexibility and seamless integration to

today’s demanding connectivity solutions.

The peripheral complement of the LPC11U2x includes up to 32 kB of

flash memory, up to 10 kB of SRAM data memory and 4 kB EEPROM, one

Fast-mode Plus I2C-bus interface, one RS-485/EIA-485 USART with support

for synchronous mode and smart card interface, two SSP interfaces, four

22

Page 23: Wireless Keyboard & Mouse Emulator

general-purpose counter/timers, a 10-bit ADC (Analog-to-Digital Converter),

and up to 54 general-purpose I/O pins.

7.1.2 Features and benefits

System

ARM Cortex-M0 processor, running at frequencies of up to 50

MHz.

ARM Cortex-M0 built-in Nested Vectored Interrupt Controller

(NVIC).

Non-Maskable Interrupt (NMI) input selectable from several input

sources.

System tick timer.

Memory

Up to 32 kB on-chip flash program memory.

Up to 4 kB on-chip EEPROM data memory; byte erasable and

byte programmable.

Up to 10 kB SRAM data memory.

16 kB boot ROM.

In-System Programming (ISP) and In-Application Programming

(IAP) for flash and

EEPROM via on-chip bootloader software.

ROM-based USB drivers. Flash updates via USB supported.

ROM-based 32-bit integer division routines.

Debug options

Standard JTAG (Joint Test Action Group) test interface for BSDL

(Boundary Scan Description Language)

Serial Wire Debug

23

Page 24: Wireless Keyboard & Mouse Emulator

Digital peripherals

Up to 54 General-Purpose I/O (GPIO) pins with configurable pull-

up/pull-down

resistors, repeater mode, and open-drain mode.

Up to 8 GPIO pins can be selected as edge and level sensitive

interrupt sources.

Two GPIO grouped interrupt modules enable an interrupt based

on a programmable pattern of input states of a group of GPIO

pins.

High-current source output driver (20 mA) on one pin.

High-current sink driver (20 mA) on true open-drain pins.

Four general-purpose counter/timers with a total of up to 5

capture inputs and 13 match outputs.

Programmable Windowed WatchDog Timer (WWDT) with a

dedicated, internal low-power WatchDog Oscillator (WDO).

Analog peripherals

10-bit ADC with input multiplexing among eight pins.

Serial interfaces:

USB 2.0

full-speed device controller.

USART (Universal Synchronous Asynchronous

Receiver/Transmitter) with fractional baud rate generation,

internal FIFO, a full modem control handshake interface, and

support for RS-485/9-bit mode and synchronous mode. USART

supports an asynchronous smart card interface (ISO 7816-3).

Two SSP (Synchronous Serial Port) controllers with FIFO and

multi-protocol capabilities.

24

Page 25: Wireless Keyboard & Mouse Emulator

I2C-bus interface supporting the full I2C-bus specification and

Fast-mode Plus with a data rate of up to 1 Mbit/s with multiple

address recognition and monitor mode.

Clock generation

Crystal Oscillator with an operating range of 1 MHz to 25 MHz

(system oscillator).12 MHz high-frequency Internal RC oscillator

(IRC) that can optionally be used as a system clock.

Internal low-power, low-frequency WatchDog Oscillator (WDO)

with programmable frequency output.

PLL allows CPU operation up to the maximum CPU rate with the

system oscillator or the IRC as clock sources.

A second, dedicated PLL is provided for USB.

Clock output function with divider that can reflect the crystal

oscillator, the main clock, the IRC, or the watchdog oscillator.

Power control

Integrated PMU (Power Management Unit) to minimize power

consumption during Sleep, Deep-sleep, Power-down, and Deep

power-down modes.

Power profiles residing in boot ROM provide optimized

performance and minimized power consumption for any given

application through one simple function call.

Four reduced power modes: Sleep, Deep-sleep, Power-down, and

Deep power-down.

Processor wake-up from Deep-sleep and Power-down modes via

reset, selectable GPIO pins, watchdog interrupt, or USB port

activity.

25

Page 26: Wireless Keyboard & Mouse Emulator

Processor wake-up from Deep power-down mode using one

special function pin.

Power-On Reset (POR).

Brownouts detect with four separate thresholds for interrupt and

forced reset.

Unique device serial number for identification.

Single 3.3 V power supply (1.8 V to 3.6 V).

7.1.3 PIN DIAGRAM

Fig 6.1: Pin diagram of ARM Cortex-M0 (LPC11Uxx)

7.1.4 PIN Description

RESET/PIO0_0

26

Page 27: Wireless Keyboard & Mouse Emulator

RESET — External reset input with 20 ns glitch filter. A LOW-going pulse as

short as 50 ns on this pin resets the device, causing I/O ports and peripherals

to take on their default states, and processor execution to begin at address

0. This pin also serves as the debug select input. LOW level selects the JTAG

boundary scan. HIGH level selects the ARM SWD debug mode.

PIO0_0 — General purpose digital input/output pin.

PIO0_1/CLKOUT/CT32B0_MAT2/USB_FTOGGLE

PIO0_1 — General purpose digital input/output pin. A LOW level on this pin during reset starts the ISP command handler or the USB device enumeration.

CLKOUT — Clock out pin.

CT32B0_MAT2 — Match output 2 for 32-bit timer 0.

USB_FTOGGLE — USB 1 ms Start-of-Frame signal.

PIO0_2/SSEL0/CT16B0_CAP0

PIO0_2 — General purpose digital input/output pin.

SSEL0 — Slave select for SSP0.

CT16B0_CAP0 — Capture input 0 for 16-bit timer 0.

PIO0_3/USB_VBUS

PIO0_3 — General purpose digital input/output pin. A LOW level on this pin

during reset starts the ISP command handler. A HIGH level during reset

starts the USB device enumeration.

USB_VBUS — Monitors the presence of USB bus power.

PIO0_4/SCL

PIO0_4 — General purpose digital input/output pin (open-drain).

SCL — I2C-bus clock input/output (open-drain). High-current sink only if I2C

Fast-mode Plus is selected in the I/O configuration register.

PIO0_5/SDA

PIO0_5 — General purpose digital input/output pin (open-drain).

27

Page 28: Wireless Keyboard & Mouse Emulator

SDA — I2C-bus data input/output (open-drain). High-current sink only if I2C

Fast-mode Plus is selected in the I/O configuration register.

PIO0_6/USB_CONNECT/SCK0

PIO0_6 — General purpose digital input/output pin.

USB_CONNECT — Signal used to switch an external1.5 kΩ resistor under

software control. Used with the SoftConnect USB feature.

SCK0 — Serial clock for SSP0.

PIO0_7/CTS

PIO0_7 — General purpose digital input/output pin

CTS — Clear To Send input for USART.

PIO0_8/MISO0/CT16B0_MAT0

PIO0_8 — General purpose digital input/output pin.

MISO0 — Master In Slave out for SSP0.

CT16B0_MAT0 — Match output 0 for 16-bit timer 0.

PIO0_9/MOSI0/CT16B0_MAT1

PIO0_9 — General purpose digital input/output pin.

MOSI0 — Master Out Slave in for SSP0.

CT16B0_MAT1 — Match output 1 for 16-bit timer 0.

SWCLK/PIO0_10/SCK0/CT16B0_MAT2

SWCLK — Serial wire clock and test clock TCK for JTAG interface.

PIO0_10 — General purpose digital input/output pin.

SCK0 — Serial clock for SSP0.

28

Page 29: Wireless Keyboard & Mouse Emulator

CT16B0_MAT2 — Match output 2 for 16-bit timer 0.

TDI/PIO0_11/AD0/CT32B0_MAT3

TDI — Test Data In for JTAG interface.

PIO0_11 — General purpose digital input/output pin.

AD0 — A/D converter, input 0.

CT32B0_MAT3 — Match output 3 for 32-bit timer 0.

TMS/PIO0_12/AD1/CT32B1_CAP0

TMS — Test Mode Select for JTAG interface.

PIO_12 — General purpose digital input/output pin.

AD1 — A/D converter, input 1.

CT32B1_CAP0 — Capture input 0 for 32-bit timer 1.

TDO/PIO0_13/AD2/CT32B1_MAT0

TDO — Test Data Out for JTAG interface.

PIO0_13 — General purpose digital input/output pin.

AD2 — A/D converter, input 2.

O CT32B1_MAT0 — Match output 0 for 32-bit timer 1.

TRST/PIO0_14/AD3/CT32B1_MAT1

TRST — Test Reset for JTAG interface.

PIO0_14 — General purpose digital input/output pin.

AD3 — A/D converter, input 3.

CT32B1_MAT1 — Match output 1 for 32-bit timer 1.

SWDIO/PIO0_15/AD4/CT32B1_MAT2

SWDIO — Serial wire debug input/output.

PIO0_15 — General purpose digital input/output pin.

AD4 — A/D converter, input 4.

29

Page 30: Wireless Keyboard & Mouse Emulator

CT32B1_MAT2 — Match output 2 for 32-bit timer 1.

PIO0_16/AD5/CT32B1_MAT3/WAKEUP

PIO0_16 — General purpose digital input/output pin.

AD5 — A/D converter, input 5.

CT32B1_MAT3 — Match output 3 for 32-bit timer 1.

WAKEUP — Deep power-down mode wake-up pin with 20 ns glitch filter. Pull

this pin HIGH externally to enter Deep power-down mode. Pull this pin LOW

to exit Deep power-down mode. A LOW-going pulse as short as 50 ns wakes

up the part.

PIO0_17/RTS/CT32B0_CAP0/SCLK

PIO0_17 — General purpose digital input/output pin.

RTS — Request To Send output for USART.

CT32B0_CAP0 — Capture input 0 for 32-bit timer 0.

SCLK — Serial clock input/output for USART in synchronous mode.

PIO0_18/ CT32B0_MAT0

PIO0_18— General purpose digital input/output pin.

RXD — Receiver input for USART. Used in UART ISPmode.

CT32B0_MAT0 — Match output 0 for 32-bit timer 0.

PIO0_19/TXD/CT32B0_MAT1

PIO0_19 — General purpose digital input/output pin.

TXD — Transmitter output for USART. Used in UARTISP mode.

CT32B0_MAT1 — Match output 1 for 32-bit timer 0.

PIO0_20/CT16B1_CAP0

PIO0_20 — General purpose digital input/output pin.

CT16B1_CAP0 — Capture input 0 for 16-bit timer 1.

PIO0_21/CT16B1_MAT0/MOSI1

30

Page 31: Wireless Keyboard & Mouse Emulator

PIO0_21 — General purpose digital input/output pin.

CT16B1_MAT0 — Match output 0 for 16-bit timer 1.

MOSI1 — Master Out Slave In for SSP1.

PIO0_22/AD6/CT16B1_MAT1/MISO1

PIO0_22 — General purpose digital input/output pin.

AD6 — A/D converter, input 6.

CT16B1_MAT1 — Match output 1 for 16-bit timer 1.

MISO1 — Master In Slave out for SSP1.

PIO0_23/AD7

PIO0_23 — General purpose digital input/output pin.

AD7 — A/D converter, input 7.

PIO0_23/AD7

PIO0_23 — General purpose digital input/output pin.

AD7 — A/D converter, input 7.

PIO1_0/CT32B1_MAT0 to PIO1_3/CT32B1_MAT3

General purpose digital input/output pin.

CT32B1_MATx — Match output 3 for 32-bit timer 1.

PIO1_4/CT32B1_CAP0 to CAP1

General purpose digital input/output pin.CT32B1_CAPx — Capture input 1 for 32-bit timer 1.

PIO1_6 to PIO1_12

General purpose digital input/output pin.

PIO1_14/DSR/CT16B0_MAT1/RXD

PIO1_14 — General purpose digital input/output pin.

DSR — Data Set Ready input for USART.

31

Page 32: Wireless Keyboard & Mouse Emulator

CT16B0_MAT1 — Match output 1 for 16-bit timer 0.

RXD — Receiver input for USART.

PIO1_15/DCD/CT16B0_MAT2/SCK1

PIO1_15 — General purpose digital input/output pin.

DCD — Data Carrier Detect input for USART.

CT16B0_MAT2 — Match output 2 for 16-bit timer 0.

SCK1 — Serial clock for SSP1.

PIO1_16/RI/CT16B0_CAP0

PIO1_16 — General purpose digital input/output pin.

RI — Ring Indicator input for USART.

CT16B0_CAP0 — Capture input 0 for 16-bit timer 0.

PIO1_17/CT16B0_CAP1/RXDPIO1_17 — General purpose digital input/output pin.

CT16B0_CAP1 — Capture input 1 for 16-bit timer 0.

RXD — Receiver input for USART.

PIO1_18/CT16B1_CAP1/TXD

PIO1_18 — General purpose digital input/output pin.

CT16B1_CAP1 — Capture input 1 for 16-bit timer 1.

TXD — Transmitter output for USART.

PIO1_19/DTR/SSEL1

PIO1_19 — General purpose digital input/output pin.

DTR — Data Terminal Ready output for USART.

SSEL1 — Slave select for SSP1.

PIO1_20/DSR/SCK1PIO1_20 — General purpose digital input/output pin.

DSR — Data Set Ready input for USART.

32

Page 33: Wireless Keyboard & Mouse Emulator

SCK1 — Serial clock for SSP1.

PIO1_21/DCD/MISO1

PIO1_21 — General purpose digital input/output pin.

DCD — Data Carrier Detect input for USART.

MISO1 — Master In Slave out for SSP1.

PIO1_22/RI/MOSI1

PIO1_22 — General purpose digital input/output pin.

RI — Ring Indicator input for USART.

MOSI1 — Master Out Slave In for SSP1.

PIO1_23/CT16B1_MAT1 to PIO1_27/CT32B0_MAT3

General purpose digital input/output pin.

Match output 1 for 32-bit timer 0.

PIO1_28/CT32B0CAP0/SCLK

PIO1_28 — General purpose digital input/output pin.

CT32B0_CAP0 — Capture input 0 for 32-bit timer 0.

SCLK — Serial clock input/output for USART in synchronous mode

PIO1_29/SCK0/CT32B0_CAP1

PIO1_29 — General purpose digital input/output pin.

SCK0 — Serial clock for SSP0.

CT32B0_CAP1 — Capture input 1 for 32-bit timer 0.

PIO1_31 — General purpose digital input/output pin.

USB_DM — USB bidirectional D-line.

USB_DP — USB bidirectional D+ line.

XTALIN Input to the oscillator circuit and internal clock generator circuits. Input voltage must not exceed1.8 V.

XTALOUT Output from the oscillator amplifier.

VDD Supply voltage to the internal regulator, the external rail, and the ADC. Also used as the ADC reference voltage.

33

Page 34: Wireless Keyboard & Mouse Emulator

VSS - Ground.

7.1.5 BLOCK DIAGRAM & DESCRIPTION

Fig7.1: Block diagram of ARM Cortex-M0 micro controller

34

Page 35: Wireless Keyboard & Mouse Emulator

7.1.6 USB interface

The Universal Serial Bus (USB) is a 4-wire bus that supports

communication between a host and one or more (up to 127) peripherals. The

host controller allocates the USB bandwidth to attached devices through a

token-based protocol. The bus supports hot-plugging and dynamic

configuration of the devices. The host controller initiates all transactions. The

LPC11U2x USB interface consists of a full-speed device controller with on-

chip PHY (Physical layer) for device functions.

7.1.7 Emulation and debugging

Debug functions are integrated into the ARM Cortex-M0. Serial wire

debug functions are supported in addition to a standard JTAG boundary scan.

The ARM Cortex-M0 is configured to support up to four breakpoints and two

watch points. The RESET pin selects between the JTAG boundary scan

(RESET = LOW) and the ARM SWD debug (RESET = HIGH). The ARM SWD

debug port is disabled while the LPC11U2x is in reset.

To perform boundary scan testing, follow these steps:

1. Erase any user code residing in flash.

2. Power up the part with the RESET pin pulled HIGH externally.

3. Wait for at least 250 µs.

4. Pull the RESET pin LOW externally.

5. Perform boundary scan operations.

6. Once the boundary scan operations are completed, assert the TRST

pin to enable the SWD debug mode, and release the RESET pin (pull

HIGH)

7.1.8 Applications

Consumer peripherals

Handheld scanners

Medical

USB audio devices

35

Page 36: Wireless Keyboard & Mouse Emulator

Industrial control

7.2 RF MODULE

The Parallax 433.92 MHz RF Transmitter allows users to easily send

serial data, robot control, or other information wirelessly. When paired with

the matched RF Receiver, reliable wireless communication is as effortless as

sending serial data. The power-down (PDN) pin may be used to place the

module into a low power state (active low), or left floating (it is tied high

internally).

There are three Wireless RF Modules, Transmitter, Receiver and a

Transceiver. These RF Modules are designed to serve as a tool for electronic

design engineers, developers, hobbyists and students to perform wireless

experiments. These modules make it easy for any NON RF Experienced

developer to add Wireless RF Remote Control to their project. NO RF

Knowledge required. The RF Modules are in a PCB (Printed Circuit Board)

form with a 17 Pin 0.1 Inch spacing header that fits directly into most all

prototyping boards. They are easy to use boards that include encoders,

decoders, addressing, RF data processing and even the antenna, in a simple

fully range tested board, that is ready to plug right into your project. Just

apply +5VDC, ground, and the communication pins you require and enjoy

hassle free wireless communications.

7.2.1 Features

High-speed data transfer rates (1200 ~ 19.2k Baud depending on

controller used)

SIP header allows for ease of use with breadboards

Compatible with all BASIC Stamp® modules (including BS1 and Javelin

Stamp) and SX chips

As easy to use as simple SEROUT/SERIN PBASIC instructions Power-

down mode for conservative energy usage (longer battery life)

Line-of-sight range of 500 feet (or greater depending on conditions)

36

Page 37: Wireless Keyboard & Mouse Emulator

7.2.2 Applications

Remote Controlled Boe-Bot® robot

Wireless data acquisition

Remote sensors and triggers

7.2.3 Theory of Operation

Short for Radio Frequency, RF refers to the frequencies that fall within

the electromagnetic spectrum associated with radio wave propagation. When

applied to an antenna, RF current creates electromagnetic fields that

propagate the applied signal through space. Any RF field has a wavelength

that is inversely proportional to the frequency. This means that the

frequency of an RF signal is inversely proportional to the wavelength of the

field. The Parallax RF modules utilize a frequency of 433.92 MHz, this works

out to be a wavelength of approximately 0.69 meters (2.26 feet, or 7.3e-17

light-years). 433.92 MHz falls into the Ultra High Frequency (UHF)

designation, which is defined as the frequencies from 300 MHz ~ 3 GHz. UHF

has free-space wavelengths of 1 m ~ 100 mm (3.28 ~ 0.33 feet or 1.05e-16

~ 1.05e-17 light-years).

The TWS-434 and RWS-434 are extremely small, and are excellent for

applications requiring short-range RF remote controls. The transmitter

module is only 1/3 the size of a standard postage stamp, and can easily be

placed inside a small plastic enclosure.

TWS-434

The transmitter output is up to 8mW at 433.92MHz with a range of

approximately 400 foot (open area) outdoors. Indoors, the range is

approximately 200 foot, and will go through most walls.The TWS-434

transmitter accepts both linear and digital inputs can operate from 1.5 to 12

Volts-DC, and makes building a miniature hand-held RF transmitter very

37

Page 38: Wireless Keyboard & Mouse Emulator

easy. The TWS-434 is approximately 1/3 the size of a standard postage

stamp.

7.2.4 Pin Functionality

Fig7.1: RF Transmitter TWS 434 Pin Diagram

Transmitter supply current:

At logic High input: 5.1mA

At logic Low input: 1.8mA

Low power mode(PDN): 5µA

7.2.5 Specifications

38

Page 39: Wireless Keyboard & Mouse Emulator

Table 7.1: Specifications of RF Transmitter

7.2.6 RWS 434 RF Receiver

The receiver also operates at 433.92MHz, and has a sensitivity of 3uV.

The RWS-434 receiver operates from 4.5 to 5.5 volts-DC, and has both linear

and digital outputs.

39

Page 40: Wireless Keyboard & Mouse Emulator

Fig 7.2 : RWS-434 Pin Diagram

Receiver Supply current:

During operation (High or Low): 5.2mA

Low power mode(PDN): 28AµA

7.2.7 Specifications

Table 7.2: specifications of RF receiver

PDN

Pulling the power down (PDN) line low will place the

transmitter/receiver into a low-current state. The module will not be able to

transmit/receive a signal in this state.

RSSI (receiver only)

Received Signal Strength Indicator. This line will supply an analog

voltage that is proportional to the strength of the received signal.

40

Page 41: Wireless Keyboard & Mouse Emulator

Calibration

When initiating communication between the RF modules, a sync pulse should

be sent to re-establish the radio connection between the modules. Sending

several characters can accomplish this, however sending a pulse (which

maintains a high state during the synchronization) is more efficient:

For BS1s the following code line sends an appropriate sync pulse:

PULSOUT 1, 300

For BS2s the following code line sends an appropriate sync pulse:

PULSOUT 8, 1200

For Javelin Stamp modules the following code line sends an appropriate

sync pulse: CPU.pulseOut(300, CPU.pin8);

(Note: this line assumes that I/O pin 8 is connected to the DATA line on the

transmitter)

7.2.9 Transmitter Section

At RF Transmitter Section, we have used four switches S1, S2, S3 and

S4 to give 4-bit parallel data (D0-D3). Since the switches are in active low

state (i.e. low signal is sent when the switch is pressed), we need to add

external pull-up resistors as shown, so as to provide a high signal by default.

A resistance as high as 1Mohm is required in between OSC1 and OSC2 pins.

The Transmitter Enable (TE, pin 14) pin is an active low pin. Thus, it is

permanently grounded, so as to enable the transistor always. The output

serial data DOUT is fed to the RF Transmitter Module directly.

7.2.10 Receiver Section

The circuit of the receiver is also quite simple. Capacitor C1 is used

between Vcc and GND for noise filtering. Apart from that, all the address pins

(A0-A7, pin 1-8) are grounded, just as in transmitter. This is to ensure that

the transmitted data is being received. Both the transmitter and the receiver

MUST have the same address pins configuration. Pin 17 (VT) is enabled

whenever the receiver receives any data. The serial data received by the RF

41

Page 42: Wireless Keyboard & Mouse Emulator

Receiver module is directly fed to pin 14 (DIN), which is then converted into

4-bit parallel data (D0-D3). A 33 kohm resistor is connected in between OSC1

and OSC2.

7.2.11 Antenna

An antenna must be chosen for signal transmission. Usually, a 20-30

cm wire serves best. It is sufficient to give a range of 80 meters in open

region. To improve the efficiency, you can also use a coiled wire (take a wire

and make it into a coil). It increases the signal strength.

7.3 Encoder/Decoder

The most popular serial encoder/decoder used is the HT12D-HT12E

pair. The pin configurations and the circuit implementation is given below.

7.3.1 HT12E Encoder

The HT12E Encoder ICs are series of CMOS LSIs for Remote Control

system applications. They are capable of Encoding 12 bit of information

which consists of N address bits and 12-N data bits. Each address/data input

is externally trinary programmable if bonded out.HT12E Pin.

Pin Diagram of HT12E

42

Page 43: Wireless Keyboard & Mouse Emulator

Figure 7.3: Pin Diagram of HT12E

Pin Description

43

Page 44: Wireless Keyboard & Mouse Emulator

Table 7.3: Pin Description of HT12E

Features

44

Page 45: Wireless Keyboard & Mouse Emulator

Operating voltage

2.4V~5V for the HT12A

2.4V~12V for the HT12E

Low power and high noise immunity CMOS technology

Low standby current: 0.1_A (typ.) at VDD=5V

HT12A with a 38kHz carrier for infrared transmission medium

Minimum transmission word

Four words for the HT12E

One word for the HT12A

Built-in oscillator needs only 5% resistor

Data code has positive polarity

Minimal external components

Pair with Holtek_s 212 series of decoders

18-pin DIP, 20-pin SOP package

Applications

Burglar alarm system

Smoke and fire alarm system

Garage door controllers

Car door controllers & Car alarm system

Security system

Cordless telephones

Other remote control systems

General Description

45

Page 46: Wireless Keyboard & Mouse Emulator

They are capable of encoding information which consists of N address

bits and 12_N data bits. Each address/data input can be set to one of the two

logic states. The programmed addresses/ data are transmitted together with

the header bits via an RF or an infrared transmission medium upon receipt of

a trigger signal. The capability to select a TE trigger on the HT12E or a DATA

trigger on the HT12E further enhances the application flexibility of the 212

series of encoders.

Fig 7.4: Block diagram for HT12E

7.3.2 HT12D DECODER

The HT12D Decoder ICs are series of CMOS LSIs for remote control

system applications. These ICs are paired with each other. For proper

operation a pair of encoder/decoder with the same number of address and

data format should be selected. The Decoder receive the serial address and

data from its corresponding decoder, transmitted by a carrier using an RF

transmission medium and gives output to the output pins after processing

the data.

Pin Diagram of HT12D

46

Page 47: Wireless Keyboard & Mouse Emulator

Figure 7.5: Pin Diagram of HT12D

Pin Description

Table 7.4: Pin Description of HT12D

Features

Operating voltage: 2.4V~12V

Low power and high noise immunity CMOS technology

Low standby current

47

Page 48: Wireless Keyboard & Mouse Emulator

Capable of decoding 12 bits of information

Binary address setting

Received codes are checked 3 times

Address/Data number combination

HT12D: 8 address bits and 4 data bits

Built-in oscillator needs only 5% resistor

Valid transmission indicator

Easy interface with an RF or an infrared transmission medium

Minimal external components

Pair with Holtek’s 212 series of encoders

Applications

Burglar Alarm, Smoke Alarm, Fire Alarm, Car Alarm, Security System

Garage Door and Car Door Controllers

Cordless telephone

Other Remote Control System

General Description

A pair of encoder/decoder with the same number of addresses and

data format should be chosen for proper operation. The decoders receive

serial addresses and data from a programmed 212 series of encoders that are

transmitted by a carrier using an RF or an IR transmission medium. They

compare the serial input data three times continuously with their local

addresses. If no error or unmatched codes are found, the input data codes

are decoded and then transferred to the output pins.

The VT pin also goes high to indicate a valid transmission. The 212

series of decoders are capable of decoding information that consists of N bits

of address and 12_N bits of data. Of this series, the HT12D is arranged to

provide 8 address bits and 4 data bits.

48

Page 49: Wireless Keyboard & Mouse Emulator

Fig 7.6: Block diagram for HT12D

7.4 USB communication

7.4.1 Universal Serial Bus

Universal Serial Bus (USB) is an industry standard developed in the

mid-1990s that defines the cables, connectors and communications

protocols used in a bus for connection, communication and power supply

between computers and electronic devices.

USB was designed to standardize the connection of computer

peripherals, such as keyboards, pointing devices, digital cameras,

printers, portable media players, disk drives and network

adapters to personal computers, both to communicate and to supply electric

power. It has become commonplace on other devices, such as smart

phones, PDAs and video game consoles.[2] USB has effectively replaced a

variety of earlier interfaces, such as serial and parallel ports, as well as

separate power chargers for portable devices.

7.4.2 System design

49

Page 50: Wireless Keyboard & Mouse Emulator

The design architecture of USB is asymmetrical in its topology,

consisting of a host, a multitude of downstream USB ports, and

multiple peripheral devices connected in a tiered-star topology.

Additional USB hubs may be included in the tiers, allowing branching into a

tree structure with up to five tier levels. A USB host may implement multiple

host controllers and each host controller may provide one or more USB ports.

Up to 127 devices, including hub devices if present, may be connected to a

single host controller.USB devices are linked in series through hubs. One hub

is known as the root hub which is built into the host controller.

A physical USB device may consist of several logical sub-devices that

are referred to as device functions. A single device may provide several

functions, for example, a webcam(video device function) with a built-in

microphone (audio device function). Such a device is called a compound

device in which each logical device is assigned a distinctive address by the

host and all logical devices are connected to a built-in hub to which the

physical USB wire is connected. A host assigns one and only one device

address to a function.

USB device communication is based on pipes (logical channels). A pipe

is a connection from the host controller to a logical entity, found on a device,

and named an endpoint. Because pipes correspond 1-to-1 to endpoints, the

terms are sometimes used interchangeably. A USB device can have up to 32

endpoints: 16 into the host controller and 16 out of the host controller. The

USB standard reserves one endpoint of each type, leaving a theoretical

maximum of 30 for normal use. USB devices seldom have this many

endpoints.

50

Page 51: Wireless Keyboard & Mouse Emulator

Fig 7.7: USB endpoints reside on the connected device

7.4.3 Type of data transfer

There are two types of pipes: stream and message pipes depending on the

type of data transfer.

Isochronous transfers: at some guaranteed data rate (often, but not

necessarily, as fast as possible) but with possible data loss (e.g., real time

audio or video).

Interrupt transfers: devices that need guaranteed quick responses

(bounded latency) (e.g., pointing devices and keyboards).

Bulk transfers: large sporadic transfers using all remaining available

bandwidth, but with no guarantees on bandwidth or latency (e.g., file

transfers).

Control transfers: typically used for short, simple commands to the

device, and a status response, for example, by the bus control pipe

number 0.

A stream pipe is a uni-directional pipe connected to a uni-directional

endpoint that transfers data using an isochronous, interrupt, or bulktransfer.

A message pipe is a bi-directional pipe connected to a bi-directional endpoint

that is exclusively used for control data flow. An endpoint is built into the

USB device by the manufacturer and therefore exists permanently. An

endpoint of a pipe is addressable with a tuple (device_address,

51

Page 52: Wireless Keyboard & Mouse Emulator

endpoint_number) as specified in a TOKEN packet that the host sends when

it wants to start a data transfer session. If the direction of the data transfer is

from the host to the endpoint, an OUT packet (a specialization of a TOKEN

packet) having the desired device address and endpoint number is sent by

the host. If the direction of the data transfer is from the device to the host,

the host sends an IN packet instead. If the destination endpoint is a uni-

directional endpoint whose manufacturer's designated direction does not

match the TOKEN packet (e.g., the manufacturer's designated direction is IN

while the TOKEN packet is an OUT packet), the TOKEN packet will be ignored.

Otherwise, it will be accepted and the data transaction can start. A bi-

directional endpoint, on the other hand, accepts both IN and OUT packets.

7.4.4 USB Interfacing

Endpoints are grouped into interfaces and each interface is associated

with a single device function. An exception to this is endpoint zero, which is

used for device configuration and which is not associated with any interface.

A single device function composed of independently controlled interfaces is

called a composite device. A composite device only has a single device

address because the host only assigns a device address to a function.

When a USB device is first connected to a USB host, the USB device

enumeration process is started. The enumeration starts by sending a reset

signal to the USB device. The data rate of the USB device is determined

during the reset signaling. After reset, the USB device's information is read

by the host and the device is assigned a unique 7-bit address. If the device is

supported by the host, the device drivers needed for communicating with the

device are loaded and the device is set to a configured state. If the USB host

is restarted, the enumeration process is repeated for all connected devices.

The host controller directs traffic flow to devices, so no USB device can

transfer any data on the bus without an explicit request from the host

controller. In USB 2.0, the host controller polls the bus for traffic, usually in

52

Page 53: Wireless Keyboard & Mouse Emulator

a round-robin fashion. The throughput of each USB port is determined by the

slower speed of either the USB port or the USB device connected to the port.

High-speed USB 2.0 hubs contain devices called transaction translators

that convert between high-speed USB 2.0 buses and full and low speed

buses. When a high-speed USB 2.0 hub is plugged into a high-speed USB

host or hub, it will operate in high-speed mode. The USB hub will then either

use one transaction translator per hub to create a full/low-speed bus that is

routed to all full and low speed devices on the hub, or will use one

transaction translator per port to create an isolated full/low-speed bus per

port on the hub.

7.4.5 Connector properties

The connectors specified by the USB committee were designed to

support a number of USB's underlying goals, and to reflect lessons learned

from the menagerie of connectors which have been used in the computer

industry. The connector mounted on the host or device is called

the receptacle, and the connector attached to the cable is called

the plug. In the case of an extension cable, the connector on one end is a

receptacle. The official USB specification documents periodically define the

term male to represent the plug, and female to represent the receptacle

USB 1.x/2.0 standard pin out

Pin NameCable color

Description

1 VBUS Red +5 V

2 D− White Data −

53

Page 54: Wireless Keyboard & Mouse Emulator

3 D+ Green Data +

4 GND Black Ground

Table7.5: USB 1.x/2.0 standard pins

USB 1.x/2.0 Mini/Micro pin out

Pin Name Cable color Description

1VBUS

Red +5 V

2 D− White Data −

3 D+ Green Data +

4 ID NonePermits distinction of host connection from slave connection* host: connected to Signal ground* slave: not connected

5 GND Black Signal ground

Table 7.7: USB 1.x/2.0 pin description

The standard connectors were deliberately intended to enforce the

directed topology of a USB network: type A connectors on host devices that

supply power and type B connectors on target devices that receive power.

This prevents users from accidentally connecting two USB power supplies to

each other, which could lead to dangerously high currents, circuit failures, or

even fire. USB does not support cyclical networks and the standard

connectors from incompatible USB devices are themselves incompatible.

54

Page 55: Wireless Keyboard & Mouse Emulator

Unlike other communications systems (e.g. network cabling) gender

changers make little sense with USB and are almost never used

Fig 7.8: Standard type A plug and receptacle and USB extension cord

7.4.6 USB standard connectors

The USB 2.0 Standard-A type of USB plug is a flattened rectangle which

inserts into a "downstream-port" receptacle on the USB host, or a hub, and

carries both power and data. This plug is frequently seen on cables that are

permanently attached to a device, such as one connecting a keyboard or

mouse to the computer via usb connection.

USB connections eventually wear out as the connection loosens

through repeated plugging and unplugging. The lifetime of a USB-A male

connector is approximately 1,500 connect/disconnect cycles.

A Standard-B plug—which has a square shape with beveled exterior

corners—typically plugs into an "upstream receptacle" on a device that uses

a removable cable, e.g. a printer. A Type B plug delivers power in addition to

carrying data. On some devices, the Type B receptacle has no data

connections, being used solely for accepting power from the upstream

device. This two-connector-type scheme (A/B) prevents a user from

accidentally creating an electrical loop.

55

Page 56: Wireless Keyboard & Mouse Emulator

Fig 7.9: Pin configuration of the USB connectors Standard A/B

7.4.7 Signaling

USB supports the following signaling rates. The

terms speed and bandwidth are used interchangeably. "high-" is alternatively

written as "hi-".

A low-speed rate of 1.5 Mbit/s (~183 kB/s) is defined by USB 1.0. It is very

similar to full-bandwidth operation except each bit takes 8 times as long

to transmit. It is intended primarily to save cost in low-bandwidth human

interface devices (HID) such as keyboards, mice, and joysticks.

The full-speed rate of 12 Mbit/s (~1.43 MB/s) is the basic USB data rate

defined by USB 1.0. All USB hubs support full-bandwidth.

A high-speed (USB 2.0) rate of 480 Mbit/s (~57 MB/s) was introduced in

2001. All hi-speed devices are capable of falling back to full-bandwidth

operation if necessary; i.e., they are backward compatible with USB 1.1.

Connectors are identical for USB 2.0 and USB 1.x.

A Super Speed (USB 3.0) rate of 5.0 Gbit/s (~596 MB/s). The written USB

3.0 specification was released by Intel and partners in August 2008. The

first USB 3 controller chips were sampled by NEC May 2009 and products

using the 3.0 specification arrived beginning in January 2010. USB 3.0

connectors are generally backwards compatible, but include new wiring

and full duplex operation.

56

Page 57: Wireless Keyboard & Mouse Emulator

USB signals are transmitted on a twisted-pair data cable with

90Ω ±15% characteristic impedance,[64] labeled D+ and D−. Prior to USB 3.0,

these collectively use duplex differential to reduce the effects of

electromagnetic noise on longer lines. Transmitted signal levels are 0.0 to

0.3 volts for low and 2.8 to 3.6 volts for high in full-bandwidth and low-

bandwidth modes, and −10 to 10 mV for low and 360 to 440 mV for high in

hi-bandwidth mode. In FS mode, the cable wires are not terminated, but the

HS mode has termination of 45 Ω to ground, or 90 Ω differential to match the

data cable impedance, reducing interference due to signal reflections. USB

3.0 introduces two additional pairs of shielded twisted wire and new, mostly

interoperable contacts in USB 3.0 cables, for them. They permit the higher

data rate, and full duplex operation.

A USB connection is always between a host or hub at the "A" connector

end, and a device or hub's "upstream" port at the other end. Originally, this

was a "B' connector, preventing erroneous loop connections, but additional

upstream connectors were specified, and some cable vendors designed and

sold cables which permitted erroneous connections (and potential damage to

the circuitry). USB interconnections are not as fool-proof or as simple as

originally intended.

The host includes 15 kΩ pull-down resistors on each data line. When no

device is connected, this pulls both data lines low into the so-called "single-

ended zero" state (SE0 in the USB documentation), and indicates a reset or

disconnected connection.

A USB device pulls one of the data lines high with a 1.5 kΩ resistor.

This overpowers one of the pull-down resistors in the host and leaves the

data lines in an idle state called "J". For USB 1.x, the choice of data line

indicates a device's bandwidth support; full-bandwidth devices pull D+ high,

while low-bandwidth devices pull D− high.

57

Page 58: Wireless Keyboard & Mouse Emulator

Fig 7.10: Negative Acknowledge packet transmitted by USB 1.1

7.4.8 Transmission Rates

The theoretical maximum data rate in USB 2.0 is 480 Mbit/s (60 MB/s)

per controller and is shared amongst all attached devices. Some chipset

manufacturers overcome this bottleneck by providing multiple USB 2.0

controllers within the south bridge.

Typical hi-speed USB hard drives can be written to at rates around 25–

30 MB/s, and read from at rates of 30–42 MB/s, according to routine testing

done by CNet.[67] This is 70% of the total bandwidth available.

According to a USB-IF chairman, "at least 10 to 15 percent of the

stated peak 60 MB/s (480 Mbit/s) of Hi-Speed USB goes to overhead—the

communication protocol between the card and the peripheral. Overhead is a

component of all connectivity standards".[68] Tables illustrating the transfer

limits are shown in Chapter 5 of the USB spec.

For isochronous devices like audio streams, the bandwidth is constant,

and reserved exclusively for a given device. The bus bandwidth therefore

only has an effect on the number of channels that can be sent at a time, not

the "speed" or latency of the transmission

7.4.9 USB Communications

During USB communication data is transmitted as packets. Initially, all

packets are sent from the host, via the root hub and possibly more hubs, to

58

Page 59: Wireless Keyboard & Mouse Emulator

devices. Some of those packets direct a device to send some packets in

reply.

After the sync field, all packets are made of 8-bit bytes, transmitted least-

significant bit first. The first byte is a packet identifier (PID) byte. The PID is

actually 4 bits; the byte consists of the 4-bit PID followed by its bitwise

complement. This redundancy helps detect errors. (Note also that a PID byte

contains at most four consecutive 1 bits, and thus will never need bit-

stuffing, even when combined with the final 1 bit in the sync byte. However,

trailing 1 bits in the PID may require bit-stuffing within the first few bits of

the payload.)

USB PID bytes

Type

PID value(msb-first)

Transmitted byte

(lsb-first)Name Description

Reserved 0000 0000 1111

Token

1000 0001 1110 SPLITHigh-bandwidth (USB 2.0) split transaction

0100 0010 1101 PINGCheck if endpoint can accept data (USB 2.0)

Special

1100 0011 1100

PRE Low-bandwidth USB preamble

Handshake

ERR Split transaction error (USB 2.0)

0010 0100 1011 ACK Data packet accepted

59

Page 60: Wireless Keyboard & Mouse Emulator

1010 0101 1010 NAKData packet not accepted; please retransmit

0110 0110 1001 NYET Data not ready yet (USB 2.0)

1110 0111 1000 STALLTransfer impossible; do error recovery

Token

0001 1000 0111 OUTAddress for host-to-device transfer

1001 1001 0110 INAddress for device-to-host transfer

0101 1010 0101 SOFStart of frame marker (sent each ms)

1101 1011 0100 SETUPAddress for host-to-device control transfer

Data 0011 1100 0011 DATA0 Even-numbered data packet

1011 1101 0010 DATA1 Odd-numbered data packet

0111 1110 0001 DATA2Data packet for high-bandwidth isochronous transfer (USB 2.0)

1111 1111 0000 MDAT Data packet for high-bandwidth

60

Page 61: Wireless Keyboard & Mouse Emulator

A isochronous transfer (USB 2.0)

Packets come in three basic types, each with a different format and

CRC (cyclic redundancy check):

Handshake packets

Handshake packets consist of a PID byte, and are generally sent in

response to data packets. The three basic types are ACK, indicating that data

was successfully received, NAK, indicating that the data cannot be received

and should be retried, and STALL, indicating that the device has an error

condition and will never be able to successfully transfer data until some

corrective action (such as device initialization) is performed.

USB 2.0 added two additional handshake packets, NYET which

indicates that a split transaction is not yet complete. A NYET packet is also

used to tell the host that the receiver has accepted a data packet, but

cannot accept any more due to buffers being full. The host will then send

PING packets and will continue with data packets once the device ACK's the

PING. The other packet added was the ERR handshake to indicate that a split

transaction failed.

The only handshake packet the USB host may generate is ACK; if it is

not ready to receive data, it should not instruct a device to send any.

Token packets

Token packets consist of a PID byte followed by 2 payload bytes: 11

bits of address and a 5-bit CRC. Tokens are only sent by the host,

never a device.

IN and OUT tokens contain a 7-bit device number and 4-bit function

number (for multifunction devices) and command the device to

transmit DATAx packets, or receive the following DATAx packets,

respectively.

61

Page 62: Wireless Keyboard & Mouse Emulator

An IN token expects a response from a device. The response may be a

NAK or STALL response, or a DATAx frame. In the latter case, the host

issues an ACK handshake if appropriate.

An OUT token is followed immediately by a DATAx frame. The device

responds with ACK, NAK, NYET, or STALL, as appropriate.

SETUP operates much like an OUT token, but is used for initial device

setup. It is followed by an 8-byte DATA0 frame with a standardized

format.

Every millisecond (12000 full-bandwidth bit times), the USB host transmits

a special SOF (start of frame) token, containing an 11-bit incrementing frame

number in place of a device address. This is used to synchronize isochronous

data flows. High-bandwidth USB 2.0 devices receive 7 additional duplicate

SOF tokens per frame, each introducing a 125 µs "microframe" (60000 high-

bandwidth bit times each).

USB 2.0 added a PING token, which asks a device if it is ready to receive

an OUT/DATA packet pair. The device responds with ACK, NAK, or STALL, as

appropriate. This avoids the need to send the DATA packet if the device

knows that it will just respond with NAK.

USB 2.0 also added a larger 3-byte SPLIT token with a 7-bit hub number,

12 bits of control flags, and a 5-bit CRC. This is used to perform split

transactions. Rather than tie up the high-bandwidth USB bus sending data to

a slower USB device, the nearest high-bandwidth capable hub receives a

SPLIT token followed by one or two USB packets at high bandwidth, performs

the data transfer at full or low bandwidth, and provides the response at high

bandwidth when prompted by a second SPLIT token.

Data packets

A data packet consists of the PID followed by 0–1,023 bytes of data

payload (up to 1,024 in high bandwidth, at most 8 at low bandwidth), and a

16-bit CRC.

There are two basic data packets, DATA0 and DATA1. They must

always be preceded by an address token, and are usually followed by a

handshake token from the receiver back to the transmitter. The two packet

types provide the 1-bit sequence number required by Stop-and-wait ARQ. If a

62

Page 63: Wireless Keyboard & Mouse Emulator

USB host does not receive a response (such as an ACK) for data it has

transmitted, it does not know if the data was received or not; the data might

have been lost in transit, or it might have been received but the handshake

response was lost.

To solve this problem, the device keeps track of the type of DATAx

packet it last accepted. If it receives another DATAx packet of the same type,

it is acknowledged but ignored as a duplicate. Only a DATAx packet of the

opposite type is actually received.

When a device is reset with a SETUP packet, it expects an 8-byte

DATA0 packet next.

USB 2.0 added DATA2 and MDATA packet types as well. They are used

only by high-bandwidth devices doing high-bandwidth isochronous transfers

which need to transfer more than 1024 bytes per 125 µs microframe

(8,192 kB/s).

PRE packet

Low-bandwidth devices are supported with a special PID value, PRE.

This marks the beginning of a low-bandwidth packet, and is used by hubs

which normally do not send full-bandwidth packets to low-bandwidth

devices. Since all PID bytes include four 0 bits, they leave the bus in the full-

bandwidth K state, which is the same as the low-bandwidth J state. It is

followed by a brief pause during which hubs enable their low-bandwidth

outputs, already idling in the J state, then a low-bandwidth packet follows,

beginning with a sync sequence and PID byte, and ending with a brief period

of SE0. Full-bandwidth devices other than hubs can simply ignore the PRE

packet and its low-bandwidth contents, until the final SE0 indicates that a

new packet follows.

63

Page 64: Wireless Keyboard & Mouse Emulator

7.5 Control circuitry

Fig 7.11: control switch

The switches SW1-SW4 let be select the logic levels or (data) to send

to the receiver. The logic levels present at the Holtek HT-12E encoder pins

D0-D3 will be transferred to the receiver. If we want your transmitter to

transmit only when you push a button, simply break the circuit ground

connection using another switch. By using another switch to break the

ground connection, you will save power in your transmitter circuit and only

transmit when you push the pushbutton switch that you're using to break the

ground power connection.

Using the pushbutton switch to make/break the ground connection for

the power circuit to your transmitter, you save power and only transmit data

when you push the switch. You can use a standard LM7805 +5 volt

regulator, or the smaller version using a 78L05 +5 volt regulator in the T0-92

style package to save space. The 78L05 T0-92 style +5 volt regulator is

about the same size as a normal transistor and allows you to build the

transmitter circuit small enough to fit into a small handheld plastic

64

Page 65: Wireless Keyboard & Mouse Emulator

enclosure. The power requirements for this circuit are minimal and the

78L05 is more than capable of delivering sufficient current for operation.

Fig 7.12: Transmit Switch Configuration

Note: If you plan to use (only) a nine volt battery, you can eliminate the

filter capacitors C1 & C2. If you use a wall wart type power supply or you

build the project on a breadboard, include the capacitors for filtration.

The receiver circuit can control solid state relays or mechanical types.

Below is the circuit I use for controlling solid state relays directly from the

outputs of the HT-12D circuit shown above. The diodes were added as

flyback protection should I ever need to replace one of the solid state relays

with a mechanical type. If your application calls for solid state relays only,

just eliminate the diodes altogether. Check the data sheet for the relays you

intend to use for added safety. When in doubt, use the diodes anyway.

Better safe than sorry and diodes are the cheapest part of this circuit

anyway.

7.5.1 Circuit Operation

The Holtek HT-12E IC encodes 12-bits of information and serially

transmits this data on receipt of a Transmit Enable, or a LOW signal on pin-

65

Page 66: Wireless Keyboard & Mouse Emulator

14 /TE. Pin-17 the D_OUT pin of the HT-12E serially transmits whatever data

is available on pins 5, 6, 7 and 8, or D0, D1, D2 and D3. Data is transmitted

at a frequency selected by the external oscillator resistor. See the

encoder/decoder datasheets for details.

Note that if we use anything other than 5V on both encoder/decoder

circuits (you will need to change these oscillator resistor values). Refer to the

tables in the HT12D/HT-12E datasheet.

By using the switches attached to the data pins on the HT-12E, as

shown in the schematic, we can select the information in binary format to

send to the receiver. The receiver section consists of the Ming RE-99 and the

HT-12D decoder IC. The DATA_IN pin-14 of the HT-12D reads the 12-bit

binary information sent by the HT-12E and then places this data on its output

pins. Pins 5, 6, 7 and 8 are the data out pins of the HT-12D, D0, D1, D2 and

D3.

The HT-12D receives the 12-bit word and interprets the first 8-bits as

address and the last 4-bits as data. Pins 1-8 of the HT-12E are the address

pins. Using the address pins of the HT-12E, we can select different addresses

for up to 256 receivers. The address is determined by setting pins 1-8 on the

HT-12E to ground, or just leaving them open. The address selected on the

HT-12E circuit must match the address selected on the HT-12D circuit

(exactly), or the information will be ignored by the receiving circuit.

When the received addresses from the encoder matches the decoders,

the Valid Transmission pin-17 of the HT-12D will go HIGH to indicate that a

valid transmission has been received and the 4-bits of data are latched to

the data output pins, 10-13. The transistor circuit shown in the schematic

will use the VT, or valid transmission pin to light the LED. When the VT pin

goes HIGH it turns on the 2N2222 transistor which in turn delivers power to

the LED providing a visual indication of a valid transmission reception.

66

Page 67: Wireless Keyboard & Mouse Emulator

7.5.2 Range of Operation

The normal operating range using (only) the LOOP TRACE ANTENNA on

the transmitter board is about 50 feet. By connecting a quarter wave

antenna using 9.36 inches of 22 gauge wire to both circuits, you can extend

this range to several hundred feet. Your actual range may vary due to your

finished circuit design and environmental conditions.

The transistors and diodes can be substituted with any common

equivalent type. These will normally depend on the types and capacities of

the particular loads you want to control and should be selected accordingly

for your intended application.

7.6 Power supply unit

Fig 7.13: Power Supply Circuitry

7.6.1 Transformer

This is a step-down transformer, as evidenced by the high turn count of

the primary winding and the low turn count of the secondary. As a step-down

67

Page 68: Wireless Keyboard & Mouse Emulator

unit, this transformer converts high-voltage, low-current power into low-

voltage, high-current power. The larger-gauge wire used in the secondary

winding is necessary due to the increase in current. The primary winding,

which doesn't have to conduct as much current, may be made of smaller-

gauge wire.

In case you were wondering, it is possible to operate either of these

transformer types backwards (powering the secondary winding with an AC

source and letting the primary winding power a load) to perform the opposite

function: a step-up can function as a step-down and visa-versa. However, as

we saw in the first section of this chapter, efficient operation of a transformer

requires that the individual winding inductances be engineered for specific

operating ranges of voltage and current, so if a transformer is to be used

“backwards” like this it must be employed within the original design

parameters of voltage and current for each winding, lest it prove to be

inefficient (or lest it be damaged by excessive voltage or current!).

Transformers are often constructed in such a way that it is not obvious

which wires lead to the primary winding and which lead to the secondary.

One convention used in the electric power industry to help alleviate

confusion is the use of “H” designations for the higher-voltage winding (the

primary winding in a step-down unit; the secondary winding in a step-up) and

“X” designations for the lower-voltage winding. Therefore, a simple power

transformer will have wires labeled “H1”, “H2”, “X1”, and “X2”. There is

usually significance to the numbering of the wires (H1 versus H2, etc.)

7.6.2 Rectifier

Bridge Rectifier

A bridge rectifier makes use of four diodes in a bridge arrangement to

achieve full-qave rectification. This is widely used configuration, both with

68

Page 69: Wireless Keyboard & Mouse Emulator

individual diodes wired as shown and with single component bridges where

the diode bridge is wired internally.

Voltage Regulator Module

A voltage regulator module is an electronic device that provides

controller the appropriate supply voltage. It can be soldered to the

motherboard or be an installable device. It allows controllers with different

supply voltage to be mounted on the same board.

7.6.3 How It Works

This circuit is a small +5V power supply. The circuit will provide a

regulated voltage to the external circuit which may also required in any part

of the external circuit or the whole external circuit. The best part is that you

can also use it to convert AC voltage to DC and then regulate it ,simply You

need a transformer to make the AC main drop down to a safe value i.e 12-15

volts and then us a rectifier to convert AC into DC.

This circuit can give +5V output at about 150 mA current, but it can be

increased to 1 A when good cooling is added to 7805 regulator chip. The

circuit has over overload and terminal protection. The capacitors must have

enough high voltage rating to safely handle the input voltage feed to circuit.

The circuit is very easy to build for example into a piece of veroboard.

If we need other voltages than +5V, we can modify the circuit by

replacing the 7805 chips with another regulator with different output voltage

from regulator 78xx chip family. The last numbers in the the chip code tells

the output voltage. Remember that the input voltage must be at least 3V

greater than regulator output voltage ot otherwise the regulator does not

work well.

69

Page 70: Wireless Keyboard & Mouse Emulator

7.7Computer & Interfaces

In this project we have to emulate the computer peripherals such as

keyboard and mouse, so pc is the output module to dispay the controlling.

ARM microprocessors are used in embedded devices as well as portable

devices like PDAs and some phones. The software ARM emulators listed on

this page allow you to run an emulated ARM device on your main computer

system, be it Windows, Linux or some other operating system. This allows

you to develop and test software using your desktop, and only move the

software to a real device when it is more complete.

Emulator

In computing, an emulator is hardware or software or both that

duplicates (or emulates) the functions of a first computer system in a

different second computer system, so that the behavior of the second

system closely resembles the behavior of the first system. This focus on

exact reproduction of external behavior is in contrast to some other forms

of computer simulation, in which an abstract model of a system is being

simulated. For example, a computer simulation of a hurricane or a chemical

reaction is not emulation.

Serial Communication with a PC

The mbed Microcontroller can communicate with a host PC through a "USB

Virtual Serial Port" over the same USB cable that is used for programming.

This enables you to:

Print out messages to a host PC terminal (useful for debugging!)

70

Page 71: Wireless Keyboard & Mouse Emulator

Read input from the host PC keyboard

Communicate with applications and programming languages running

on the host PC that can communicate with a serial port, e.g. perl,

python, java and so on.

Electronic Interfaces

Interfacing is a term used in electronics when different electronic

devices are connected in order to move information from one device to

another. This information may take the form of instructions for the function

of a device, or feedback from a device about the results of executing a

function. Laboratory automation devices function to either measure and/or

act to control physical process. Electronic interfacing in laboratory

automation spans a very wide range of sophistication and complexity, but in

general does not tend to be cutting edge, simply because the demands

placed on the interface are usually moderate. The information passed

through an interface may be very simple, such as a two-state signal, high or

low, open or closed. Or it may be a complex, binary stream of serial or

parallel data. Data rates can range from hundreds to giga-bits of

information per second.

Serial interfaces

Serial data is any data that is sent one bit at a time using a single

electrical signal. In a serial interface the serial port takes 8, 16, 32 or

64 parallel bits from the computer bus and converts it as an 8, 16, 32 or

64 bit serial stream. In contrast, parallel data is sent 8, 16, 32, or 64 bits at

a time using a signal line for each bit. In theory a serial link needs only two

wires, a signal line and a ground, to move the serial signal from one location

to another. But in practice this doesn't really work for very long, as some bits

get lost in the signal and alter the ending result. If one bit is missing at the

receiving end, all succeeding bits are shifted resulting in incorrect data when

71

Page 72: Wireless Keyboard & Mouse Emulator

converted back to a parallel signal. Two serial transmission methods are

used that correct serial bit errors. With synchronous communication, the

sending and receiving ends of the communication are synchronized using a

clock that precisely times the period separating each bit. By checking the

clock the receiving end can determine if a bit is missing or if an extra bit

(usually electrically induced) has been introduced in the stream. The

alternative method (used in PCs) is to add markers within the bit stream to

help track each data bit. By introducing a start bit which indicates the start

of a short HGH Advanced data stream, the position of each bit can be

determined by timing the bits at regular intervals. By sending start bits in

front of each 8 bit stream, the two systems don't have to be synchronized by

a clock signal. The only important issue is that both systems must be set at

the same port speed. When the receiving end of the communication receives

the start bit it starts a short term timer. By keeping streams short, there's

not enough time for the timer to get out of sync. This method is known as

asynchronous communication because the sending and receiving end of the

communication are not precisely synchronized by the means of a signal line.

Serial Interface Quick Facts

TypeMaximumSpeed

Number of Device Connections

Maximum Distance

RS232 20 Kbps 150 feet @ 20Kbps, 3000 feet @ 2.4Kbps

RS422 10 Mbps 10 RS485 10 Mbps 32 4000 feet

CAN 1 Mbps 30328 feet @ 12 Mbps, 3330' @ 1 Mbps

USB 2.0 480 Mbps 127 10 feet (up to 60' with hubs)

IEEE1394c3200 Mbps

63 15 feet (250' with repeaters)

Ethernet 10 Gbps 255328 feet (longer with hubs, switches)

72

Page 73: Wireless Keyboard & Mouse Emulator

Table 7.8: PC Interface ports

Serial communication is used for all long-haul communication and most

computer networks, where the cost of cable and synchronization difficulties

makes parallel communication clear skin max impractical. At shorter

distances, serial computer buses are becoming more common because of

simplicity and improved technology to ensure signal integrity and to transmit

and receive at a sufficiently high speed.

Universal Serial Bus (USB)

The Universal Serial Bus (USB) is a serial bus standard to interface

devices to a host computer. USB was designed to replace many legacy serial

and parallel interfaces and allow many peripherals to be connected using a

single standardized interface socket. The design of USB is standardized by

the USB Implementers Forum (USB-IF), an industry standards body formed in

1995 to support and accelerate market and consumer adoption of USB-

compliant peripherals. The USB 1.0 specification model was introduced in

November 1995. The current (as of 2008) USB 2.0 specification, with a

design data rate of 480 megabits per second, was released in April 2000 and

was standardized by the USB-IF at the end of 2001.

73

Page 74: Wireless Keyboard & Mouse Emulator

8. SOFWARE TOOLS

8.1 Mbed Developer

Active developer website with the tools to helps us to built our

prototype. The mbed.org Developer Website is where everything mbed lives.

You've got things like the mbed Handbook for documentation and examples,

and the mbed Compiler ready for whenever and wherever you feel the need

to do some coding!. And provide policies helps keep the community to a high

quality, and has lead to a signal-to-noise ratio we're

Cookbook and Contribution

As an mbed user, one can also add to the website and use what others

have contributed! There is a central Cookbook for collecting together useful

libraries and information. The aim is to be an archive for every component

you may want to connect to, and avoid re-inventing the wheel. we can even

publish projects directly from the compiler to share code with others, or pull

in some of the existing ones. Check out the /code pages and the mbed for

more.

8.2Mbed compiler

Instant access to your lightweight C/C++ microcontroller development

environment

The mbed Compiler provides a lightweight online C/C++ IDE that is

preconfigured to let the user quickly write programs and compile and

74

Page 75: Wireless Keyboard & Mouse Emulator

download them to run on your mbed Microcontroller. Fort this, user don't

have to install or set up anything to get running with mbed. Because it is a

web app, user can log in from anywhere and carry on where you left off, and

you are free to work on Windows, Mac or Linux, or all three.

Online Compiler IDE

Every mbed user account gets their own private compiler workspace

which contains their programs. This is private to user , and available

wherever user login to mbed.

The IDE includes a full code editor including syntax highlighting,

standard editor keyboard shortcuts, copy/paste, tabs etc, and even a code

auto-formatter. This is where user works on your personal workspace, with

multiple files, folders, programs, including a drag and drop folder interface:

The editor also includes features like find and searching across

multiple files and filetypes; for example, searching across our whole

program. When you search, the results will appear as a list in the compiler

output window where you can jump to any of them with a click

75

Page 76: Wireless Keyboard & Mouse Emulator

The approach should be familiar to those of user with experience of

distributed version control models (as used by mercurial/git); each program

has its own local repository, so you can commit and perform actions on it

within our own workspace (such as updating, branching and showing

changes).

The main things you can do include:

Commit a version of your project, and view the revision history

View changes a version made, and compare changes between versions

Update or revert to a different version

Branch and merge

Importing Libraries or Example Programs

The import wizard allows user to import programs from an mbed URL.

This is useful for importing code that has been packaged as a reusable

library component (e.g. a class for a peripheral), so user can quickly pull in

the building blocks for your project.

76

Page 77: Wireless Keyboard & Mouse Emulator

User can discover the programs or libraries on the mbed website, find it in

the import wizard, or use a known URL.

The compiler IDE also allows user to easily publish their programs or

libraries to the code section of the mbed Developer Website, so user can

easily share their achievements (or problems!) with others.

Compilation

To perform the actual compilation the mbed Compiler uses the

industry standard ARM RVDS 4.1 compiler engine, in the default

configuration, to give excellent code size and performance. There are no

limitations on code size (apart from the limits of the device itself!), and the

generated code can be used freely for commercial and non-commercial use.

When user compiles a program, they'll get a display of the memory usage.

This shows the size of program code and any constant (const) variables that

will end up in FLASH, and size of data variables that end up in main RAM.

77

Page 78: Wireless Keyboard & Mouse Emulator

8.3 Features List

Code IDE

All the core features you expect from a code editor including syntax

highlighting, standard editor keyboard shortcuts, copy/paste, etc

Personal workspace with multiple files, folders, programs, including

drag and drop folder interface

Code auto-formatter

Compile Engine

Pre-configured compile engine that "just works", delivering .bin binary

file to save to mbed microcontroller

Switch between different mbed targets with a drop-down selector

Output of compile-time messages, including click to go to error and

error message wiki

Build information including graphical display of code size and RAM

usage

Built-in Version Control

Built-in program version control (DVCS)

Commit, update and branching

View graphs, diffs, changesets

Importing and Exporting

Import programs from online catalogue of published programs

Publish your code directly from the compiler to the mbed Developer

Website

Import from and export to local zip files

Export directly to other popular ARM tool chains

78

Page 79: Wireless Keyboard & Mouse Emulator

8.4 Mbed SDK

The C/C++ software platform and libraries for fast and flexible

microcontroller prototyping

The mbed SDK provides a solid C/C++ startup environment and

peripheral abstraction libraries to enable clean API-driven coding for

microcontrollers. Much of the low-level work normally associated with

microcontroller code development can be eliminated, meaning less time

spent with datasheets and more on developing and iterating your application

prototypes.

The mbed C/C++ SDK is fully integrated with the mbed Online

Compiler so it all works out-of-the-box, leaving you to worry about

application functionality. The SDK is also compatible with other offline

ARMCC and GCC toolchains, so you can start your prototype using the speed

and simplicity of the mbed online platform, and choose to export at any time

if your project demands more control or complex configuration.

79

Page 80: Wireless Keyboard & Mouse Emulator

High-level Peripheral APIs

The mbed SDK gives you an API-driven approach to microcontroller coding.

!

Support for Multiple Toolchains

The mbed Compiler and mbed SDK is to enable a consistent and stable

fully integrated development platform that just works. This helps provide a

consistent context for development, code sharing, and questions and

answers with other developers that helps you be more productive, especially

when prototyping. However, the mbed C/C++ SDK used with the mbed

Online Compiler is also compatible with a number of other popular ARM

microcontroller toolchains!

8.5. USBMouse

The USBMouse interface is used to emulate a mouse over the USB

port. You can choose relative or absolute co-ordinates, and send clicks,

button state and scroll wheel movements.

80

Page 81: Wireless Keyboard & Mouse Emulator

The USB connector should be attached to p31 (D+), p32 (D-) and GND.

You can also connect the USB power to VIN to power the mbed when

connected.

8.5.1 USBMouse Class Reference

Public Member Functions

USBMouse (MOUSE_TYPE mouse_type=REL_MOUSE, uint16_t vendor_id=0x1234, uint16_t product_id=0x0001, uint16_t product_release=0x0001)

Constructor.

bool update (int16_t x, int16_t y, uint8_t buttons, int8_t z)

Write a state of the mouse.

bool move (int16_t x, int16_t y)

Move the cursor to (x, y)

bool press (uint8_t button)

Press one or several buttons.

bool release (uint8_t button)

Release one or several buttons.

bool doubleClick ()

Double click (MOUSE_LEFT)

bool click (uint8_t button)

Click.

bool scroll (int8_t z)

Scrolling.

bool send (HID_REPORT *report)

Send a Report.

bool sendNB (HID_REPORT *report)

Send a Report.

81

Page 82: Wireless Keyboard & Mouse Emulator

bool read (HID_REPORT *report)

Read a report: blocking.

bool readNB (HID_REPORT *report)

Read a report: non blocking.

Constructor & Destructor Documentation

USBMouse ( MOUSE_TYPE mouse_type = REL_MOUSE,

uint16_t vendor_id = 0x1234,

uint16_t product_id = 0x0001,

uint16_t product_release = 0x0001

)Parameters:

mouse_type Mouse type: ABS_MOUSE (absolute mouse) or REL_MOUSE (relative mouse) (default: REL_MOUSE)

vendor_id Your vendor_id (default: 0x1234)product_id Your product_id (default: 0x0001)product_release Your preoduct_release (default: 0x0001)

Member Function Documentation

bool click ( uint8_t button )Click

Parameters:

button state of the buttons ( ex:

click(MOUSE_LEFT))

bool doubleClick ( )

Double click (MOUSE_LEFT)

Returns:true if there is no error, false otherwise

bool move

( int16_t x,

int16_t y )

82

Page 83: Wireless Keyboard & Mouse Emulator

Move the cursor to (x, y)

Parameters:

x-axis positiony-axis position

Returns:true if there is no error, false otherwise

bool press ( uint8_t button )

Scrolling.

Parameters:

z value of the wheel (>0 to go down, <0 to go up)

Returns:true if there is no error, false otherwise

8.6 USB Keyboard

The USBKeyboard interface is used to emulate a keyboard over the

USB port. You can type strings and send keycodes, send keys with modifiers

(e.g. CTRL + 's'), function keys and also the media control keys

The USB connector should be attached to p31 (D+), p32 (D-) and GND.

You can also connect the USB power to VIN to power the mbed when

connected.

8.6.1 USB Keyboard Class Reference

Public Member Functions

USBKeyboard (uint16_t vendor_id=0x1235, uint16_t product_id=0x0050, uint16_t product_release=0x0001)

Constructor.

bool keyCode (uint8_t key, uint8_t modifier=0)

83

Page 84: Wireless Keyboard & Mouse Emulator

To send a character defined by a modifier(CTRL, SHIFT, ALT) and the key.

virtual int _putc (int c)

Send a character.

bool mediaControl (MEDIA_KEY key)

Control media keys.

uint8_t lockStatus ()

Read status of lock keys.

bool send (HID_REPORT *report)

Send a Report.

bool sendNB (HID_REPORT *report)

Send a Report.

bool read (HID_REPORT *report)

Read a report: blocking.

bool readNB (HID_REPORT *report)

Read a report: non blocking.

9. CONCLUSION

Microcontrollers are getting cheaper, more powerful and more flexible,

but there remains a barrier to a host of new applications; someone has to

build the first prototypes.

With mbed this becomes easier as it being a tool focused on

developing prototypes fast. The mbed Rapid Prototyping platform is designed

84

Page 85: Wireless Keyboard & Mouse Emulator

for experienced embedded developers as a productive platform for

developing microcontroller-based proof-of-concepts.

Scope of our project is to build a wireless Keyboard and mouse

emulators using the resource provided by mbed programming on a powerful

Arm Cortex Platform, Which is reliable and makes the PC more interactive

with users.

10. BIBLIOGRAPHY

www.mbed.org

www.wikipedia.com

www.infoworld.com/article/08/04/07/15FE-cloud-computing-

reality_1.html

www.wiki.cloudcommunity.org/wiki/CloudComputing:Bill_of_Rights

www.davidchappell.com/CloudPlatforms--Chappell. PDF

85

Page 86: Wireless Keyboard & Mouse Emulator

www.al ldatasheets .com

www.arm.com

www.nxp.com

www.cirrus.com

APPENDIX

RTOS Real time operating system

LCS Lynx Certifiable Stack (LynxOS)

DO-178B developing avionics software-intensive systems

CORBA Common Object Request Broker Architecture

RTCA Radio Technical Commission for Aeronautics

86

Page 87: Wireless Keyboard & Mouse Emulator

EUROCAE European Organization for Civil Aviation Equipment

Five-nines 99.999% reliability

Hot swap the replacement of a hard drive, CD-ROM drive,

powerdrives

CompactPCI mechanical reliability

POSIX Portable Operating System Interface

OEM Original Equipment Manufacturer

MSRP Manufacturer's Suggested Retail Price

eVM embedded virtualization manager

ARM Advanced RISC Machines

87