A Bluetooth module simulator: an HC-05 on an Arduino
Mokxi is a free online HC-05 Bluetooth module simulator that runs in your browser, with nothing to install and no account needed. An HC-05 on an Arduino Uno, with a lamp on pin 9. Type a command into the module’s own box in the serial monitor, where a phone app would send it, and the lamp answers, so you can write and test the Arduino side before you pair anything.
- 455parts on the bench
- 43boards running now
- 1.00xreal time, on every board
What you can do here
In the circuit above, or in the editor it opens.
- Type commands where a phone app would send them, and watch the lamp answer
- Read the sketch’s replies in the module’s own box
- Hang up the link and watch the STATE pin drop
- Set the module’s baud wrong and see the garbage it causes
- Open the SoftwareSerial chat example from the tutorial, at 9600 baud
- Practice AT commands, as the tutorial shows
What the running circuit shows
Text in, text out, and a lamp.
To an Arduino, an HC-05 is a serial port: TXD and RXD carry bytes, and whatever is paired on the far side never touches the board. So that is what the model is. The far end of the link is the module’s own box in the serial monitor, under its name beside the board’s, and what you type there reaches the Uno exactly as a phone app’s text would. Type on and the lamp on pin 9 lights and the module’s box answers “lamp on”. blink flashes it every 300 ms, off turns it off, and status answers with the lamp’s state.
The STATE pin sits at 3.3 V while something is connected. Click the module on the canvas to hang up: STATE drops to 0 V, the green LED on its face goes out, and what you type goes nowhere, as it would with the phone out of range. Click it again to reconnect and the lamp takes commands again.
This sketch talks to the module at 1200 baud with a receiver written in plain C, and its comments explain why: digitalRead on an ATmega328P takes about forty microseconds, too slow to sample a 9600 baud bit by hand. Open the module’s properties and set its baud to 4800 to cause the most common HC-05 fault on purpose: the module’s box shows garbage characters instead of “lamp ready”, and the lamp ignores you. A real module ships at 9600, and the SoftwareSerial sketch in the tutorial runs at that.
How the module is modeled
The serial half is real; there is no radio.
TXD and RXD carry 8N1 frames bit by bit at the module’s baud, and STATE and EN are real pins, so the mistakes that stop a real HC-05 stop this one: TXD wired to the board’s transmit pin instead of crossed to its receive pin, or a module and a sketch at different baud rates.
What it leaves out is everything with a radio in it: pairing, the PIN, range, interference and the phone app. Mokxi cannot pair with your phone. What you can test here is everything on the Arduino’s side of the module, which is where most HC-05 projects go wrong. On a real bench, most tutorials put a divider on the Uno’s transmit line, because the module’s RXD is a 3.3 V input; nothing in Mokxi can be damaged, so this circuit leaves it out.
Questions
Is it free?
Yes. The circuit on this page, every part in it and the editor it opens in are on the free plan, with no card.
Do I need an account?
No. The circuit runs the moment the page does, and the editor opens without one. A free account is only for saving a project to the cloud and sharing it by link.
Can I simulate Bluetooth on an Arduino?
The Arduino’s side of it, yes. Mokxi models the HC-05 as the serial port the board sees, with the far end in the serial monitor, so your sketch’s commands, replies and baud rate are all tested. Pairing and the radio are not modeled, and nothing connects to a real phone.
Why does my HC-05 print garbage characters?
Almost always a baud mismatch: the module and the sketch are not at the same rate. An HC-05 ships at 9600 for data and talks at 38400 in AT command mode. Set the module’s baud to 4800 in this circuit to see what it looks like.
Which pins should an HC-05 use on an Uno?
Two ordinary pins, such as 2 and 3, crossed: the module’s TXD to the board’s receive pin and its RXD to the board’s transmit pin. Pins 0 and 1 are the hardware port the USB serial monitor uses.
More simulators
Each one opens on a circuit that is already running.
Switch a lamp by text
Open the circuit, type on into the module’s box and watch the lamp. Nothing to install, and no account needed.