3
\$\begingroup\$

I want a PIR sensor to send a "something moved" event to Android.

Can I use a simple PIR + Bluetooth module to send such an event? I was thinking that I could connect the PIR output (which goes 5V when movement is detected) to the TX of the bluetooth module, so that "something" would be sent to android (which has been paired before), which would read "something" from instream.read(buffer)

Would this work? Is it ok to just put +5V on the TX of the bluetooth module? I would say that it would send garbage, but I'm not interested in "what" is sent, just the event that something was sent...

\$\endgroup\$

4 Answers 4

2
\$\begingroup\$

Not with the HC-06. The HC-06 is a specialized firmware for the CSR bluetooth module it runs on. It lacks any options for GPIO, either from a master or to it.

There are other versions. The HC-05 is even more limited. A newer version known as the BC-04C or some variation on that now has a limited GPIO option, and can be run without a microcontroller host hooked up. (Electrodragon, not affiliated), but it has poor documentation.

See https://www.youtube.com/watch?v=ExtMyV3fDLM or https://www.youtube.com/watch?v=KMUMnF0F4jE

Even so, you would need to setup the module at least once, with a microcontroller or a usb-to-ttl serial cable, and put it in Monitor/Collection work mode (input reading mode).

As for directly hooking up the PIR output to the TX pin, that can create garbage characters that might lock up the module. I don't recommend it.

The easiest solution would be to use an Arduino clone, or ATTINY and make a quick sketch that involves reading an input pin, and sending a string via the TX and RX pins (software serial). It wouldn't take much.

Edit: A simple hack would be to use a device like a Bluetooth Selfie Stick button. These buttons are a fully contained bluetooth with multiple digital inputs, and even a battery. Add a transistor and a resistor and your all done. There are apps that can configure what the button "press" does on the android side. I may do this myself now!

\$\endgroup\$
0
\$\begingroup\$

The HC-06 module does not have the proper IO circuitry to communicate with android. You would need a microcontroller to do that. If you are worried about the size of the arduino you can use a Pic instead.

\$\endgroup\$
0
\$\begingroup\$

Not with that module, but if you get a different module designed to be a simple remote control (presentations, selfie stick remote shutter, erc) or keyboard (preferably non-multiplexed) you may be able to rig the PIR output to effect a keypress using a transistor or gate. Details would depend on the output characteristics of your unspecified PIR, and whatever the bluetooth module expects in the way of switch wiring.

Or yes, you can use a simple microcontroller to send through your serial bluetooth module. Most micros with a moderately stable clock can transmit serial words, encoding them in software even if they lack a hardware UART peripheral.

\$\endgroup\$
0
\$\begingroup\$

Bluetooth Module HC-05/06 won't cut it. No GPIO functionality on it. Another option : ZigBee/Xbee modules. It has ADC/GPIO built in and you don't need any controller on the TX side. Connect Arduino on RX and parse the data received. Simple and effective.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.