Introduction: Sending Temperature Sensor Data Wirelessly From Arduino to PC

In the guide, I will explain how I managed to send data to PC from Arduino via a Bluetooth RN-42 transceiver.This Bluetooth transceiver basically acts as a generic serial COM port. The Arduino to PC connection is very useful in applications, where the Arduino reads sensor output pin and then pass their values via serial Bluetooth to a PC.

Step 1: Hardware Connection

1) Solder 4 wires to the Bluetooth module: TX-0, RX-1, GND, VCC

Also connect the RTS-0 to CTS-1

2) Wire the Bluetooth module to the Arduino Uno according to this:

Bluetooth TX-0 to Arduino Uno RX-0

Bluetooth RX-1 is connected to Arduino Uno TX-1

Bluetooth GND pin is connected to Arduino GND pin

Bluetooth VCC -----> Arduino 3.3V piN.

4) Use a 9V battery to power the circuit

Using your PC's bluetooth or phone's bluetooth, try to connect to RN-42 module

5) Connect the TMP36 temperature sensor as shown in the hardware diagram. The middle pin is connected to any A0 -A7 analog pin.

Step 2: Code

Copy the following code to Arduino IDE

int outputpin = A2;

int rawvoltage = 0;

void setup()

{

Serial.begin(115200);

}

void loop()

{

rawvoltage = analogRead(outputpin);// read the outputpin of TMP36

float voltage = rawvoltage/205.0;// get the rawvoltage value in V

float celsiustemp = 100.0 * volts - 50; // calculating in celcius

Serial.print(celsiustemp);

Serial.println("°Celcius");

delay(2000);//delay of 2 seconds

}

Upload this code to Arduino microcontroller after removing the connection of tx and rx of bluetooth to arduino. It interferes the data transfer from PC to arduino.

Step 3: Reading the Sensor Value on PC

If you are using RN-42. this code will work right away. Connect your bluetooth with the PC. Open the bluetooth devices in PC. Check the connection. Now go to your Arduino IDE. Go to tools. Check the port. It should be the same port which is the outgoing port of the bluetooth. Open the serial monitor. Type any character if you dont get the date. This allows bluetooth to send data. And thus the connection is established.