Arduino HC-05 Master/Slave - bluetooth

I am trying to be able to click a button on a tablet i have, and it sends a message to a master Arduino. The master Arduino then sends a message of to 4 slave devices, which switches on a relay. So far I have already been able to connect a HC-05 to an android and switch a relay on from that same Arduino but, now i need to expand it. I have about 10 HC-05 modules and i would like to use just them. Any help will be appreciated. I currently have pinched parts of the code from this website.
http://www.instructables.com/id/Remotely-Control-LED-using-HC-05-Bluetooth-Arduino/?ALLSTEPS
Thanks
Ben

I recommend looking into AT commands for the HC-05. They will allow you to set the connected device and send information to that specific device (which would permit the switching between slaves). I also go through basic switching with the HC-05, a relay, and an Arduino Uno on my blog.
https://engineersportal.com/blog/2017/11/15/bluetooth-home-automation-light-bulb-switch-using-an-hc-05-a-relay-and-arduino

Related

Make the HID keyboard with BLED112

I use the BLED112 and want to make it act like a HID keyboard.
The BLED112 receives the keystroke from the Mobile. For example, "p".
Then the dongle act like a keyboard so we can see the "p" is written on Notepad of PC.
Sending data from Mobile to dongle is not matter. I have already done.
My problem is to send the keystroke event to the PC so the dongle works like a keyboard.
I want an example or the full guide.
Thanks.
BLED112 is a Bluetooth Low Energy dongle provided by Bluegiga (Now acquired by Silicon labs). If you have studied the BLED112 user manual and bluegiga API reference documents, you'd understand that there can be two possible ways to read/write data via BLED112:
Use bgscript
use the bglib library into your C/C++ application
BLED112 is enumerated as a virual com port. I don't recall the name of the windows application that comes with BLED112 but it sounded like BLEGUI or something. This application uses the APIs to handle connections, read and write events. In a nutshell, you need to implement the same thing that this application does. For that, you can leverage the logs it spits on the console. This log will help you with all the commands you need to send and all the response that you need to handle.
Then, you need to make your application communicate with the virtual com port over which these commands will be send and responses will be received at.
Once you establish this, you'd be able to display your keystrokes.
It is a substantial work if you haven't worked with BLE. But like people say, there aren't free lunches!

Reading Bluetooth data and command (Raspberry pi 3)

I am currently working on a project that make me control media center and a few domotic parts in my living room.
I have connected on my raspberry pi 3 a NAS, my Spotify account (with hifiberry, controls to close my amp, my PC and a few lights...
At first to control it all I programmed a web server that I can access on my phone. That made the job but it is not completely user friendly since I have to have my phone go to the interface and do whatever I have to... And I'm not a web designer 😁 it's far from perfect!
I've made some research and I have decided to build a bluetooth remote control (raspberry pi 3 do have Bluetooth low energy).
Since nothing exist as I want, it is going to be a custom one made with Arduino mini and hm10 module.
But I'm stuck on the raspberry part!
How can I read the Bluetooth data send by my remote and launch scripts according to the command sent?
Via a serial listener of some kind?
Yes, in fact, you should use a serial port to connect your pi with Bluetooth module.
You then use software input information for your purposes, but you must first implement the hardware and hardware interface first.
You can build application software with the Python programming language.

Send a string from Arduino to Windows Store App via Bluetooth?

I am trying to get a Unity3d Windows Store App game to read a string of text that is sent from an Arduino Uno Rev3 over Bluetooth.
Unfortunately, the Windows Store App platform does not allow use of the System.IO.Ports namespace, so I am not sure how to get it to read the Bluetooth data.
Does anybody know how to read data from Bluetooth in a Windows Store App?
Any help is appreciated,
Thanks
If your HC-06 has COM-port capabilities, then you can use: [https://learn.microsoft.com/en-us/uwp/api/windows.devices.serialcommunication
there is a sample on Github:
[https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/SerialArduino
To find out if your device has COM-port capability on windows 10 go to settings/Bluetooth, pair device and go to more settings, tab com-ports and try to add port. If the list is empty unfortunately you can not use Windows.Devices.SerialCommunication APIs to communicate with an Arduino device.
Another way is to use the Bluetooth GATT protocol for communication.
It allows you to read and write data and subscribe to indicate and notify events.
For this there is also a sample on github:
[https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/BluetoothLEClient
It depends on your HC-06 what Gatt-services are available but there is most likely a service that can reed and write and get notifications.
Hope this can help you,
Groover
I ended up using a BLE solution based on this example:
https://www.simplicity.be/article/eddy-and-his-stones-diy-arduino-beacon-mobile-apps/

Bluetooth SPP module SPP-C SPP-CA BK3211 chip - entering AT mode?

I have Bluetooth SPP module SPP-C / SPP-CA , it is cheap module that should work the same way as well known HC-06 / HC-05 modules.
I have got one problem, everything works, module is communicating over serial interface pairing etc... but i can not enter the AT mode to change device name pin or baud rate. Does anyone had the same problem and how to solve it ? there is a very small data published and sellers are not responding.
So I assume that someone may help with that situation. http://www.ebay.com/itm/Bluetooth-Module-UART-Serial-Interface-SPP-CA-works-with-YZXstudio-USB-Monitors-/201414967094 that's the module. it is based on Beken BK3211 chip.
It seems that nothing special is needed to enter command mode on the SPP-CA module I have.
Whenever you connect or disconnect by bluetooth, the module will print:
CONNECTED
.. serial data is transferred ..
+DISC:SUCCESS
When the module is disconnected, you can execute AT commands such as AT+BAUD just like with HC05 modules.
3 years later and I've looked everywhere for an answer to this question and finally stumbled upon the solution by fiddling away.
I am connecting via an FTDI module using Teraterm software to enter commands.
You need to power up the FTDI and BT modules by plugging into PC USB. open Teraterm and set up to see the COM port.
Now you have to momentarily connect GND to port 11 on the BT module to 'reset' the module. The module will power down and back up again and in doing so will enter AT mode and you should be able to communicate with the module.
Good luck
Old question however still relevant, I found the solution! It is pretty simple, you can use an breadboard and some jumper wires however you can also create an adapter like I did. Like explained in this document with AT-commands, you need another UART (serial connection) to program the SPP. The SPP must not connected to anything (discovery mode) to be able to program it.
You can do this, like I did, with another SPP or you can use serial programmer or an Arduino. Notice that the serial connection is 3V, so when using an Arduino you need some resistors (1K and 2K) to create a voltage divider (google it).
The schematic is pretty simple (when not using an Arduino), I designed this adapter:
You need these components to create the adapter (and maybe some wires):
Connect everything like in the schematic above (STATE and EN are not connected), insert the modules (take care of pin orientation!), insert an USB cable and connect it to some power source.
In Arduino IDE, select the com-port you want to configure and launch the Serial monitor, you can now enter AT-commands to configure the one that is not connected:
Done! That is pretty easy right? When you want to configure the other, disconnect the one that is connect and connect the other one. An overview of AT-commands can be found in the document in provided link above.
Hopes it helps ;-)

Teensy 2.0 / Atmega32u4 as Keyboard: Send and Receive

I'm currently working on a device which is able to work as a keyboard and communicate via Serial with a self-written software.
Now I have to install serial drivers (from Arduino) on different computers if I want to communicate with my application which I actually want to avoid.
Is there any other solution to solve this problem? Is it possible that my microcontroller works as a keyboard AND is able to send and receive data as HID device?
Thanks and greetings!
I actually do something similar with a 32u4, but it receives its serial over the built-in UART. I do this because it's linking between two separate systems. If it were only one system I could implement a 2nd interface. (Don't forget, a USB HID device must have an IN endpoint even if you are not using it.) Or you could just throw a $2 USB/TTL converter on and do it the same as I did.

Resources