Project help: Two microcontrollers communicating via BT

Hi

I currently need help implementing two microcontroller communication via bluetooth. I don’t have any ideas on how to have both communicating with each other.

If I understand correctly, to have a single microcontroller communicate with a device with BT (e.g. laptop/PC), we initialise the TX/RX by setting UCSRB high for RXEN and TXEN (USART bits), set the character sizes using UCSRC and baud rate using UBRRL. And then scan the device from laptop/PC then read UDR.

How is it done for two microcontrollers with a BT module each? How is it initialised so that the two microcontrollers communicate with each other? (if this is done in code, how would it be implemented?) Is there anything I need to do other than connecting the BT module properly to the appropriate TX/RX pins of micro?

Thanks in advance!

You have to separate it into sections.

First setting up the microcontroller or PC internal registers for the UART/serial port. (though some bluetooth module require or can use I2C or SPI serial protocol, which is different from the regular serial TX/RX communication)

Second, the microcontroller communicating through the serial UART/I2C/SPI port with the local bluetooth module to send configuration settings, and later the data.

Third and fourth, the above happening on the other side as well.

Fifth, the bluetooth modules communicating among each other to establish the link, and later send each other the data from the microcontrollers (or PC)

Looking at the register names that you use, I gather that you speak of AVR micro controllers. Setting up PIC microcontrollers or other types might be different. They definitely have different register names. That is described in the micro controller manual or datasheet. This entails the first part (and third for the other end of the link).

Similarly for the bluetooth module, it should be mentioned in the manual or datasheet how to operate it. There is no generic set of step on how to do this. As there is no one-and-only bluetooth module. They are made by different manufacturers. This is the second part (and fourth for the other end of the link)

They all have to adhere to the bluetooth protocol though, which is the 5th part, how the module communicate over RF. But that is mostly abstracted by the hardware. What settings to send to the module, and how it is formatted, to make this happen can be very different for each manufacturer.

In short, read the fine manual(s). It depends.

[EDIT]There is also a 6th part. One microcontroller needs to know what the other means with the data sent to him. So your program must be able to seperate the ‘words’ inside the ‘sentences’, and make sense of them. That is totally up to you in how you do it. You have to invent the language in which they communicate.