How To - MS Onboard Bluetooth Cheap Ebay module (HC-05)

This forum is for the discussion of other projects on Megasquirt/Microsquirt hardware that don't fit into any of the other forums

Moderators: jsmcortina, muythaibxr

How To - MS Onboard Bluetooth Cheap Ebay module (HC-05)

Postby Crazy2287 » Tue Apr 18, 2017 6:44 am

Hello all.

This is a placeholder but eventually i'll finish this post. It intends to be a more indepth How to for ordering, configuring and setting up the HC-05 Bluetooth unit for tuning the MS-ECU with Tuner studio.

You'll need 3 things to get this to work.

USB-RS232 TTL converter:
It's purpose is to emulate a serial com port. When you plug it into the computer and install the drivers it will operate as a RS232 over USB, It's intention is to be "Invisible" In other words the computer treats it as a normal serial port. It should (and i encourage you to check this) ouput TTL voltage level which is 3.3v. This is important, The HC-05 will not communicate with a 5v or 12v serial connection.
There are several types available and to my knowledge they should all work as long as they are 3.3v (TTL) and have drivers, Some install automatically, some need the drivers downloaded form a 3rd party. I use a PL2303 (type that in ebay) based unit.

HC-05 Bluetooth module:
These modules are designed to operate as an invisible serial link. Meaning when configured correctly, the computer and connected device see a RS232 connection. You put serial in one end, it communicates that over a blutooth connection. i recommend the HC-05 ( as it can be configured to operate as a Master (seeks out and establishes bluetooth connections), Or a slave(passively awaits a connection attempt), They can be easily configured to different Baud rates to support MS1, or MS2. I'm assuming MS3 as well but i have not done this. Make sure you get HC-05 (type that in ebay) and i recommend getitng the units that have the small tactile momentary switch near the usb port. This switch makes programming the unit easier. I recommend purchasing 2 of these units, You should be able to do it for under $15. Then you can configure a master and slave device, And establish a secure connection to the megasquirt in tuner studio in around 5 seconds after MS-ECU boot. That is not a joke, it's that fast!

A terminal application.
I use realterm:
If you use this app, The first thing you should do is ensure the following is ALWAYS SET.
Display tab - Select half duplex (this shows what you type, otherwise you'll have no idea)
Port tab - Parity = None, Data bits = 8, Stop bits = 1, Hardware flow control = None, Baud = 38400 (this is the baud rate that the HC-05 will operate on when in programming mode), Port = Select the port your USB-RS232-TTL device is installed as.
Send tab - In the "EOL" section ensure "CR" and "LF" are checked (this lets the HC-05 know when the command is finished, otherwise it will lock up and stop responding)
While in the "Send" tab, you will be typing your commands into the empty boxes on the left, And clicking "Send ASCII"

This thread was a huge help when doing this, But i found the information disjointed and confusing sifting through so many posts, I'm hoping i can give everyone a rocksolid "how to" To get this working.

Once you get your USB-TTL converter, Plug it into your PC. Ensure it installed correctly. If it does not, Fond and update the drivers. Ensure it is installed and recognized as a COM device.
Now unplug it, And connect the HC-05 to the header pins on the back:
HC-05 <> USB-TTL
VCC <> 5v
***********Insert picture***************
If you purchased the unit with the small tactile button, this is where you hold the button down. If not, you need to connect 5v to the "Key" header pin. If the breakout board does not have a Key header pine, you may be able to find a pinout for the HC-05 chip and sort it out that way.
While holding down the button, Plug the USB-TTL into the computer. The status led on the hc-05 will start a 2 second on-off cycle
Let the button go and launch your terminal application. Ensure the settings are correct. If using Realterm, set it up as instructed and get ready to send the following commands.
Follow the logic of the attached screenshot
***************Insert screen, Showing progress of setting blutooth name, Master/Slave, Board speed and password**************
When setting the blutooth name, the device will not reply with the name. To confirm the name you need to unplug the USB-TTL and (Do NOT hold the button on the HC-05) plug it back in. The device should booth and start blinking showing it is in search mode. Wait a few seconds then search using a blutooth device (such as a mobile phone) to see if the HC-05 appears. The default name is "HC-05"

For MS1 set board speed to 9600
For MS2 set board speed to 115200
Set blutooth name and a password (for example "My fully sick car")
Set to Slave

Now remove the HC-05 from the TTL device, Put it aside and mark it so you know it is the MS-ECU device. We will call it Slave.
Then if you got a second HC-05, connect it to the TTL
Re enter programming mode and
For MS1 set board speed to 9600 (for the Master, whatever you set the baud speed to here, Tuner studio must also be set to, so it is easiest to set it to the same as you MSecu version)
For MS2 set board speed to 115200 (for the Master, whatever you set the baud speed to here, Tuner studio must also be set to, so it is easiest to set it to the same as you MSecu version)
Set to Master
Set password, Use same password as before.
Set name (name can be anything, does not need to be same as before)
Your second hc-05 is now a dedicated MS-ECU communicator. Unplug it, and plug it back in (without holding the button) and it will boot into search mode.
Open Tuner studio and point it towards the COM port for the TTL device.

Now you need to get your hands dirty on the MSECU.
Get Your Slave HC-05. You need to solder it onto the board. It needs to go between the processor and the RS232 IC U6. Connect the following to the U6 IC on the MS board:
VCC <>Pin 16
Ground <>Pin 15
TX <> Pin 12
RX <> Pin 11

You should add a toggle switch to the VCC wire. So you can power down the bluetooth. You will need to power the bluetooth down to connect a serial connector to the DB9 on the megasquirt, so you can flash firmware, or if there is a problem with bluetooth. You cannot communicate with both DB9 and Bluetooth at the same time.

Now, power up the MS ecu.
If everything worked correctly, The master HC-05 (still plugged into your computer and powered up?) will connect to the HC-05 slave in less than 5 seconds, and tuner studio will start communicating with the megasquirt.

************ I'll add pictures and tidy this up later, It's bedtime ************************
*insert witty comment here*
User avatar
Helpful MS/Extra'er
Posts: 44
Joined: Sun Aug 20, 2006 9:35 pm

Return to Other Development

Who is online

Users browsing this forum: No registered users and 1 guest