Android Controlled Robot

38
BLOCK DIAGRAM Android and Bluetooth Enable Blueto oth Receiv Motors Motor Driver Microcontro ller Batteries Decode r Wireles s

description

for designing project it is very useful data

Transcript of Android Controlled Robot

Page 1: Android Controlled Robot

BLOCK DIAGRAM

Android and Bluetooth

Enable Phone

Bluetooth

Receiver

Motors

Motor Driver

MicrocontrollerBatteries

Decoder

WirelessCamera

Page 2: Android Controlled Robot
Page 3: Android Controlled Robot

Power Supply

The power supply supplies the required energy for both the microcontroller and the associated

circuits. It is the most essential part of the circuit because to run its constituent IC’s circuit has to

be provided with power. These IC’s can run on DC power. Hence the required D.C supply has to

be generated. The main parts of a power supply unit and their function are as follows:

DESCRIPTION:

Power supply is the main requirement of every project. The various parts of a power supply are

explained below:

Transformer: The function of the transformer is to step down the voltage level from the

available A.C.220V to the desired voltage. The 9-0-9 rating of the transformer upon the

requirements of the IC’s in the circuit is used. The secondary has a center tapping which

forms the neutral terminal.

Bridge rectifier: The function of the rectifier is to convert the alternating voltage signal

into a unidirectional one. This function is provided by semiconductor diodes connected in

bridge configuration. Diodes 1N4007 are used as rectifier.

Ripple Rejection: The output voltage of the rectifier is unidirectional but pulsating

capacitor of 1000Pf is used for ripple rejection.

Page 4: Android Controlled Robot

Regulation: To obtain a constant voltage specific IC’s are used as voltage regulator.

Voltage regulator LM7805 is used. These IC’s have three terminals input, output and a

ground terminal.

PIC microcontroller

Peripheral Interface Controller

Instruction set[]

A PIC's instructions vary from about 35 instructions for the low-end PICs to over 80 instructions

for the high-end PICs. The instruction set includes instructions to perform a variety of operations

on registers directly, the accumulator and a literal constant or the accumulator and a register, as

well as for conditional execution, and program branching.

Some operations, such as bit setting and testing, can be performed on any numbered register, but

bi-operand arithmetic operations always involve W (the accumulator), writing the result back to

either W or the other operand register. To load a constant, it is necessary to load it into W before

it can be moved into another register. On the older cores, all register moves needed to pass

through W, but this changed on the "high end" cores.

PIC cores have skip instructions which are used for conditional execution and branching. The

skip instructions are 'skip if bit set' and 'skip if bit not set'. Because cores before PIC18 had only

unconditional branch instructions, conditional jumps are implemented by a conditional skip (with

the opposite condition) followed by an unconditional branch. Skips are also of utility for

conditional execution of any immediate single following instruction. It is possible to skip skip

instructions. For example, the instruction sequence "skip if A; skip if B; C" will execute C if A is

true or if B is false.

The 18 series implemented shadow registers which save several important registers during an

interrupt, providing hardware support for automatically saving processor state when servicing

interrupts.

In general, PIC instructions fall into 5 classes:

Page 5: Android Controlled Robot

1. Operation on working register (WREG) with 8-bit immediate ("literal") operand.

E.g. movlw (move literal to WREG), andlw (AND literal with WREG). One instruction

peculiar to the PIC is retlw, load immediate into WREG and return, which is used with

computed branches to produce lookup tables.

2. Operation with WREG and indexed register. The result can be written to either the

Working register (e.g. addwf reg,w). or the selected register (e.g. addwf reg,f).

3. Bit operations. These take a register number and a bit number, and perform one of 4

actions: set or clear a bit, and test and skip on set/clear. The latter are used to perform

conditional branches. The usual ALU status flags are available in a numbered register so

operations such as "branch on carry clear" are possible.

4. Control transfers. Other than the skip instructions previously mentioned, there are only

two: goto and call.

5. A few miscellaneous zero-operand instructions, such as return from subroutine,

and sleep to enter low-power mode.

Performance[]

The architectural decisions are directed at the maximization of speed-to-cost ratio. The PIC

architecture was among the first scalar CPU designs,[citation needed] and is still among the simplest

and cheapest. The Harvard architecture—in which instructions and data come from separate

sources—simplifies timing and microcircuit design greatly, and this benefits clock speed, price,

and power consumption.

The PIC instruction set is suited to implementation of fast lookup tables in the program space.

Such lookups take one instruction and two instruction cycles. Many functions can be modeled in

this way. Optimization is facilitated by the relatively large program space of the PIC (e.g. 4096 ×

14-bit words on the 16F690) and by the design of the instruction set, which allows for embedded

constants. For example, a branch instruction's target may be indexed by W, and execute a

"RETLW" which does as it is named - return with literal in W.

Interrupt latency is constant at three instruction cycles. External interrupts have to be

synchronized with the four clock instruction cycle, otherwise there can be a one instruction cycle

jitter. Internal interrupts are already synchronized. The constant interrupt latency allows PICs to

achieve interrupt driven low jitter timing sequences. An example of this is a video sync pulse

generator. This is no longer true in the newest PIC models, because they have a synchronous

interrupt latency of three or four cycles.

Page 6: Android Controlled Robot

Advantages[

Small instruction set to learn

RISC  architecture

Built in oscillator with selectable speeds

Easy entry level, in circuit programming plus in circuit debugging PICKit units available for

less than $50

Inexpensive microcontrollers

Wide range of interfaces including I²C, SPI, USB, USART, A/D, programmable

comparators, PWM, LIN, CAN, PSP, and Ethernet[8]

Availability of processors in DIL package make them easy to handle for hobby use.

transfers between pages. PCLATH must also be preserved by any interrupt handler.

I/O PORTSSome pins for these I/O ports are multiplexed with an alternate function for the peripheral features on the device. In general, when a peripheral is enabled, that pin may not be used as a general purpose I/O pin. Additional information on I/O ports may be found in the PICmicro™ Mid-Range Reference Manual, (DS33023).

4.1 PORTA and the TRISA RegisterPORTA is a 6-bit wide, bi-directional port. The corresponding data direction register is TRISA. Setting aTRISA bit (= ‘1’) will make the corresponding PORTA pin an input (i.e., put the corresponding output driver in a Hi-Impedance mode). Clearing a TRISA bit (= ‘0’) will make the corresponding PORTA pin an output (i.e., put the contents of the output latch on the selected pin). Reading the PORTA register reads the status of the pins, whereas writing to it will write to the port latch. All write operations are read-modify-write operations. Therefore, a write to a port implies that the port pins are read, the value is modified and then written to the port data latch.Pin RA4 is multiplexed with the Timer0 module clock input to become the RA4/T0CKI pin. The RA4/T0CKI pin is a Schmitt Trigger input and an open drain output. All other PORTA pins have TTL input levels and full CMOS output drivers.

PORTB and the TRISB RegisterPORTB is an 8-bit wide, bi-directional port. The corresponding data direction register is TRISB. Setting a TRISB bit (= ‘1’) will make the corresponding PORTB pin an input (i.e., put the corresponding output driver in a Hi-Impedance mode). Clearing a TRISB bit (= ‘0’) will make the corresponding PORTB pin an output (i.e., put the contents of the output latch on the selected pin). Each of the PORTB pins has a weak internal pull-up. A single control bit can turn on all the pull-ups. This is performed by clearing bit RBPU (OPTION_REG<7>). The weak pull-up is automatically turned off when the port pin is configured as an output. The pull-ups are disabled

Page 7: Android Controlled Robot

on a Power-on Reset. user, in the Interrupt Service Routine, can clear the interrupt in the following manner:a) Any read or write of PORTB. This will end the mismatch condition.b) Clear flag bit RBIF. A mismatch condition will continue to set flag bit RBIF.Reading PORTB will end the mismatch condition and allow flag bit RBIF to be cleared.The interrupt-on-change feature is recommended for wake-up on key depression operation and operations where PORTB is only used for the interrupt-on-change feature. Polling of PORTB is not recommended while using the interrupt-on-change feature. This interrupt on mismatch feature, together with software configureable pull-ups on these four pins, allow easy interface to a keypad and make it possible for wake-up on key depression. Refer to the Embedded Control Handbook, “Implementing Wake-up on Key Stroke” (AN552).RB0/INT is an external interrupt input pin and is configured using the INTEDG bit (OPTION_REG<6>).

PORTC and the TRISC RegisterPORTC is an 8-bit wide, bi-directional port. The corresponding data direction register is TRISC. Setting a TRISC bit (= ‘1’) will make the corresponding PORTC pin an input (i.e., put the corresponding output driver in a Hi-Impedance mode). Clearing a TRISC bit (= ‘0’) willmake the corresponding PORTC pin an output (i.e., putthe contents of the output latch on the selected pin). PORTC is multiplexed with several peripheral functions(Table 4-5). PORTC pins have Schmitt Trigger input buffers.When enabling peripheral functions, care should be taken in defining TRIS bits for each PORTC pin. Some peripherals override the TRIS bit to make a pin an output, while other peripherals override the TRIS bit to make a pin an input. Since the TRIS bit override is in effect while the peripheral is enabled, read-modify-write instructions (BSF, BCF, XORWF) with TRISC as destination should be avoided. The user should refer to the corresponding peripheral section for the correct TRIS bit settings, and to Section 13.1 for additional information on read-modify-write operations.

UNIVERSAL SYNCHRONOUS ASYNCHRONOUS RECEIVER TRANSMITTER (USART)The Universal Synchronous Asynchronous Receiver Transmitter (USART) module is one of the two serial I/O modules. (USART is also known as a Serial Communications Interface or SCI.) The USART can be configured as a full duplex asynchronous system that can communicate with peripheral devices, such as CRT terminals and personal computers, or it can be configured as a half duplex synchronous system that can communicate with peripheral devices, such as A/D or D/A integrated circuits, serial EEPROMs, etc.The USART can be configured in the following modes:• Asynchronous (full duplex)• Synchronous - Master (half duplex)• Synchronous - Slave (half duplex)Bit SPEN (RCSTA<7>) and bits TRISC<7:6> have to be set in order to configure pins RC6/TX/CK and RC7/RX/DT as the Universal Synchronous Asynchronous

Receiver Transmitter.

Page 8: Android Controlled Robot

USART Baud Rate Generator (BRG)The BRG supports both the Asynchronous and Synchronous modes of the USART. It is a dedicated 8-bit baud rate generator. The SPBRG register controls the period of a free running 8-bit timer. In Asynchronous mode, bit BRGH (TXSTA<2>) also controls the baudrate. In Synchronous mode, bit BRGH is ignored. Table 10-1 shows the formula for computation of the baud rate for different USART modes which only apply in Master mode (internal clock).Given the desired baud rate and FOSC, the nearest integer value for the SPBRG register can be calculated using the formula in Table 10-1. From this, the error in baud rate can be determined.

It may be advantageous to use the high baud rate (BRGH = 1), even for slower baud clocks. This is because the FOSC/(16(X + 1)) equation can reduce the baud rate error in some cases. Writing a new value to the SPBRG register causes the BRG timer to be reset (or cleared). This ensures the BRG does not wait for a timer overflow before outputting the new baud rate.

Page 9: Android Controlled Robot

ANALOG-TO-DIGITAL CONVERTER (A/D) MODULEThe 8-bit analog-to-digital (A/D) converter module has five inputs for the PIC16F73/76 and eight for the

PIC16F74/77.The A/D allows conversion of an analog input signal to a corresponding 8-bit digital number. The output of the sample and hold is the input into the converter, which generates the result via successive approximation. The analog reference voltage is software selectable to either the device’s positive supply voltage (VDD), or the voltage level on the RA3/AN3/VREF pin. The A/D converter has a unique feature of being able to operate while the device is in SLEEP mode. To operate in SLEEP, the A/D conversion clock must be derived from the A/D’s internal RC oscillator.

The A/D module has three registers. These registers are:• A/D Result Register ((ADRES)• A/D Control Register 0 (ADCON0)• A/D Control Register 1 ((ADCON1)The ADCON0 register, shown in Register 11-1, controls the operation of the A/D module. The ADCON1 register, shown in Register 11-2, configures the functions of the port pins. The port pins can be configured as analog inputs (RA3 can also be a voltage reference),or as digital I/O. Additional information on using the A/D module can be found in the PICmicro™ Mid-Range MCU Family Reference Manual (DS33023) and in Application Note,

AN546 (DS00546).

The following steps should be followed for doing an A/D conversion:1. Configure the A/D module:• Configure analog pins, voltage reference, and digital I/O (ADCON1)• Select A/D conversion clock (ADCON0)• Turn on A/D module (ADCON0)2. Configure the A/D interrupt (if desired):• Clear ADIF bit• Set ADIE bit• Set PEIE bit• Set GIE bit

3. Select an A/D input channel (ADCON0).4. Wait for at least an appropriate acquisition period.5. Start conversion:• Set GO/DONE bit (ADCON0)6. Wait for the A/D conversion to complete, by either:• Polling for the GO/DONE bit to be cleared (interrupts disabled)• Waiting for the A/D interrupt7. Read A/D result register (ADRES), and clear bit ADIF if required.8. For next conversion, go to step 3 or step 4, as required.

Page 10: Android Controlled Robot

A/D Acquisition RequirementsFor the A/D converter to meet its specified accuracy, the charge holding capacitor (CHOLD) must be allowed to fully charge to the input channel voltage level. The analog input model is shown in Figure 11-2. The source impedance (RS) and the internal sampling switch (RSS) impedance directly affect the time required to charge the capacitor CHOLD. The sampling switch (RSS) impedance varies over the device voltage (VDD), see Figure 11-2. The source impedance affects the offset voltage at the analog input (due to pin leakage current).

The maximum recommended impedance for analog sources is 10 k. After the analog input channel is selected (changed), the acquisition period must pass before the conversion can be started. To calculate the minimum acquisition time, TACQ, see the PICmicro™ Mid-Range MCU Family Reference Manual (DS33023). In general, however, given a maximum source impedance of 10 kand at a temperature of 100°C, TACQ will be no more than 16 sec.

Selecting the A/D Conversion ClockThe A/D conversion time per bit is defined as TAD. The A/D conversion requires 9.0 TAD per 8-bit conversion. The source of the A/D conversion clock is software selectable. The four possible options for TAD are:• 2 TOSC (FOSC/2)• 8 TOSC (FOSC/8)• 32 TOSC (FOSC/32)• Internal RC oscillator (2-6 s) For correct A/D conversions, the A/D conversion clock (TAD) must be selected to ensure a minimum TAD time as small as possible, but no less than 1.6 s.

Configuring Analog Port PinsThe ADCON1, TRISA and TRISE registers control the operation of the A/D port pins. The port pins that are desired as analog inputs must have their corresponding TRIS bits set (input). If the TRIS bit is cleared (output), the digital output level (VOH or VOL) will be converted. The A/D operation is independent of the state of the CHS2:CHS0 bits and the TRIS bits.

A/D ConversionsSetting the GO/DONE bit begins an A/D conversion. When the conversion completes, the 8-bit result is placed in the ADRES register, the GO/DONE bit is cleared, and the ADIF flag (PIR<6>) is set. If both the A/D interrupt bit ADIE (PIE1<6>) and the peripheral interrupt enable bit PEIE (INTCON<6>) are set, the device will wake from SLEEP whenever ADIF is set by hardware. In addition, an interrupt will also occur if the global interrupt bit GIE (INTCON<7>) is set. Clearing the GO/DONE bit during a conversion will abort the current conversion. The ADRES register will NOT be changed, and the ADIF flag will not be set. After the GO/DONE bit is cleared at either the end of a conversion, or by firmware, another conversion can be initiated by setting the GO/DONE bit. Users must still take into account the appropriate acquisition time for the application.

Page 11: Android Controlled Robot

11.5 A/D Operation During SLEEPThe A/D module can operate during SLEEP mode. This requires that the A/D clock source be set to RC (ADCS1:ADCS0 = ‘11’). When the RC clock source is selected, the A/D module waits one instruction cycle before starting the conversion. This allows the SLEEP instruction to be executed, which eliminates all digital switching noise from the conversion. When the conversion is completed, the GO/DONE bit will be cleared, and the result loaded into the ADRES register. If the A/D interrupt is enabled, the device will wake-up from SLEEP. If the A/D interrupt is not enabled, the A/D module will then be turned off, although the ADON bit will remain set.When the A/D clock source is another clock option (not RC), a SLEEP instruction will cause the present conversion to be aborted and the A/D module to be turned off, though the ADON bit will remain set. Turning off the A/D places the A/D module in its lowest current consumption state.

Android App.

Blue Control is a basic universal Remote Control for Blue-Tooth enabled serial devices such as 

Blue Tooth modules connected to a micro-controller. For each button pressed the corresponding

ASCII code for the label will be sent. For example pressing buttons A-H will send the

characters’ "a" - "h". The up, down, left, right, and center buttons will send  "U","D","L","R",

and "C" characters. Hopefully this  will inspire people to create a lot of fun Blue-Tooth

Controlled devices.

Page 12: Android Controlled Robot

Bluetooth Module

Handheld devices like a cell phone, palmtop and laptop were rapidly becoming an integral part

of our daily lives. In most cases, these devices do not have compatible data communication

interfaces, or, if they do, the interface requires cumbersome cable connections and configuration

procedures. Isn’t it absolutely fantastic to connect your PC to share music, data and calendar info

without using any wires? Or to wirelessly access phone numbers on your PDA from your cell

phone. Driving without holding the handset makes it dramatically safer and easier. Accessing the

internet, print files from your computer and print photos taken from a digital camera without a

single piece of wire lying in your office.An obvious solution was to get rid of the cables and use short-range, wireless, inexpensive and universally adopted by device vendors to facilitate on-demand connectivity among devices .The marvel of engineering gave us the freedom of exchanging data without using yards of wires and popularly known as Bluetooth.  It all started back in 1994 when Ericsson Mobile Communications began a utilitarian assessment on an inexpensive low-power radio solution between cell phones and phone accessories. The idea was to build a small radio both in cellular phones and laptop that would replace the cumbersome wires between them. Four years later Ericsson, along with Nokia, IBM, Toshiba and Intel formed the Bluetooth Special Interest Group (SIG). These were the leading companies in the field of mobiles, notebook computers and leaders in the digital market technology. With such big names of the field it immediately grabbed the media attention and there were very high expectations from the product. But a lot of complexities and problems were faced initially. Then in 1999 first Bluetooth spec 1.0 was launched and a year later spec 1.1. Today, the Bluetooth SIG has 3,400 companies.

Bluetooth is a wireless technology standard for connecting fixed or mobile devices using short radio link. It aims at providing wireless communication along with small size, minimal power consumption and low price. The technology was designed to be simple, and the target was to have it become standard in wireless connectivity. The name of Bluetooth has a very interesting story. The Bluetooth SIG adopted the code name as a tribute to the tenth-century Viking king Harald Blatand who peacefully united numerous small kingdoms under his region that were working under different rules same as done in Bluetooth technology. Harald liked to eat blueberries, which gave his teeth the coloration that lead to the nickname "Bluetooth."The symbol is also famous as its name and has a very interesting origin. The logo combines the representation of the Nordic runes Hagalaz (transcribed by 'H') and Berkana (transcribed by 'B') in the same symbol. This is, HB like Harald Blatand.

Page 13: Android Controlled Robot

What makes Bluetooth special when wireless technologies like IrDA and Wi-Fi existed?Pitting these technologies against each other would be unfair as each of them have their unique advantages and complement rather than compete with each other. Though IrDA supported wireless connectivity they needed optical contact that is direct line of sight and supported one to one data exchange using infra-red light. For example a remote control and television where we need to hold remote in line of sight of television. In the same way Wi-Fi offers a means to wirelessly connect one or more computers to each other and a router so that we can access the Internet. It uses longer distances and transfer data at faster rate as well but Bluetooth offers a means to link not just computers, but PDAs, headphones, headsets, printers and other technology with each other. The figure below represents the three networks.

“Wireless communication made easy” a tag line used to address Bluetooth but it is only for users not for the developers. The demands of creating Bluetooth-enabled products are very challenging.  It should be flexible application topology so the exchange takes place between the required devices. Power required by Bluetooth should be low as no one wants a short battery life. Size is a important feature while designing. It should be small so adding Bluetooth capability to a device should not noticeably increase its size. A Quality of service is supported for voice and last but not the least Bluetooth cannot cost more than cables.

The promise of Bluetooth- What it can do!!The promise of Bluetooth is extremely ambitious. Originally conceived as a low-power, short range technology to replace cables interconnecting devices such as printers, keyboards and mine. It has evolved its perceived potential to a much larger extent. It has given rise to Personal area

Page 14: Android Controlled Robot

network where everything is accessible within the Personal Operating Space that is related to communicating information both voice and data. There are various examples where Bluetooth model has been used.

As we can see initially Bluetooth was started in the area of mobile phone. Every manufacturer started implementing Bluetooth enabled devices in the phones. The reason behind this adoption was to use wireless headset with the phone which meant phone can be used even if it is in a briefcase or trunk. It was used to make a mobile phone or cordless modem to provide Dial –Up networking which allows connecting to internet without any physical phone line. Laptop can automatically utilize the users nearby cell phone to dial and connect to dial-up service. Peer to peer file exchange can be done without the presence of network infrastructure. For example a salesperson can share the contents of electronic slides with the audience. Bluetooth enables automatic detection of Bluetooth devices in the room enabling the transfer. Data synchronization between the devices is permitted by Bluetooth. For example a Bluetooth enabled desktop computer can wirelessly synchronize its contact list, task information, calendar to a user’s phone, PDA, or notebook. Nowadays, HP is making printers and notebooks with embedded Bluetooth technology so they can automatically detect Bluetooth –enabled printers in their area and wirelessly send documents to the printer without going through lengthy network and printing set-up process.

How does bluetooth work?Bluetooth is a short range communication that is simple, secure and available everywhere. Billions of devices ranging from mobile phones and computers to medical devices and home entertainment products are enabled with Bluetooth devices.

In simple terms Bluetooth takes the information normally carried by wire and transmits it at a special frequency to another Bluetooth device. Both sending and receiving devices have same Bluetooth receiver chip, which translates data into wireless transmission and then back to normal again depending on the sender or receiver. Any Bluetooth device can be a master or slave depending on the application. Every device is equipped with a microchip (trans-receiver) that transmits and receives in the frequency of 2.4 GHz which is available to the whole world. Besides the information, there are three channels of voices available. The

Page 15: Android Controlled Robot

information can be exchanged at a speed up-to 1 megabit per second or 2 megabit for second in Second Generation of this Technology). Frequency hopping allows communicating inclusively without interferences. The transmitted data is divided into packets and each packet is transmitted on one of the 79 designated Bluetooth channels. Each channel has a bandwidth of 1 MHz’s. The first channel starts at 2402 MHz and continues up to 2480 MHz in 1 MHz steps. It usually performs 800 hops per second, with Adaptive Frequency-Hopping enabled. The master sets the hopping sequence, and the slaves synchronize to the Master. A cluster is formed by a master and up to seven active slaves known as Pico nets. The slaves in a Pico net only communicate with the master. A scatter net can be formed by linking two or more Pico nets. When a device is present in more than one Pico net, it must time-share and synchronize to the master of the Pico net with which it is currently communicating. Networks in Bluetooth are far more diverse and dynamic. As they are constantly formed and dissolved Bluetooth devices move in and out of range so there are limitless ways to connect them. The figure below summarizes the Bluetooth communication.

With the basic understanding of information exchange in Bluetooth system we now move ahead to specifications.FrequencyThe Bluetooth operates in the frequency range of 2.4 GHz. Though this band is available worldwide it may differ in some countries. This is the frequency band of scientific and medical industries 2.45 GHz (ISM*). The ISM* is opened for any system of radio and take care of the interferences of monitors, the controls for doors of garage, the wireless telephone and microwave oven. The ranges of the bandwidth in The United States and Europe are between 2.400 to 2.483,5 MHz and it covers part of France and Spain. The range of the bandwidth in Japan is between 2.471 to 2.497 MHz So the system can be used worldwide due to that transmitters of radio covers 2.400 and 2.500 MHz and makes it possible to select the appropriate frequency. ISM The industrial, scientific and medical (ISM) radio bands were originally reserved internationally for the use of RF electromagnetic fields for industrial, scientific and medical purposes other than

Page 16: Android Controlled Robot

communications. In general, communications equipment must accept any interference generated by ISM equipment.

Country Frequency range RF channels

Europe & USA 2400-2483.5 MHz F =2402 + k MHz k = 0,……..,78

Japan 2471-2497 MHz F =2473+ k MHz k=0,………22

Spain 2445-2475 MHz F =2449+ k MHz K=0,………22

France 2446.5-2483.5 MHz F =2454+ k MHz K=0,……..22

Table representing frequency band of various countries.PowerAccording to the power of emission the equipments are qualified in 3 categories ranging from 1mW to 10mW. The recipient equipment must have at least 70dBm. The chips are incorporated in portable devices and powered by batteries and that’s why they should have minimum consumption of power up-to 97% less than a mobile phone so the battery of phone lasts longer. If Bluetooth devices do not exchange information then they establish the way of wait to save energy. The power of transmission that is used as specification is of 1 mW for a scope of 10 m, 100 mW for a scope of up to 100 m.

Device power class PowerEmitted

Range

Class 1 100mW ~ 100 m

Class 2 2.5mW ~10 m

Class 3 1mW ~1 m

RangeThe connections have a maximum range of 10 meters, though using amplifiers it is possible to come up to 100 meters, but creating some distortion interferes. Maybe it doesn’t look too much, but it is necessary to remember that these devices were created by the intention of using them in closed environments and little distances.

Type of Data and ClientsIt can carry both data and voice as an exchange. The different types of users of Bluetooth can be computers, PDA, mobile phone, etc. There are many other places Bluetooth is used. For example mobile phones, head set, stereo headphones, audio adapter, printer, keyboard, GPS system and many more.

Page 17: Android Controlled Robot

Data Transfer RateIt is one of the important features in Bluetooth device. Data transfer rate is defined as the speed at which data is transmitted from one device to another. It generally ranges from 1 mega -bite to 24 mega- bite depending on the type of Bluetooth device version as shown below.

Version Data rate Maximum output Application

Version 1.2 1Mbit/s .7Mbits/s

Version 2.0 3 Mbit/s 2.1Mbits/s

Version 3.0 24Mbits/s -

Frequency HoppingIt is method of transmitting radio signals by rapidly switching a carrier wave among many channels using a pseudorandom sequence known both to transmitter and receiver. It is useful to avoid collision where many devices use same frequency to send the signal and avoid interference.Since the ISM band is open to anyone, radio systems operating in this band must cope with several unpredictable sources of interference, such as baby monitors, garage door openers, cordless phones and microwave ovens (the strongest source of interference). Interference can be avoided using an adaptive scheme that finds an unused part of the spectrum, or it can be suppressed by means of spectrum spreading. In the United States, radios operating in the 2.45-GHz ISM band are required to apply spectrum-spreading techniques if their transmitted power level exceeds 0 dBm [2]. Bluetooth radios use frequency-hop (FH) spread spectrum, since it better supports low-cost, low-power radio implementations. In addition, they better cope with near-far   problems: a nearby jammer is effectively suppressed by the narrow channel filter as long as its jammer TX spectrum does not coincide with the selected hop channel. FH systems divide the frequency band into several hop channels. During a connection, radio transceivers hop from one channel to another in a pseudorandom fashion. The instantaneous (hop) bandwidth is small in FH radios, but spreading is obtained over the entire frequency band. This results in low-cost narrow-band transceivers with maximum immunity to interference.

Page 18: Android Controlled Robot

Here we can see that channel time is divided into slots of 625uS. Each packet can occupy 1, 3 or 5 slots. The hopping frequency keeps constant within the packet. The master uses the odd number of slots to send the packets and slave uses even numbered

Ad hoc NetworkAd hoc network is a decentralized wireless network where they do not rely on preexisting infrastructure such as routers instead each device participates in routing by routing data to the other nodes. An ad hoc network typically refers to any set of networks where all devices have equal status on a network and are free to associate with any other ad hoc network device in link range. Bluetooth also uses ad hop networking and is based on peer connectivity: a device carrying a Bluetooth radio can make a connection to any other device carrying a Bluetooth radio. There is no wired infrastructure with base stations or access points that can support the call setup or can provide low-power modes. In a Bluetooth system the master device can connect up-to seven other devices forming a network known as Pico net. For example a computer can connect to seven different Bluetooth enabled devices such as mouse, printer, CD-player, keyboard etc. The Pico net is a group of several devices that are in the same radio coverage where they share same channel that is constituted between two and eight other units. Two or more Bluetooth units that share a FH channel form a Pico net. To regulate traffic on the channel, one of the participating units becomes a master of the Pico net. However, users on the same channel must share capacity. Since the channel capacity is only 1 MHz, as more and more users are added, throughput per user quickly drops to less than some 10 kb/s. The spectral bandwidth available is 79 MHz, but cannot be used effectively when every unit must share the same 1-MHz hop channel. Therefore, another solution has been adopted. Units that share the same area and that are within range of one another can potentially establish ad hoc connections between themselves. However, solely units that truly want to exchange information share the same 1-MHz channel of a Pico net. This solution permits several Pico nets to be created with overlapping coverage areas. Each Pico net channel applies its own pseudorandom hopping sequence through the 79-MHz medium. The Pico nets are uncoordinated and hop independently. Within the Pico net, the participants have to share the 1 MHz, but multiple Pico nets share the entire 79 MHz, thus

Page 19: Android Controlled Robot

increasing the capacity. A collection of multiple Pico nets is called a scatter net. A maximum of 10 Pico nets can be connected to form a scatter net. A figure below shows how Pico net works.

A typical Ad hoc network.Bluetooth ProtocolsBluetooth is not a single protocol but is made of different protocols seven to be exact. Each of these protocols work at different part of Bluetooth completing the Bluetooth configuration. Bluetooth hardware can be represented in a diagram with host, Bluetooth radio, link controller and link manager.

Each part on the hardware runs on certain protocols and comibining them gives us a compact structure of bluetooth device.

Page 20: Android Controlled Robot

The HC-05 Bluetooth module is the most economical and easiest way to go wireless. (via

Bluetooth)

This module makes it easy for you to wirelessly extend your serial interface, so you can control

any program running on your Laptop with serial port interface.

Page 21: Android Controlled Robot

The 4 pins are:

VCC (Power 3.3 – 6V);

GND;

TXD;

RXD;

Default pairing code: 1234

Adding Bluetooth support for a mouse or keyboard is easy with the Raspberry Pi. Things go a different route as soon as you’re trying to communicate with other electronic gadgets. There are numerous hosts and intractable out there that does serial communication via Bluetooth. But all of them (at least those I have read) use Bluetooth modules connected to the serial port of the Raspberry Pi. I had a similar solution at first, but then I accidentally connected one of my Bluetooth modules the wrong way and fried it…  Here’s a picture of it. Before frying it, I added a sticker (“S” for Slave) that is now burned, too.

Page 22: Android Controlled Robot

In the lower right is the voltage regulator that literally exploded. However, these specific modules are cool for tinkering, as they allow TTL (5V) levels!The HC-05 modules are very clever pieces of hardware, as they translate incoming Bluetooth communication to serial data. So once configured this gives the tinkerer the possibility to achieve serial communication over Bluetooth. The HC-05 acts transparently, meaning that you just communicate with the serial port it is connected to and the module then sends/receives via Bluetooth.To be able to continue tinkering with communications I gave the “Bluetooth USB Dongle” with Raspberry Pi alternative a second chance. Weeks ago I have not been able to get Bluetooth running using a serial communication protocol. In fact, I was not even able to pair any of my computers and the Raspberry Pi.My plan is to modify my LED sign to wireless communications. As a proof-of-concept I am going to use my Raspberry Pi – with attached bluetooth USB dongle – to communicate with a HC-05 Bluetooth module connected to an Arduino.To quote from “The Big Bang Theory”: “Everything is better with Bluetooth!”As I mentioned, I was not able to pair any of my computers with the Bluetooth dongle on a Raspberry Pi. So I am going to use a Bluetooth module with an Arduino to check connection, pairing and communications. So this tutorial will start with the Arduino part, explaining the set-up and use of the HC-05 Bluetooth module. The second part covers the installation and configuration of Bluetooth on the Raspberry Pi. Finally, I will show you how to implement a communication protocol with handshaking between the Arduino and the Raspberry Pi. So let’s start.

The HC-05 Bluetooth module

These modules are very cheap to buy. If you feel adventurous, order them direct from China… The actual module is the green board that sits on the breakout board in my model. The pure HC-05 will only work on 3.3V levels, not with 5V-TTL-levels. So one would need level shifters (again). The board I ordered has a voltage regulator and some 1k Ohm resistors (the SMD types

Page 23: Android Controlled Robot

labeled “102”) on the signal lines. This is in fact the simplest and cheapest form of protecting a 3.3V circuit against 5V. Take a look at the front and back:

The connections and their purpose: KEY: if set to HIGH module goes into command mode for configuration – only 3.3V input!

RXD: the RXD signal line – 5V safe

TXD: the TXD signal line – 5V safe

5.0: connection for 5V supply voltage

3.3: connection for 3.3V supply voltage

Page 24: Android Controlled Robot

GND: Ground

Motor Driver

L293D

L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as current amplifiers since they take a low-current control signal and provide a higher-current signal. This higher current signal is used to drive the motors.

L293D contains two inbuilt H-bridge driver circuits. In its common mode of operation, two DC motors can be driven simultaneously, both in forward and reverse direction. The motor operations of two motors can be controlled by input logic at pins 2 & 7 and 10 & 15. Input logic 00 or 11 will stop the corresponding motor. Logic 01 and 10 will rotate it in clockwise and anticlockwise directions, respectively.

Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to start operating. When an enable input is high, the associated driver gets enabled. As a result, the outputs become active and work in phase with their inputs. Similarly, when the enable input is low, that driver is disabled, and their outputs are off and in the high-impedance state.

Page 25: Android Controlled Robot

Pin Diagram:

Pin Description:

Pin No Function Name1 Enable pin for Motor 1; active high Enable 1,22 Input 1 for Motor 1 Input 13 Output 1 for Motor 1 Output 14 Ground (0V) Ground5 Ground (0V) Ground6 Output 2 for Motor 1 Output 27 Input 2 for Motor 1 Input 2

Page 26: Android Controlled Robot

8 Supply voltage for Motors; 9-12V (up to 36V) Vcc 2

9 Enable pin for Motor 2; active high Enable 3,410 Input 1 for Motor 1 Input 311 Output 1 for Motor 1 Output 312 Ground (0V) Ground13 Ground (0V) Ground14 Output 2 for Motor 1 Output 415 Input2 for Motor 1 Input 416 Supply voltage; 5V (up to 36V) Vcc 1

Geared DC Motor

Geared DC motors can be defined as an extension of DC motor which already had its Insight details demystified here. A geared DC Motor has a gear assembly attached to the motor. The speed of motor is counted in terms of rotations of the shaft per minute and is termed as RPM .The gear assembly helps in increasing the torque and reducing the speed. Using the correct combination of gears in a gear motor, its speed can be reduced to any desirable figure. This concept where gears reduce the speed of the vehicle but increase its torque is known as gear reduction.  This Insight will explore all the minor and major details that make the gear head and hence the working of geared DC motor.

External StructureAt the first sight, the external structure of a DC geared motor looks as a straight expansion over the simple DC ones.

Page 27: Android Controlled Robot

The lateral view of the motor shows the outer protrudes of the gear head. A nut is placed near the shaft which helps in mounting the motor to the other parts of the assembly.

Page 28: Android Controlled Robot

Also, an internally threaded hole is there on the shaft to allow attachments or extensions such as wheel to be attached to the motor.

Wireless camera

Wireless security cameras provide surveillance for homes or businesses. The uses of these

cameras vary; those with remote access allow users to monitor activity inside of their homes to

view interaction between caregivers and a child or to monitor children home alone. Outdoor

cameras provide additional security by allowing users to view visitors at the door before opening

it and to monitor perimeters of their home and grounds. Businesses rely on these cameras as

well. Many wireless security cameras have motion and sound sensors that send out alerts to the

user if the sensor triggers.

Page 29: Android Controlled Robot

Wireless cameras also allow users to install them in areas where wired security systems are not

feasible. Knowing about the varied features offered by wireless security cameras allows

consumers to make an informed decision before purchasing one.

Wireless security cameras are closed-circuit television (CCTV) cameras that transmit a video and audio signal to a wireless receiver through a radio band. Many wireless security cameras require at least one cable or wire for power; "wireless" refers to the transmission of video/audio. However, some wireless security cameras are battery-powered, making the cameras truly wireless from top to bottom.

Wireless cameras are proving very popular among modern security consumers due to their low installation costs (there is no need to run expensive video extension cables) and flexible mounting options; wireless cameras can be mounted/installed in locations previously unavailable to standard wired cameras. In addition to the ease of use and convenience of access, wireless security camera allows users to leverage broadband wireless internet to provide seamless video streaming over-internet.