OEM Bluetooth module Installation and Setup
#1
Senior Member
Thread Starter
iTrader: (7)
Join Date: Jul 2007
Location: Milpitas, CA
Posts: 1,047
Total Cats: 1
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
Introduction:
I'm starting this new thread for directions on installing an OEM bluetooth module for your engine management computer. Yes, this is not only for megasquirt, you can also use this on your adaptronic, hydra, whatever, but most people that buy those kind of engine managements try to avoid serious modifications to their board. For megasquirt users, this is a perfect way to set up wireless connection to your PC for engine monitoring and datalogging.
This is more geared towards those who are more technically inclined with soldering and the understanding of TLL, UART, and RS232 logic levels. Setting up the firmware is a tedious process, but the end result is VERY rewarding. It turned out to be a little more expensive than I originally planned, but this probably the best way to add bluetooth support, because it uses an external antenna (which is better than most Serial-BT adapters). I am excited for this project, and I hope that this information could be of use for you guys.
Use these search tags to look for something specific. I tagged what I thought was important to know:
Needed Parts------------------------------[NPARTS]
Module Installation-----------------------[MINSTALL]
Pins on the WT11 Module----------------[MPINS]
Final Connections to MS------------------[MFINAL]
External Antenna Installation-------------[INANT]
Firmware Setup---------------------------[MFIRM]
- Setting Baud Rate----------------------[MBAUD]
- Setting Up for Pairing------------------[MPAIR]
- Bypass for Serial Cable Use----------[URBPASS]
I'm starting this new thread for directions on installing an OEM bluetooth module for your engine management computer. Yes, this is not only for megasquirt, you can also use this on your adaptronic, hydra, whatever, but most people that buy those kind of engine managements try to avoid serious modifications to their board. For megasquirt users, this is a perfect way to set up wireless connection to your PC for engine monitoring and datalogging.
This is more geared towards those who are more technically inclined with soldering and the understanding of TLL, UART, and RS232 logic levels. Setting up the firmware is a tedious process, but the end result is VERY rewarding. It turned out to be a little more expensive than I originally planned, but this probably the best way to add bluetooth support, because it uses an external antenna (which is better than most Serial-BT adapters). I am excited for this project, and I hope that this information could be of use for you guys.
Use these search tags to look for something specific. I tagged what I thought was important to know:
Needed Parts------------------------------[NPARTS]
Module Installation-----------------------[MINSTALL]
Pins on the WT11 Module----------------[MPINS]
Final Connections to MS------------------[MFINAL]
External Antenna Installation-------------[INANT]
Firmware Setup---------------------------[MFIRM]
- Setting Baud Rate----------------------[MBAUD]
- Setting Up for Pairing------------------[MPAIR]
- Bypass for Serial Cable Use----------[URBPASS]
Last edited by Marc D; 09-28-2009 at 01:13 PM.
#2
Senior Member
Thread Starter
iTrader: (7)
Join Date: Jul 2007
Location: Milpitas, CA
Posts: 1,047
Total Cats: 1
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
Needed Parts/Supplies/Components for installation:
[NPARTS]
Ok, I have basically compiled all the stuff needed. I have discovered that it is possible to pass through UART connections through the bluetooth module transparently. NO DIP SWITCHES NEEDED!
2.4 ghz External Antenna - $4
3m RP-SMA extension wire - $2
U.FL antenna --> RP-SMA connector - $1
Bluetooth OEM style module with an External U.FL antenna adapter $36
TO-220 3.3V Voltage Regulator: $4
TLL --> RS232 Line converter - $10 - 17 (More details on the firmware section)
"NO" Type Push Button - $1-3
Electrical Tape or Kapton Tape to prevent shorts.
Double-sided tape for mounting
Connecting Wires
Optional:
Rosin flux for Easy soldering on the bluetooth module
Jumper wires and Jumper blocks for easy switching/removal of wires
Here are some pictures:
![](http://img32.imageshack.us/img32/3089/p1013571.jpg)
![](http://img32.imageshack.us/img32/2755/p1013568.jpg)
![](http://img32.imageshack.us/img32/1209/p1013569e.jpg)
![](http://img8.imageshack.us/img8/9923/p1013572.jpg)
I bought these fairly cheap through some HK bay vendors, but they will definitely do the job. Obviously the most expensive component was the bluetooth module itself, bought at semiconductorstore.com. You want to get the one with an external U.FL adapter since using an internal antenna is pointless, and the signals will just drop due to the lack of LoS (Line of Sight) and the metal barrier which encases the megasquirt.
If you are going to use the same module that I will be using, I will provide instructions on how to set up the firmware as well. If you do use the same module, please use the module WT11-E-Al3. This specific part has already upgraded firmware that will allow configuration Over-the-Air (OTA). In other words, you don't have to have a hard line to send firmware changes, which is a big plus. I unfortunately bought the wrong one, so I will need to upgrade the firmware, which is not a big deal, but it adds another step in firmware setup.
Now, If you notice, the bluetooth module is fairly small. You will need a steady hand when you solder the back of the module, but luckily it can laid flat while soldering. If you soldered up your own MS, then this should be cake. The unfortunate thing is that the module does not have provisions for a mounting point, as it was meant for a SMD application, but that can be alleviated with just using double tape on the MS board without having to worry about it flying everywhere in the MS case, not to mention its small size, so it can fit anywhere you have room. I am using abe's adapter board for my MSII, so I have plenty of room available since the opt and VR components were left out entirely. You may have to find another place to put your module if that area is populated. What I do recommend, is that if you MUST mount it to the side of your MS case, mount it where you can leave it without removing it, i,e, one of the side panels, or find some quick-disconnect plugs for components. Shouldn't be hard to find at fry's or something. For my build, I may use Jumper wires and jumper blocks, provided there is space on the protoboard section.
[NPARTS]
Ok, I have basically compiled all the stuff needed. I have discovered that it is possible to pass through UART connections through the bluetooth module transparently. NO DIP SWITCHES NEEDED!
2.4 ghz External Antenna - $4
3m RP-SMA extension wire - $2
U.FL antenna --> RP-SMA connector - $1
Bluetooth OEM style module with an External U.FL antenna adapter $36
TO-220 3.3V Voltage Regulator: $4
TLL --> RS232 Line converter - $10 - 17 (More details on the firmware section)
"NO" Type Push Button - $1-3
Electrical Tape or Kapton Tape to prevent shorts.
Double-sided tape for mounting
Connecting Wires
Optional:
Rosin flux for Easy soldering on the bluetooth module
Jumper wires and Jumper blocks for easy switching/removal of wires
Here are some pictures:
![](http://img32.imageshack.us/img32/3089/p1013571.jpg)
![](http://img32.imageshack.us/img32/2755/p1013568.jpg)
![](http://img32.imageshack.us/img32/1209/p1013569e.jpg)
![](http://img8.imageshack.us/img8/9923/p1013572.jpg)
I bought these fairly cheap through some HK bay vendors, but they will definitely do the job. Obviously the most expensive component was the bluetooth module itself, bought at semiconductorstore.com. You want to get the one with an external U.FL adapter since using an internal antenna is pointless, and the signals will just drop due to the lack of LoS (Line of Sight) and the metal barrier which encases the megasquirt.
If you are going to use the same module that I will be using, I will provide instructions on how to set up the firmware as well. If you do use the same module, please use the module WT11-E-Al3. This specific part has already upgraded firmware that will allow configuration Over-the-Air (OTA). In other words, you don't have to have a hard line to send firmware changes, which is a big plus. I unfortunately bought the wrong one, so I will need to upgrade the firmware, which is not a big deal, but it adds another step in firmware setup.
Now, If you notice, the bluetooth module is fairly small. You will need a steady hand when you solder the back of the module, but luckily it can laid flat while soldering. If you soldered up your own MS, then this should be cake. The unfortunate thing is that the module does not have provisions for a mounting point, as it was meant for a SMD application, but that can be alleviated with just using double tape on the MS board without having to worry about it flying everywhere in the MS case, not to mention its small size, so it can fit anywhere you have room. I am using abe's adapter board for my MSII, so I have plenty of room available since the opt and VR components were left out entirely. You may have to find another place to put your module if that area is populated. What I do recommend, is that if you MUST mount it to the side of your MS case, mount it where you can leave it without removing it, i,e, one of the side panels, or find some quick-disconnect plugs for components. Shouldn't be hard to find at fry's or something. For my build, I may use Jumper wires and jumper blocks, provided there is space on the protoboard section.
Last edited by Marc D; 09-28-2009 at 12:53 PM.
#3
Senior Member
Thread Starter
iTrader: (7)
Join Date: Jul 2007
Location: Milpitas, CA
Posts: 1,047
Total Cats: 1
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
Installation/Modifications for the MS Board:
[MINSTALL]
Ok, it's about time I have some guidelines for you to follow for those who are still watching this. So far I have only text, I gotta get some images of this tutorial.
Here is a picture of the module's pins. I have left the important ones which we will be using, and I removed the unimportant ones for our specific use.
![](http://img8.imageshack.us/img8/6186/68501544.jpg)
This is mainly for reference - The communication Schematic for the MS.
![](http://img18.imageshack.us/img18/8947/msdb9pinstomax232.jpg)
Pins on the module:
[MPINS]
VDD - These Pins require 3.3Vs, and have a tolerance of around 2.9V to 3.6V. Do NOT use 5Vs, you could possibly damage it. Use a 3.3V regulator TO-220 to give 3.3V.
GND - Obviously the Ground pins. Use these Pins and ground them onto the MS board.
RXD - This is the "Receive" UART connection. Connect the TX pin from the MS processor to this pin.
TXD - This is the "Transfer" UART connection. Connect this Pin to the RX pin on the MS Processor.
NRTS - This is for hardware flow control. Although this will not be used when it is finally connected to the MS, it will be used momentarily for firmware set up. Connect this pin to the RTS line on the DB9 converter
NCTS - Same concept as the NRTS. Connect this to the CTS line on the DB9 converter.
RES - This is the physical reset pin for the module. When you want to disable the UART bypass to allow you to use wireless connectivity, you need to give a physical reset to the module to wipe the UARTbypass command. In order to reset, you need to hold the line high for about 200ms. To do this, attach a 3.3V reference to a "NO" push button. Attach the button to the RES Pin, then you can mount this button anywhere you wish. For simplicity, you can just mount it on the MS box, but mount it on an area that is less prone to being hit, i.e. Underneath the DB37 connector.
The Following Pins will be used for the UART Bypass mechanism. This will allow you to hook up bot the module and the MAX232 together. A simple command to the module will allow you to switch back and forth between using the cable and using the bluetooth module.
PIO4 - This is the bypass pin for an Incoming TX line. Connect this Line to Pin 12 (R1OUT) pin on the MAX232 Chip.
PIO5 - This is the bypass pin for an Incoming RTS line. Wont be used since MS does not have hardware control properties
PIO6 - This is the bypass pin for an incoming CTS Line. Wont be used since MS does not have hardware control.
PIO7 - This is the bypass pin for an Outgoing TX line from the MS processor. Connect this pin to pin 11 (T1In) on the MAX232 chip.
TIPS: It will make your life easy if you have a stim handy to power your board. I have one, but think i fried my stim by using a bad power source. if you are keeping your wires short, be sure that the module or any wiring doesn't short the board
Installing the module
Set up for firmware implementation:
First, you need to have a 3.3V source. Attach the 3.3V to the VDD pins for power to the module.
Next, Attach the GND pins to the Grounds on the MS. Should be no problem to do.
After you add the grounds, connect the RXD, TXD, NRTS, and NCTS lines to a separate MAX3232 line level converter. I am using this converter I bought online for 11 bucks on bay:
![](http://img38.imageshack.us/img38/5796/152127750o.jpg)
You will need to connect the same 3.3V reference to the MAX3232 board, and grounds to the appropriate locations.
Connect the DB9 from the line converter and set up your firmware following the next post. After you have set that up, return here.
Final Connections:
[MFINAL]
After you have set up your firmware, its time you finally install the damn thing.
First, you need to sever the TX and RX traces on the MS board itself. This requires you to use an exacto knife, or anything sharp. Be careful when going this, and don't cut too deep. For reference, taken from the DIY site:
![](http://img101.imageshack.us/img101/8092/pcb30.jpg)
Connect the TX line to the RXD pin on the module. Then connect the RX line to the TXD pin on the module.
Connect the PIO7 Pin to pin 11 (T1In) on the MAX232 chip. Connect PIO4 to Pin 12 (R1OUT) pin on the MAX232 Chip.
Since the megasquirt does not have any hardware control mechanism, the NCTS must be grounded and the NRTS pin must be left untouched.
[INANT]
Use a U.FL antenna converter to the plug style of your choice. I am using RP-SMA. Drill a hole for the antenna port to mount your antenna externally. Use a 6.3mm or a 1/4" drill bit to drill your MS box, if you are using an RP-SMA connector.
Connect an external antenna, or an extension cable to an area of your choice for the best Line of Sight.
And that's all you need to do to install it. Just make sure there's nothing shorted before you try and start it up.
Pictures of the install will be up soon.
[MINSTALL]
Ok, it's about time I have some guidelines for you to follow for those who are still watching this. So far I have only text, I gotta get some images of this tutorial.
Here is a picture of the module's pins. I have left the important ones which we will be using, and I removed the unimportant ones for our specific use.
![](http://img8.imageshack.us/img8/6186/68501544.jpg)
This is mainly for reference - The communication Schematic for the MS.
![](http://img18.imageshack.us/img18/8947/msdb9pinstomax232.jpg)
Pins on the module:
[MPINS]
VDD - These Pins require 3.3Vs, and have a tolerance of around 2.9V to 3.6V. Do NOT use 5Vs, you could possibly damage it. Use a 3.3V regulator TO-220 to give 3.3V.
GND - Obviously the Ground pins. Use these Pins and ground them onto the MS board.
RXD - This is the "Receive" UART connection. Connect the TX pin from the MS processor to this pin.
TXD - This is the "Transfer" UART connection. Connect this Pin to the RX pin on the MS Processor.
NRTS - This is for hardware flow control. Although this will not be used when it is finally connected to the MS, it will be used momentarily for firmware set up. Connect this pin to the RTS line on the DB9 converter
NCTS - Same concept as the NRTS. Connect this to the CTS line on the DB9 converter.
RES - This is the physical reset pin for the module. When you want to disable the UART bypass to allow you to use wireless connectivity, you need to give a physical reset to the module to wipe the UARTbypass command. In order to reset, you need to hold the line high for about 200ms. To do this, attach a 3.3V reference to a "NO" push button. Attach the button to the RES Pin, then you can mount this button anywhere you wish. For simplicity, you can just mount it on the MS box, but mount it on an area that is less prone to being hit, i.e. Underneath the DB37 connector.
The Following Pins will be used for the UART Bypass mechanism. This will allow you to hook up bot the module and the MAX232 together. A simple command to the module will allow you to switch back and forth between using the cable and using the bluetooth module.
PIO4 - This is the bypass pin for an Incoming TX line. Connect this Line to Pin 12 (R1OUT) pin on the MAX232 Chip.
PIO5 - This is the bypass pin for an Incoming RTS line. Wont be used since MS does not have hardware control properties
PIO6 - This is the bypass pin for an incoming CTS Line. Wont be used since MS does not have hardware control.
PIO7 - This is the bypass pin for an Outgoing TX line from the MS processor. Connect this pin to pin 11 (T1In) on the MAX232 chip.
TIPS: It will make your life easy if you have a stim handy to power your board. I have one, but think i fried my stim by using a bad power source. if you are keeping your wires short, be sure that the module or any wiring doesn't short the board
Installing the module
Set up for firmware implementation:
First, you need to have a 3.3V source. Attach the 3.3V to the VDD pins for power to the module.
Next, Attach the GND pins to the Grounds on the MS. Should be no problem to do.
After you add the grounds, connect the RXD, TXD, NRTS, and NCTS lines to a separate MAX3232 line level converter. I am using this converter I bought online for 11 bucks on bay:
![](http://img38.imageshack.us/img38/5796/152127750o.jpg)
You will need to connect the same 3.3V reference to the MAX3232 board, and grounds to the appropriate locations.
Connect the DB9 from the line converter and set up your firmware following the next post. After you have set that up, return here.
Final Connections:
[MFINAL]
After you have set up your firmware, its time you finally install the damn thing.
First, you need to sever the TX and RX traces on the MS board itself. This requires you to use an exacto knife, or anything sharp. Be careful when going this, and don't cut too deep. For reference, taken from the DIY site:
![](http://img101.imageshack.us/img101/8092/pcb30.jpg)
Connect the TX line to the RXD pin on the module. Then connect the RX line to the TXD pin on the module.
Connect the PIO7 Pin to pin 11 (T1In) on the MAX232 chip. Connect PIO4 to Pin 12 (R1OUT) pin on the MAX232 Chip.
Since the megasquirt does not have any hardware control mechanism, the NCTS must be grounded and the NRTS pin must be left untouched.
[INANT]
Use a U.FL antenna converter to the plug style of your choice. I am using RP-SMA. Drill a hole for the antenna port to mount your antenna externally. Use a 6.3mm or a 1/4" drill bit to drill your MS box, if you are using an RP-SMA connector.
Connect an external antenna, or an extension cable to an area of your choice for the best Line of Sight.
And that's all you need to do to install it. Just make sure there's nothing shorted before you try and start it up.
Pictures of the install will be up soon.
Last edited by Marc D; 09-28-2009 at 12:58 PM.
#4
Senior Member
Thread Starter
iTrader: (7)
Join Date: Jul 2007
Location: Milpitas, CA
Posts: 1,047
Total Cats: 1
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
WT11-E-Al3 Firmware Setup:
[MFIRM]
Most of the setup will be done using HyperTerm, or any other communication application similar to HyperTerm. Windows 7 users will need to find HyperTerm online, as the windows software is no longer bundled with it.
First of all, the module needs to be set up to work with bluetooth correctly, and we need to set it up so it uses a Serial Port Profile setting (SPP) which basically tells the module to act like an invisible serial cable. We also need to set up the module to connect with our computer, and there are two ways to do this. One, you can set it up so it pair's with your computer once it turns on, or you can make it pair up with your computer by selecting it on your computer itself.
Unfortunately, we can't do these wirelessly yet, therefore we need to connect the module to the computer through a hardline. This will require a separate TLL-RS232 converter that works at 3.3V logic levels. For this purpose, a MAX3232 (not MAX232) logic 3V/5V converter to RS232 signaling serial converter will be required for the first time connection and set up. The MAX232 chip on the MS uses TLL signalling at 5V, so it cannot be used to set up the module. Would have been nice though if it could. Even if you socketed the MAX232 chip (like I did) you still cannot use the chip since the board supplies the MAX chip with 5V. It needs 3.3V to work properly. You COULD bend the lead for the MAX3232 chip and add the 3.3V that way but its much easier to have a separate board for something like this.
![](http://img38.imageshack.us/img38/5796/152127750o.jpg)
Example of a TLL 3V/5V converter to a RS232 signal. It's the same picture posted above. The chip should be a MAX3232 chip though, not the one pictured.
I bought this on ebay for about 12 bucks. It's better than building your own IMO, as its pretty hard to find a MAX3232 chip locally. You can buy it online at other retailers, but you'll be paying up the *** for a separate breadboard and shipping, and buying all those capacitors and DB9 connector separately. For the convenience, this is perfect.
After you set the firmware up, you will no longer need this part as you can send settings through bluetooth as well. In order to install this properly, you need to set up the module's firmware properly, and this can only be done through a HARD LINE, until you activate certain settings on the module to allow wireless parameter setting.
One more side note: I do recommend you set the firmware up FIRST before you install it permanently. It will make it easier for you.
Ok, after you set up the TLL-->RS232 line converter, connect it to your computer, and open up HyperTerm. If you are using a mac, use ZTerm, a free download online. If it works correctly, you should see it showing up as ready to use, giving a response that says "READY"
If you want to see what you type onto the HyperTerm prompt, make sure you choose the settings under properties, ASCII settings, and select "Echo."
To verify that the bluetooth module is working, in HyperTerm/ZTerm, type "AT" and you should get a response from the module that says "OK"
--------------
The bluetooth module has two modes: A command mode and a data mode.
By default, obviously, when the bluetooth is not connected to another device, it is set in command mode. This mode you may enter the syntax commands that follow at this time.
If your module is connected to another device wirelessly, the module will be in data mode, and no commands can be given.
To switch back and forth between the modes, you can forcefully change them by typing an "escape sequence code." The escape command is a code that is always read, so you can enter it in either mode to switch modes. If you are in data mode and connected, if you enter the escape sequence to enter command mode, all connections will be dropped and the module will enter command mode.
By default, the "escape sequence" is typing "+" three times. You enter it in the HyperTerm Prompt when connected to the module.
I dunno wtf they mean by 1 second sleep though, they make the manual so hard to understand for something so simple.
--------------
The first firmware profile we need to set up is the Over-the-Air (OTA) Profile.
This will allow wireless access to the bluetooth modules parameter settings. You activate it by the following command:
For example:
This allows you to pair with the module using your computer, the discoverable device showing up as "Bluegiga iWRAP." After this is done, you may as well finish the installation of the module itself because a hardline is no longer required to set up the module. When paired up, if you try to access the module via HyperTerm, it will ask for the password you specify. If you put the wrong password, the connection will close. Since you are already connected to the hard line, you might as well set up the rest of the firmware through here, then after you disconnect the hardlines, just use bluetooth to change the settings when needed.
-----------------
The next step, you need to determine the Bluetooth Address of your bluetooth dongle, adapter, whatever. You can find it by looking up your adapter properties. On Macs, you can find the information in the "About this Mac --> More info" or the System Profiler (which is the same thing).
You can also search for discoverable devices using a "INQUIRY" Syntax code which will list the available bluetooth connections.
Use the following Syntax code:
The code will respond with the Bluetooth addresses found in the area, class of the device, and the name. Make sure your computer's bluetooth is "Discoverable"
--------------
Setup the Profiles to Use for the Module
Use these Syntax codes on HyperTerm:
Example:
This will activate the Serial Port Profile on the module, for data transfer over UART connections.
It's best to deactivate all other profiles and leave only the SPP, and OTA profile active.
Use the Following Syntax Codes to do this:
Leaving the {name} parameter off will turn off each of those profiles.
----------------
Setup the Bluetooth module's Name
Use this syntax code on HyperTerm:
For example:
When you try to Pair with the device, this is the name that will show up as discovered, it just makes the device easy to identify.
------------
Setup the Bluetooth module for maximum power.
Use this syntax code on HyperTerm:
This will setup the bluetooth module to use maximum power. The only time you would want to limit something like this is if it is run on battery power. The module has a constant power source, so it is ideal to set it the maximum power for the best range possible.
------------
Setting up the Bluetooth Module Speed/Baud Rate
[MBAUD]
Use this Syntax code in Hyper Term:
For megasquirt setups:
(For MSII, use 115200)
Pretty self explanatory. Set your communication speed through this. Megasquirt-II Users don't need to set this because the default is already set as 115200.
------------
Setting up for pairing and communications - I had to wait several days for a response from the tech support on setting this up properly for our setup, and I finally have it. Here it is.
Use this Syntax code in HyperTerm:
This will allow pairing to occur using Authorization codes to prevent unauthorized connections to your Bluetooth module, unless you don’t care if someone else messes with your settings (highly unlikely though). This also activates a "PAIR" Indicator, which signifies a successful pairing. Also, when you use an "INQUIRY" command to see the visible bluetooth devices, their signal strength is displayed.
----------------
Setting up the Bluetooth module's discovery settings
Use this syntax code in HyperTerm:
This setting makes the module visible and available for connections at all times, and when it is connected with a device it is no longer detected until the current connection is cut.
-----------------
Pair up the Bluetooth Module with the Tuning Computer
[MPAIR]
For this to work correctly, Interactive Pairing MUST BE SET. This is set using the SET CONTROL CONFIG parameter. To also signify that a pairing event was successful, you need to activate it in the SET CONTROL CONFIG parameter as well.
From your tuning computer, search for the bluetooth module's Name that you set earlier with the SET BT NAME command.
When you find this, attempt to pair with the device from your computer. Usually when you attempt to pair a bluetooth device, a PIN number is given from the computer, and the BT device needs to type in the specific PIN number to establish the connection.
On the HyperTerm Prompt, when you attempt to connect with the bluetooth module, you will get an event that says something similar to this:
When this appears you key in the following:
The pin number is the one specified by the computer to successfully pair.
If you have the "PAIR" event enabled, you will see a response similar to this:
From this point, the pairing is stored in flash memory, and it is no longer required to work with the HyperTerm prompt, unless you want to change some settings.
Other way:
You can initiate the connection from the module itself by using the CALL syntax command, but first, you need to set the PIN number to connect the bluetooth module. This PIN number is entered on the computer instead.
Setting the PIN number on the module
Use the following syntax code:
This will set the PIN number to allow pairing to the computer. You would enter this in the computer when it prompts you for a PIN number for pairing.
To initiate the connection, use this Syntax Code:
If your module is already paired, you do not need to do authorization codes anymore, and it automatically connects.
If you would like your Megasquirt computer to constantly use the "call command," you can set it by using the following syntax code:
If you do this, you should not send the "Call command" manually anymore. Using the "autocall" command will force the module to keep "calling" any paired devices and try to connect when its on. This is particularly useful if you don't want to select the device manually on the computer. Also, if your connection drops, the module will attempt to reconnect to the computer.
---------------
Passing through UART connections to the Megasquirt for regular serial cable use.
[URBPASS]
Use this Syntax code:
This is a VERY AWESOME feature. What this does forces the UART serial connections through the controller transparently, as if it wasnt there. This will allow you to use a serial cable when you need to do some important flash/burning of data. When in Bypass mode, the module is forced into a deep sleep, and you cannot communicate with the bluetooth module. The schematic on how this works is posted on the hardware installation instructions.
In order to revert back to using the wireless module a HARD PHYSICAL RESET IS REQUIRED. This is the reason for the push button installation for the reset button. To reset, hold the button down about 200ms and the module should revert back to the state before it was given the Bypass UART command.
If you got this all squared out, head back to the post above this one to finalize the installation.
[MFIRM]
Most of the setup will be done using HyperTerm, or any other communication application similar to HyperTerm. Windows 7 users will need to find HyperTerm online, as the windows software is no longer bundled with it.
First of all, the module needs to be set up to work with bluetooth correctly, and we need to set it up so it uses a Serial Port Profile setting (SPP) which basically tells the module to act like an invisible serial cable. We also need to set up the module to connect with our computer, and there are two ways to do this. One, you can set it up so it pair's with your computer once it turns on, or you can make it pair up with your computer by selecting it on your computer itself.
Unfortunately, we can't do these wirelessly yet, therefore we need to connect the module to the computer through a hardline. This will require a separate TLL-RS232 converter that works at 3.3V logic levels. For this purpose, a MAX3232 (not MAX232) logic 3V/5V converter to RS232 signaling serial converter will be required for the first time connection and set up. The MAX232 chip on the MS uses TLL signalling at 5V, so it cannot be used to set up the module. Would have been nice though if it could. Even if you socketed the MAX232 chip (like I did) you still cannot use the chip since the board supplies the MAX chip with 5V. It needs 3.3V to work properly. You COULD bend the lead for the MAX3232 chip and add the 3.3V that way but its much easier to have a separate board for something like this.
![](http://img38.imageshack.us/img38/5796/152127750o.jpg)
Example of a TLL 3V/5V converter to a RS232 signal. It's the same picture posted above. The chip should be a MAX3232 chip though, not the one pictured.
I bought this on ebay for about 12 bucks. It's better than building your own IMO, as its pretty hard to find a MAX3232 chip locally. You can buy it online at other retailers, but you'll be paying up the *** for a separate breadboard and shipping, and buying all those capacitors and DB9 connector separately. For the convenience, this is perfect.
After you set the firmware up, you will no longer need this part as you can send settings through bluetooth as well. In order to install this properly, you need to set up the module's firmware properly, and this can only be done through a HARD LINE, until you activate certain settings on the module to allow wireless parameter setting.
One more side note: I do recommend you set the firmware up FIRST before you install it permanently. It will make it easier for you.
Ok, after you set up the TLL-->RS232 line converter, connect it to your computer, and open up HyperTerm. If you are using a mac, use ZTerm, a free download online. If it works correctly, you should see it showing up as ready to use, giving a response that says "READY"
If you want to see what you type onto the HyperTerm prompt, make sure you choose the settings under properties, ASCII settings, and select "Echo."
To verify that the bluetooth module is working, in HyperTerm/ZTerm, type "AT" and you should get a response from the module that says "OK"
--------------
The bluetooth module has two modes: A command mode and a data mode.
By default, obviously, when the bluetooth is not connected to another device, it is set in command mode. This mode you may enter the syntax commands that follow at this time.
If your module is connected to another device wirelessly, the module will be in data mode, and no commands can be given.
To switch back and forth between the modes, you can forcefully change them by typing an "escape sequence code." The escape command is a code that is always read, so you can enter it in either mode to switch modes. If you are in data mode and connected, if you enter the escape sequence to enter command mode, all connections will be dropped and the module will enter command mode.
By default, the "escape sequence" is typing "+" three times. You enter it in the HyperTerm Prompt when connected to the module.
Code:
< 1 second sleep> +++ < 1 second sleep>
--------------
The first firmware profile we need to set up is the Over-the-Air (OTA) Profile.
This will allow wireless access to the bluetooth modules parameter settings. You activate it by the following command:
Code:
SET PROFILE OTA {Password of Choice}
Code:
SET PROFILE OTA Megasquirt
-----------------
The next step, you need to determine the Bluetooth Address of your bluetooth dongle, adapter, whatever. You can find it by looking up your adapter properties. On Macs, you can find the information in the "About this Mac --> More info" or the System Profiler (which is the same thing).
You can also search for discoverable devices using a "INQUIRY" Syntax code which will list the available bluetooth connections.
Use the following Syntax code:
Code:
INQUIRY 4 NAME
--------------
Setup the Profiles to Use for the Module
Use these Syntax codes on HyperTerm:
Code:
SET PROFILE SPP {name}
Code:
SET PROFILE SPP Megasquirt-CPU
It's best to deactivate all other profiles and leave only the SPP, and OTA profile active.
Use the Following Syntax Codes to do this:
Code:
SET PROFILE HFP SET PROFILE HFP-AG SET PROFILE OPP SET PROFILE A2DP SINK SET PROFILE A2DP SOURCE SET PROFILE HID
----------------
Setup the Bluetooth module's Name
Use this syntax code on HyperTerm:
Code:
SET BT NAME {Name of Choice}
Code:
SET BT NAME MegasquirtII-Miata
------------
Setup the Bluetooth module for maximum power.
Use this syntax code on HyperTerm:
Code:
SET BT POWER 20 20 0
------------
Setting up the Bluetooth Module Speed/Baud Rate
[MBAUD]
Use this Syntax code in Hyper Term:
Code:
SET CONTROL BAUD {baud rate},8{parity}{stop bits}
Code:
SET CONTROL BAUD 9600,8N1
Pretty self explanatory. Set your communication speed through this. Megasquirt-II Users don't need to set this because the default is already set as 115200.
------------
Setting up for pairing and communications - I had to wait several days for a response from the tech support on setting this up properly for our setup, and I finally have it. Here it is.
Use this Syntax code in HyperTerm:
Code:
SET CONTROL CONFIG 881
----------------
Setting up the Bluetooth module's discovery settings
Use this syntax code in HyperTerm:
Code:
SET BT PAGEMODE 4 5000 0
-----------------
Pair up the Bluetooth Module with the Tuning Computer
[MPAIR]
For this to work correctly, Interactive Pairing MUST BE SET. This is set using the SET CONTROL CONFIG parameter. To also signify that a pairing event was successful, you need to activate it in the SET CONTROL CONFIG parameter as well.
From your tuning computer, search for the bluetooth module's Name that you set earlier with the SET BT NAME command.
When you find this, attempt to pair with the device from your computer. Usually when you attempt to pair a bluetooth device, a PIN number is given from the computer, and the BT device needs to type in the specific PIN number to establish the connection.
On the HyperTerm Prompt, when you attempt to connect with the bluetooth module, you will get an event that says something similar to this:
Code:
AUTH {bluetooth address}?
Code:
AUTH {same bluetooth address as above} {PIN number}
If you have the "PAIR" event enabled, you will see a response similar to this:
Code:
PAIR {Bluetooth Address} {Code}
Other way:
You can initiate the connection from the module itself by using the CALL syntax command, but first, you need to set the PIN number to connect the bluetooth module. This PIN number is entered on the computer instead.
Setting the PIN number on the module
Use the following syntax code:
Code:
SET BT AUTH * {PIN code of choice}
To initiate the connection, use this Syntax Code:
Code:
CALL {Bluetooth Address of computer} 1101 RFCOMM
If you would like your Megasquirt computer to constantly use the "call command," you can set it by using the following syntax code:
Code:
SET CONTROL AUTOCALL 1101 5000 RFCOMM
---------------
Passing through UART connections to the Megasquirt for regular serial cable use.
[URBPASS]
Use this Syntax code:
Code:
BYPASSUART
In order to revert back to using the wireless module a HARD PHYSICAL RESET IS REQUIRED. This is the reason for the push button installation for the reset button. To reset, hold the button down about 200ms and the module should revert back to the state before it was given the Bypass UART command.
If you got this all squared out, head back to the post above this one to finalize the installation.
Last edited by Marc D; 09-28-2009 at 01:01 PM.
#6
2 Props,3 Dildos,& 1 Cat
![](/mt2011/images_td/ranks/supporter1.gif)
![](/mt2011/images_td/ranks/smod.png)
iTrader: (8)
Join Date: Jun 2005
Location: Fake Virginia
Posts: 19,338
Total Cats: 573
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
nice. I picked up a bluesmirf module a while back to try this. Never got around to building the max232 circuit (i got them as samples from maxim-- free!) but I did use it on my roomba which doesn't need the max232.
incidentally, there are bluetooth serial adapters on the market... some as low as $60...
incidentally, there are bluetooth serial adapters on the market... some as low as $60...
#7
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
Like this one
Works, but not over great distance, only a couple of meters. Still better than a cable though.
Works, but not over great distance, only a couple of meters. Still better than a cable though.
#8
Senior Member
Thread Starter
iTrader: (7)
Join Date: Jul 2007
Location: Milpitas, CA
Posts: 1,047
Total Cats: 1
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
Yea, I know that those bluetooth serial adapters work, but keep in mind the limited range it gives. It's also located and attached right on the megasquirt, which is probably located somewhere nice and hidden. This mod allows you to use an external antenna which will provide LoS, giving you maximum range from inside AND outside the car! I plan to mount my antenna on the A-pillar of my car, but all that is up to you, wherever you want to put it.
This mod is not specifically for megasquirts only, it can be used with any engine management, providing that you want to hack up the board to make it work. At first, I was worried about the MAX232 chip interfering with the signal the microprocessor puts out, but with the use of DIP switches, that problem is alleviated.
y8s, you can probably use this tutorial to set up your BT, but I don't know how you would attach the module into that adaptronic. you COULD make that RS232 circuit and make a small box for it, then just attach it to the outside DB9 connector. That way would probably be the easiest way to do it, but that defeats the purpose of having it internally. Our NB's need less crap hanging around under our dash board ^_^ Setting up the firmware would be on you though; I have already read through the manual numerous times and I'm just figuring out which of the settings will need to be set, and which are unnecessary. 211 Pages is a lot to read ^_^
Frank, those modules you posted are only class 2 :(. It would be nice if they were class 1, because if it was, I would have probably gone that route for simplicity, but i still think about having dongle hanging around up there. There still a chance it could be damaged from just moving around there. An internal module leaves a small footprint!
EDIT: Nevermind, i was looking at another module. That module is a class 1. Oh well, well see how this little project goes. The price for those are pretty outrageous though. +$80
This mod is not specifically for megasquirts only, it can be used with any engine management, providing that you want to hack up the board to make it work. At first, I was worried about the MAX232 chip interfering with the signal the microprocessor puts out, but with the use of DIP switches, that problem is alleviated.
y8s, you can probably use this tutorial to set up your BT, but I don't know how you would attach the module into that adaptronic. you COULD make that RS232 circuit and make a small box for it, then just attach it to the outside DB9 connector. That way would probably be the easiest way to do it, but that defeats the purpose of having it internally. Our NB's need less crap hanging around under our dash board ^_^ Setting up the firmware would be on you though; I have already read through the manual numerous times and I'm just figuring out which of the settings will need to be set, and which are unnecessary. 211 Pages is a lot to read ^_^
Frank, those modules you posted are only class 2 :(. It would be nice if they were class 1, because if it was, I would have probably gone that route for simplicity, but i still think about having dongle hanging around up there. There still a chance it could be damaged from just moving around there. An internal module leaves a small footprint!
EDIT: Nevermind, i was looking at another module. That module is a class 1. Oh well, well see how this little project goes. The price for those are pretty outrageous though. +$80
#10
Senior Member
Thread Starter
iTrader: (7)
Join Date: Jul 2007
Location: Milpitas, CA
Posts: 1,047
Total Cats: 1
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
After talking with tech support, It seems we have a definite way of setting up the module. The coolest feature about the module is that you can connect both the MS processor and the MAX232 chip to the pins on the module, and then when you want to use a serial cable for important settings, you simply give a command and it will by pass the module entirely.
#12
Senior Member
Thread Starter
iTrader: (7)
Join Date: Jul 2007
Location: Milpitas, CA
Posts: 1,047
Total Cats: 1
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
Whats wrong with the bluetooth module you are using? Does it seem to drop out a lot?
I talked to keith over at the msextra forums, and he had some issues with the BT-SMiRF module, but he somewhat figured or resolved it doing a number of things. Its under the "Extra Development" sub section and the topic should be prettty recent.
When I do have the module up and running, im going to update this post
#14
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
A quick update. I've been using the Viliv S5 for a couple of months now and I haven't had a single dropout. There must have been a problem with my old laptop.
I can burn a msq without any problem. What doesn't work is an update of the firmware. The dos batch file does not see the com port, so I do firmware updates with the serial cable. This probably is the safer way anyway.
I have a 15-20ft range with stable connection. With the car in the garage, I can play with TS while being in the next room (door open in between).
I'm also using Dropbox. I cannot say enough how much I like dropbox. I have my TS project (and the datalogs) in my dropbox so each time I close TS, my project is automatically synchronised on all my pc's (wireless connection). I play with MLV and TS at work / home, and when I turn on the laptop in the car (with wireless connection of course), the settings are automatically updated again. Startup TS, turn on ignition, accept the difference report to upload and done. Very very cool.
Nice thing about the Viliv is that it has gprs, so I can even update while driving![](https://www.miataturbo.net/images/smilies/smile.gif)
Blatant advertising for Dropbox. Click here to join using my referral and you (and I
) get 250MB storage on top of the free 2G.
I can burn a msq without any problem. What doesn't work is an update of the firmware. The dos batch file does not see the com port, so I do firmware updates with the serial cable. This probably is the safer way anyway.
I have a 15-20ft range with stable connection. With the car in the garage, I can play with TS while being in the next room (door open in between).
I'm also using Dropbox. I cannot say enough how much I like dropbox. I have my TS project (and the datalogs) in my dropbox so each time I close TS, my project is automatically synchronised on all my pc's (wireless connection). I play with MLV and TS at work / home, and when I turn on the laptop in the car (with wireless connection of course), the settings are automatically updated again. Startup TS, turn on ignition, accept the difference report to upload and done. Very very cool.
Nice thing about the Viliv is that it has gprs, so I can even update while driving
![](https://www.miataturbo.net/images/smilies/smile.gif)
Blatant advertising for Dropbox. Click here to join using my referral and you (and I
![](https://www.miataturbo.net/images/smilies/smile.gif)
Thread
Thread Starter
Forum
Replies
Last Post
stoves
Suspension, Brakes, Drivetrain
5
04-21-2016 03:00 PM