Logging via Bluetooth

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

garygid

Well-known member
Joined
Apr 21, 2010
Messages
12,469
Location
Laguna Hills, Orange Co, CA
Currently the SOC-Meter has an RS232 port for Logging,
and uses a GOOD RS232-to-USB adapter to get the data to a PC.

If we had a suitable RS232-to-Bluetooth "dongle" (115200 baud), we might connect to:
1. PCs with built-in BT
2. PCs with a BT-to-USB "dongle"
3. Android devices

If you know of BT "dongles" that work well, please suggest them.

More Overview Later:
 
Bluetooth Dongles that support SPP:
(Serial Port Profile)

----------
For RS232-to-BT:

1. For $75 at http://www.gridconnect.com" onclick="window.open(this.href);return false;
Male 9-pin D connector, details unknown, but a pair works well for one member.

2.

----------
For BT-to-USB on Windows PC:

1. Very Small ("Mini" or "Ultra Mini") adapter ... can be $30 down to under $2, but performance and getting good supporting software/drivers appears to be an issue with some of the less expensive units.

----------
Arduino Bluetooth:

1. Arduino BT Shield, $23 + ship
from http://www.trossenrobotics.com" onclick="window.open(this.href);return false;

2. BT solder-on "board"
 
I have been using the firefly serial to bluetooth on
my solar system. ( http://www.gridconnect.com" onclick="window.open(this.href);return false; )

Its basically a serial-over- bluetooth connection, with a matching
adapter you have a virtual serial port on the pc side.
 
I will have a custom BT dongle for exactly this purpose available in 4-6 weeks for under $40.

2012-04-09_09-54-10_873.jpg


On your suggestion Gary, I picked up one of those Vizio tablets today form Costco. Even though it prompted me to update to 3.2 I kept the 2.2 and got it to connect to my BT dongle. I don't expect any problems on 3.2.

Haven't tested throughput yet though. Though I did accidentally start streaming some data at 19200 and it seemed to keep up...but I know your meter runs faster that that so we'll see..
 
Will the DB9 be male pins?

What powers it?

Can it take 5-volt power on pin 9?

Is it Class 1, or 2?

Does it auto-discover and connect with a SPP (Serial Port Profile)?

With it plugged onto the SOC-Meter's Logging port, what "command" sequence(s) do I need to send (at what speed?) to set it to 115200 baud?

Then, what commands to get it discovered, connected, and "streaming" data?

Good Work! :D
 
I am modifying the design so I can put either male or female. I need female, but you need male. The appropriate pins will be swapped as well so no need for a null modem.

For my application, I will need external 12V power as my DB9 does not have power (and I cant modify as it's connecting to existing hardware) so there will be another connector for power. But if your port already provides 5V on one of the pins, then I will modify to take advantage of that. Total draw shouldn't be more than 50mA when transmitting. Probably closer to 30..

Class 2

It is always discoverable and set to connect SPP. So you scan for it with whatever device you are connecting with (computer, android,etc), and pair it. Then when you connect it's automatically in SPP mode. You will not have to send it any commands from either side of the connection.

I can default it to 115200.

It *should* be plug-n-play...but we'll see. I need to see how it handles streaming data when there is no connection. I think it will be fine, but my application does not use streaming data so I haven't tested it.
 
For Power, will you require:
1. a 12v regulated supply
2. the "12v" from the car's battery (might be 10v to 15v)
3. 4.5v to 15v ...
4. I also have a car "12v" minus a 4.8v zener, for about 7 to 11 volts.
5. or ??

I do not have power on pin 9 yet, but I could easily add
a suitable output with just one internal wire.

Or, for now, your external Power-In could also be used.
 
I did some tests with streaming data (not the SOC Gauge meter though). The streaming data is at 19,200 8N1 with repeating 31 byte packets. Data was being streamed to the Vizio tablet via bluetooth using custom BT hardware on the "remote" side. The app on the tablet wasn't doing a whole lot with the data other than finding message headers within the stream and printing communication statistics to the debug interface.

I calculated the throughput to be about 2k bytes of data a second which is darn close to the 19,200 baud at 8N1.

It will be interesting to see what happens at faster speeds and if the android device can keep up. BT is actually well suited for streaming data. It is NOT suited (unfortunately for me) for request/response type data if speed is important due to the fact that bluetooth will do whatever it can to make sure it has the largest possible packet buffered before transmitting. So if you only send a few bytes (such as a request), it will wait for more data, or some fixed length of time before it actually transmits.
 
Can you set a maximum "latency" time of a couple of milliseconds,
so that BT will not "hold" data bytes for more than that specified time?

Is the transmitted BT packet size variable or fixed by you?
 
It took longer than expected, but I finally got the BT dongle completed. Still need to do some tests.

It's configurable (at time of assembly) for male or female DB9. It also can be powered externally or from within the DB9 connector.


2012-07-10_16-49-04_711.jpg
 
No command from the DB9 side needed for pairing. On first powerup, it linked up to both my android devices. I'm not certain if you can set the baud rate on the DB9 side over the BT connection, that is the only thing I did from the DB9 side. But that shouldn't be too much of a problem.
 
Does it "look like" an RS232 serial port on the Android side?

Is it an "AT" command to set the baud rate on the DB9 side?

Or, does it Auto-Baud (set rate) somehow?

Should be "easy" to provide 5v from the SOC-Meter to the DB9 port.

How much current does it need?

Just 5v, or a range of voltages?

Is U3 a regulator?
 
garygid said:
Does it "look like" an RS232 serial port on the Android side?
Not sure what you mean. It looks like a BT device and internally it tells the android device it supports SSP.

garygid said:
Is it an "AT" command to set the baud rate on the DB9 side?
yes

garygid said:
Or, does it Auto-Baud (set rate) somehow?
I haven't seen anything in the docs that it will auto baud

garygid said:
Should be "easy" to provide 5v from the SOC-Meter to the DB9 port.
yes, it's designed to be able to do that.

garygid said:
How much current does it need?
about 50mA.

garygid said:
Just 5v, or a range of voltages?
4.8 to 18v

garygid said:
Is U3 a regulator?
yes.
 
Back
Top