How to Interface Bluetooth with LPC2148 ARM

Interfacing Bluetooth with LPC2148 ARM

Tags: Circuit diagram to interface Bluetooth with lpc2148,c source code to transmit data from lpc2148 using Bluetooth, Bluetooth c source codeInterfacing Bluetooth with LPC2148 ARM 7, ARM7 interfacing Bluetooth,
Overall rating
ARM7 LPC2148 Primer Board

The ARM7 LPC2148 Primer board is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports in system programming (ISP) which is done through serial port.

NXP’s ARM7 (LPC2148), ARM Primer Kit is proposed to smooth the progress of developing and debugging of various designs encompassing of High speed 32-bit Microcontrollers.


Bluetooth is a proprietary open wireless technology standard for exchanging data over short distances from fixed and mobile devices, creating personal area networks (PANs) with high levels of security. Bluetooth technology allows electronic devices to communicate wirelessly.

Interfacing Bluetooth

Fig. 1 shows how to interface the Bluetooth with microcontroller. Bluetooth technology handles the wireless part of the communication channel; it transmits and receives data wirelessly between these devices. It delivers the received data and receives the data to be transmitted to and from a host system through a host controller interface (HCI). The most popular host controller interface today is either a UART or a USB. Here, I will only focus on the UART interface; it can be easily show how a Bluetooth module can be integrated on to a host system through a UART connection.


Fig. 1 Interfacing Bluetooth to Microcontroller

Interfacing Bluetooth with LPC2148

We now want to transmit & receive the data from host system to LPC2148 Primer Board by using Bluetooth module through UART0. The serial data is taken from or sent to the host system by using Bluetooth module through MAX232 into the SBUF register of LPC2148 microcontroller (refer serial interfacing with LPC2148). The serial data from the host device is taken by using the Serial Interrupt of the LPC2148 controller. The UART0 pin lines are used to transmit & receive operations in LPC2148 Primer Board.

Pin Assignment with LPC2148


UART DB-9 Connector


Processor Lines

Serial Port Section















Circuit Diagram to Interface Bluetooth with LPC2148

Source Code

The Interfacing Bluetooth module with LPC2148 program is very simple and straight forward, which send a message to mobiles from LPC2148 Primer Board through Bluetooth module by using UART0. Some delay is occurring when a single data is sent to mobile through UART. C programs are written in Keil software. The baud rate of microcontroller is 9600.

C Program to transmit or receive data in LPC2148


#define CR     0x0D

#include <LPC21xx.H>


void init_serial (void);

int putchar (int ch);

int getchar (void);

unsigned char test;


int main(void)



   char *Ptr = "*** UART0 Demo ***\n\n\rType

Characters to be echoed!!\n\n\r";


   VPBDIV = 0x02;         // Divide Pclk by two







     while (*Ptr)





     putchar(getchar()); // Echo terminal










void init_serial (void)



PINSEL0   = 0x00000005; // Enable RxD0 and TxD0

U0LCR   = 0x00000083;   //8 bits, no Parity, 1 Stop bit


U0DLL   = 0x000000C3; //9600 Baud Rate @ 30MHz VPB Clock   U0LCR   = 0x00000003;





int putchar (int ch)



if (ch == '\n')



   while (!(U0LSR & 0x20));

   U0THR = CR;




while (!(U0LSR & 0x20));

return (U0THR = ch);




int getchar (void)



while (!(U0LSR & 0x01));

return (U0RBR);




To compile the above C code you need the KEIL software. They must be properly set up and a project with correct settings must be created in order to compile the code. To compile the above code, the C file must be added to the project.

In Keil, you want to develop or debug the project without any hardware setup. You must compile the code for generating HEX file. In debugging Mode, you want to check the port output without LPC2148 Primer Board.

The Flash Magic software is used to download the hex file into your microcontroller IC LPC2148 through UART0.

Testing the Bluetooth with LPC2148

Give +3.3V power supply to LPC2148 Primer Board; connect the 5V adapter with Bluetooth module which is connected with the LPC2148 Primer Board. There are two Bluetooth modules are required. One is connected with LPC2148 Primer Board; other one is connected with PC.

First connect the serial cable between LPC2148 Primer board & PC. Then open the Hyper Terminal screen, select which port you are using and set the default settings. Now the screen should show some text messages. If the messages are correctly displayed in Hyper Terminal, then only connect the Bluetooth modules in LPC2148 Primer Board UART0 & PC.

If you are not reading any data from UART0, then you just check the jumper connections & just check the serial cable is working. Otherwise you just check the code with debugging mode in Keil. If you want to see more details about debugging just see the videos in below link.

General Information

Join the World's Largest Technical Community

we respect your privacy.