My recent activities have been working on a wireless connection to my Megasquirt. Here are the gory details:
How I Bluetooth’d My Megasquirt Using Locost Philosophy (SORRY FOR THE LONG POST)So far I have been using a serial to USB adapter cable for tuning the Megasquirt. Although this works well, it is a nuisance to connect the cable under the dash. Once connected, the cable is in an awkward location on my laptop and gets in the way while tuning and driving. I feel that at some times, the cable will rip the connector off in my laptop and then I’ll be in deep $ # ! T
I looked for other alternatives. Bluetooth was the natural choice. According to the MS manual, their only suggestion was to use an RS232 to Bluetooth adapter made by SOCKET. This alternative is not very Locost at $100 to $150. Being from the electronic business, I was looking for something more integrated. There are a lot of serial-Bluetooth modules available for under $8 on eBay. Most of these include a PCB mounted antenna and require a 3.3V TTL signal source. While it sounds do-able, 1) the antenna would be inside the shielded chassis and the signal would not be able to get outside; 2) it would require the removal of the MAX323x signal level converter inside the MS. This would eliminate any chance of future cable connection; and 3) would require the addition of a 3.3V regulator.
I came across one module that appeared to have everything I wanted in an adapter. It was a RS232-bluetooth adapter with true RS232 level input and output. It uses one of the above mentioned modules soldered to a second adapter board to implement a few other features. It required 5V external power (I can eventually get that directly from the MS). It had an onboard 5v-3.3V regulator. And most importantly, it had a DB9 male and DB9 female adapter. It is roughly 1.25” wide and 2.5” long. Presumably, this should plug into the MS’s serial port and just hang out there in space. I just had to try it.
Attachment:
as purchased.JPG
I purchased this adapter from the seller in China for around $14 delivered. In 2 weeks, I had the unit at my doorstep. As received, many of the DB9 connector pins were not soldered to the PCB. I took care of that in quick order. Now was time to test it out. Needless to say, any reasonable facsimile to a user manual or instruction sheet was non-existent. I managed to find some quasi-documentation to other similar products on-line. In order to talk to this module using Hyperterm, a freeware communication program, I had to temporarily connect 5V to the module for it to have any power. A battery holder with 4 AAA cells and a few jumper wires were put to service. I had to jumper one of the ports on the module to +3.3V to set the module into command mode. This required the removal of the heat shrink sleeving. I jumpered a resistor to the appropriate pins and went to town. Now is when I have to admit, while I am good at electronic things in general, I’m not well versed in terminal programs. Trying to get my laptop connected to the serial port required the USB-serial adapter cable. It has been years since a laptop had a real serial port! I had been using this cable with the MS so I didn’t have to purchase anything new. No matter what I tried, I could not get any communications going. I tried several baud rates, I/O configurations, null modem cables and such. All to no avail. I checked the voltage level on the previously jumpered pin. It was not very high at around 1.7V. I don’t know what the chip needs. SO I shorted out the resistor taking that port directly to 3.3V. Still nothing.
Attachment:
setup jumper.JPG
I have to admit that some, if not most of the problem was me trying to micro analyze the communication thing. Since I was talking thru a USB-Serial adapter, my brain was going in circles. So I got out my old desktop with a true serial port and plugged directly into the desktop’s serial port. Powered up Hyperterm and adjusted a few of Hyperterm’s parameters. BINGO! I enter “AT” in Hyperterm and the module responds “OK”. NOW I’m talking to the module!
I managed to change the default 9600 baud to the 115,200 required for the MS communication. I entered “AT+BAUD8”. It responded: “OK115200”. But I am still sans anything closely related to a manual. I cannot follow all the pin assignments on the DB9M connecter, the one that will go to the MS. Pin 1 and 9 get powered from the MS with +5V. I can see that pin 1 on the BT board is not connected to anything. But pin 9 is and goes somewhere ……..I don’t know. I contacted the seller and he sent me a manual for my unit (presumably). Upon inspection, it is for a different RS-232/bluetooth adapter. It is close on everything except my 2 DB9 connectors are replaced with a single row header. This won’t help me at all.
I need to find out how to safely bring 5V into this module.
I removed the jumper I had added earlier during the setup of the module. I lifted pins#6, 7, 8 & 9 off the pcb and added an insulator to prevent an accidental short. I also added a jumper from DB9M-pin9 to the 5V node on the PCB. I now get powered from the MS2 when plugged into the communication port. I removed the extra DB9F connector since it will not be used in my application. Then I wrapped it all up in a heatshrink sleeving.
Attachment:
5V jumper-removed DBF.JPG
The first effort to check it all out on the car was a bust. I could establish Bluetooth connection to the module but not communicate with the MS. Something must be wrong. So I took it out and tried several things to communicate with my Desktop computer. Nothing. I then found out that some other program had latched on to the serial port of the computer. Once that program was stopped, communications started up again, only at 9600 baud. Somehow I had set it to the 9600 baud rate. "AT" sent- responded with "OK" Trying to do some AT additional commands proved faulty. Once the first AT was entered, it immediately responded OK. I couldn’t get past the AT, all commands start with AT and then more characters. More research and I found the answer. Enter the full command into Notepad. Then copy paste into Hyperterm. It seems that the unit needs to see the full command in less than a second. I can’t type that fast. Copy/Paste gets around my slow typing. I told it to work again at 115200 baud (AT+BAUD8)and it accepted the command (OK115200). I then went out to the car to check things again. Turned on the computer and started up Tunerstudio. I set the com port and turned on the car. VIOLA!!!! Success. I now have Bluetooth communications between the Megasquirt and my laptop. I started the car and saw the RPM etc wer all responding correctly. I didn’t run the car more than a few moments just to check out the system. I hope to have continued success as I work further on the tune. Now I don’t have to worry about destroying my laptop. And all it took was about $14 and several days of messaging to the seller, and messing with the module/ computers/ soldering iron etc.
From what I can tell, the module is made by Shenzhen Jiayuan Electronic Co. Ltd. It uses an HC06 Bluetooth processor and is only capable of performing as a slave module. It is not user changeable. Slave mode is required for the MS controller. So I’m in the clear. edit: I have since noticed that there is at least one other similar module that requires handshaking and may not work following these directions. make sure the one you buy needs only the 3-wire serial communication.
One thing I have not mentioned yet is that, if I used the “SOCKET” Bluetooth adapter per the Megasquirt manual’s suggestion , I would have to add some jumpers on the MS to allow for the handshaking that the SOCKET” requires. This eBay module does not require the handshaking so no modification to the MS is necessary. After the modification of the module for power and setup, this now just plugs in and goes.
Attachment:
finished.JPG
_________________
Chuck.
“Any suspension will work if you don’t let it.” - Colin Chapman
Visit my ongoing MGB Rustoration log:
over HEREOr my Wankel powered Locost log :
over HEREAnd don't forget my Cushman Truckster resto Locostusa.com/forums/viewtopic.php?f=36&t=17766