This project uses an HC-05 Bluetooth module to replace a traditional wired connection used for viewing the serial monitor.
Materials:
- Arduino - https://amzn.to/2DLjxR2
- Breadboard - https://amzn.to/2RYqiSK
- Jumper wires - https://amzn.to/2Q7kiKc
- HC-05 Bluetooth module - https://amzn.to/2T1IXhb
As an Amazon Associate I may earn from qualifying purchases.
Step 1: CodeThis code is a simple serial communication example taken from the provided examples in the Arduino IDE. You can find it in: File > Examples > Communication > Ascii Table
/*
ASCII table
Prints out byte values in all possible formats:
- as raw binary values
- as ASCII-encoded decimal, hex, octal, and binary values
For more on ASCII, see http://www.asciitable.com and http://en.wikipedia.org/wiki/ASCII
The circuit: No external hardware needed.
created 2006
by Nicholas Zambetti <http://www.zambetti.com>
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/ASCIITable
*/
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("ASCII Table ~ Character Map");
}
int thisByte = 33;
void loop() {
Serial.write(thisByte);
Serial.print(", dec: ");
Serial.print(thisByte);
Serial.print(", hex: ");
Serial.print(thisByte, HEX);
Serial.print(", oct: ");
Serial.print(thisByte, OCT);
Serial.print(", bin: ");
Serial.println(thisByte, BIN);
if (thisByte == 126) {
while (true) {
continue;
}
}
thisByte++;
}
- Make sure your baud rate is set to 9600
- Almost any code that uses a serial connection to the computer will work, but this is just a simple example.
After the code has been uploaded to the board, disconnect the power. Next, Attach the Bluetooth module to the circuit as seen above:
- GND to Ground
- VCC to 5v pin
- TXD to pin 0
- RXD to pin 1
- Power on the Arduino
- Open your computer's Bluetooth settings
- Pair with the HC-05 module:
- Find the module's serial port name in "devices and printers":
- In the Arduino IDE, choose serial port of Bluetooth module (mine is COM10)
- Open the serial monitor as normal to view incoming information
Here are some optional things you may want to try out:
- You can use virtual serial ports instead, but I found that using the real ones works a lot faster (and it's generally easier).
- You can also use this process with the standard Firmata example to allow for wireless control with Processing (set the speed to 9600 first)
Comments
Please log in or sign up to comment.