I plan on having a mq-2 sensor detect if there is a certain amount of said gas. If there is enough of a certain gas it sends said number if there isn't it sends another number. I would then use a program on a computer to use these numbers.
My problem is how to send the numbers over Bluetooth. I have no experience with using the arduino for Bluetooth purposes. Any advice regarding tutorials, programming, hardware, or approaches are very appreciated! Thanks
My problem is how to send the numbers over Bluetooth.
My problem is knowing what bluetooth device you have, or how it is attached to the Arduino. In general, sending data over bluetooth is done using Serial or a SoftwareSerial instance, depending on how the bluetooth device is connected.
Without having the information PaulS required, it is kinda hard to help objectively. Bluetooth comms, however, work like this:
-
establish a serial connection (using Serial or SoftwareSerial). For that you need to know how your BT adapter is configured. Generally it is 9600,8,N,1, but you can reconfigure it using AT commands.
-
make sure the other device has properly seen and connected to your Arduino BT device. It needs to know the BT device name and password (which can also be set using AT commands).
-
use Print or Println on that serial instance to write to the BT device. It will than take care of sending that data over to the other device through bluetooth.
On your program's side, all you see is a serial connection. You read and write to it as if you were reading and writing to the serial console.
Bluetooth should be straightforward. It is really just "serial by wireless".
Note that the HC05 and HC06 modules work with Android and with my old Linux laptop but I believe they will not work with Apple products. There is another type of Bluetooth device which (I think) works with everything.
Also note that the HC05 is more versatile than the HC06.
...R
There is no programming special to bluetooth. If you are at the stage where you are sending the gas sensor data to the serial monitor, it is possible to use exactly the same programme to send the data to a PC or phone via bluetooth.
You might find the following background notes useful
http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino
The HC-0x family are OK with macOS, not with IOS.
PaulS:
My problem is knowing what bluetooth device you have, or how it is attached to the Arduino. In general, sending data over bluetooth is done using Serial or a SoftwareSerial instance, depending on how the bluetooth device is connected.
I have hoping you had some suggestions hardware wise. I plan on connecting the arduino to a Windows Computer and am trying to use bluetooth at the longest possible distance if that is important.
lelanl:
I have hoping you had some suggestions hardware wise. I plan on connecting the arduino to a Windows Computer and am trying to use bluetooth at the longest possible distance if that is important.
This is the device I have used in several projects, including the "CHDK Camera Remote Shutter":
http://www.dx.com/p/jy-mcu-arduino-bluetooth-wireless-serial-port-module-104299
I have already bought about 10-12 of these from DX and none of them have failed on me.
am trying to use bluetooth at the longest possible distance if that is important.
Bluetooth is NOT designed for long distances. 10 feet would be about the maximum you should expect.