SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By Bill19253
#55293
Hopefully someone here might be able to advise if something is possible.

I have a software application using a PDA and need to be able to detect when another device in the car is simply turned on or off i.e. 12Volts or 0V

I was wondering if a bluetooth device could be used in any way to convey this simple on or off information.

I’m ok with the electronics but know nothing about bluetooth.

Any help or thoughts greatly appreciated.

Bill :)
By mikeselectricstuff
#55298
One way to do this would be to use a bluetooth module which is powered by the same 12V as the other device ( via a suitable regulator of course!)
The PDA could then do an enquiry scan to setect if that device is present or not. For a 1-off project, you could simply look for the known MAC address of the device.

This should be simple as you woudn't need to actually connect the data port of the device to anything - as long as the module can be configured to appear in an enquiry scan, the PDA would see it whenever it was on.

It is also possible to detect a device even if it is not configured to be visiable in a scan, provided you know its MAC address.
By Bill19253
#55338
Thanks for the reply Mike and please bear with me on this because I’m in totally unfamiliar waters.
It might help if I explain the application a little more because I’ve given this a bit more thought and there may be complications.

The PDAs are installed in taxicabs and the external device I’d like to detect is simply the taximeter’s output to the roof sign light being either on or off. My concern is that if I make it such that it simply detects any bluetooth presence, it may pick up similar signals from other nearby cabs. I suppose I could enclose the device in a screened box to deliberately limit the range to a foot or so.

I don’t understand what a mac address is and can’t find any info relating to it but maybe it’s some form of unique device ID? I think that for this idea to work it would either have to have some means of identifying that the bluetooth is from within the same vehicle rather than a nearby one or some other device like a mobile phone?

Again apologies if I’m missing the point due to my ignorance.

Bill :)
By mikeselectricstuff
#55343
Yes, the MAC is the device's address, which is globally unique. From memory I think it's 48 bits long.

A bluetooth device (e.g. the PDA) can do an inquiry scan and receive the MACs of all visible devices within range, and can also attempt communication with a specific MAC, even if that device has not been configured to be visible in scans.

When you tell a PC or PDA to show nearby devices ( e.g. to choose what to pair with), it first does an inquiry scan to produce a list of MACs, then polls each MAC for its name and device type. Once paired, it knows the MAC, and can continue to communicate with that device even if it is no longer visible to scans ( this is typical for BT earpieces and some phones, where you tell it to be visible for a short time to allow pairing).

Because you only want to detect the presence or absence of a device, you can make use of these functions built in to the bluetooth protocol and don't acually need to send any data, and so don't need any additional intelligence at the 'far' end, and don't need to pair with the device.

The PDA would be configured with the specific MAC it was looking for, so no problems with other BT devices.

I'm not too familiar with the bluetooth API on PDAs, but I would imagine there is probably a call to get the name/device type for a given MAC - if so, you could use this for your purpose - success/failure of this function would give you the on/off state.
However it may be the case that the PDA's OS tries to be too clever and keeps the names cached, and so may not actually try to communicate when you ask the name a secondtime- you'd need to do some tests to see. I have seen Windows do things like this when I was messing with BT modules - after changing a device's name or device type it was difficult to persuade Windoze to see the new name.
By Bill19253
#55369
Thanks a million for that Mike.

That’s given me something to try out and cleared up a lot of my concerns.
I’ve just managed to find a small usb dongle type device that looks like it might be ideal for the job so I’ll let you know how I get on with it.

Thanks again.

Bill :)
By mikeselectricstuff
#55370
I'm not sure if a USB dongle will do anything without being talked to via USB first to initialise it.
Worth a try though but you may end up needing to use an embedded type USB module.
By Bill19253
#55385
Mike

That’s a good point but given this device is built into a USB plug, could I not just plug it into a laptop to do any initialisation then transfer it to a small PCB with a USB socket and 3.3v reg? Or does the init routine have to be done each time it powers up?

From what I read, the device only consumes 50uA while inactive so maybe a re-chargeable cell via a diode and a 10k could be used to hold any settings. The 70mA transmit current would therfore only be available when power is available from the vehicle?

Either way for the cost involved, it should allow me to have a play and learn a little.

Bill :)
By lyndon
#55415
I think what Mike meant was that the USB device may need to be setup every time it powers on.

The price differential between a USB Bluetooth transceiver and one of the modules from SparkFun is minimal.
I picked up a Targus USB dongle at OfficeMax for $39 and the SparkFun RN41 Bluetooth serial module is (I think $45) and they work together just fine. The RN41 will definitely do what you are asking as it will power up in a discoverable mode without any additional initialization needed
By Bill19253
#55416
Cost is a major consideration because taxi drivers don’t like having to pay for anything let alone something that monitors their activity but I cant think of any other way of getting this simple on/off information into the PDA.

My thinking was that if the device was initialised with a limited backup supply, it might be possible to retain the settings indefinitely. I’ve ordered a small device today costing just $16 one off price so it’ll be no real loss if it doesn’t work. I’ll post my findings in the next couple of days.

Bill
By stevech
#55423
Bill19253 wrote:Cost is a major consideration because taxi drivers don’t like having to pay for anything let alone something that monitors their activity but I cant think of any other way of getting this simple on/off information into the PDA.

My thinking was that if the device was initialised with a limited backup supply, it might be possible to retain the settings indefinitely. I’ve ordered a small device today costing just $16 one off price so it’ll be no real loss if it doesn’t work. I’ll post my findings in the next couple of days.

Bill
RC5 style IR?

Not IrDA because it is as complicated as Bluetooth's stack.
By Bill19253
#55434
Yes I did think about IR, but the in car environment doesn’t exactly lend itself to reliable line of sight communication and also gives too many opportunities for the cab drivers to fiddle the system.

If this project were a one off for myself then this would probably be a simpler option but ultimately I could need a few hundred such devices so it needs to be pretty foolproof.

Bill :)
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]