I have been programming Arduinos for a few years, all of which use serial interfaces for passing data. I use a windows .net program to read the data from a VCP.
I bought a NANO 33 IOT with the idea of broadcasting sensor data over bluetooth and then set up a port on the PC to read in the data.
I cannot seem to find much in the way of documentation on how to do this? Can any one help with a pointer to reference data, or better still a worked example?
If you are just interested in replacing the serial link with wireless you will be better of with a Bluetooth module like the HC-05. From what I understand you just use two of them and can send data via the UART. I think they use Bluetooth Classic and the Serial Port Profile (SPP).
The Arduino Nano 33 IoT uses BLE. BLE and Bluetooth Classic are not compatible.
With BLE you use a profile called GATT. It is designed for energy efficient transfer of small amounts of data. You define services and characteristics which contain and describe the data. After that you only update the data in your application at any rate for each data value. You do not need to worry about the protocol. It is much more flexible than Serial and you do not need to format and parse data.
Now, about your PC. The focus for BLE is mobile. You can find many generic apps to connect to any BLE device. I use BLE Scanner on iOS and others. I have not seen a good way to use BLE on the PC side. Windows supports products from the big companies e.g. keyboards and mouse but I have not seen anything good for maker stuff.
If power is no issue you are likely better off to use the WiFi capabilities of your Arduino Nano 33 IoT. There are plenty of protocols supported on PC that run on top of TCP/IP. Or you use raw TCP.
Did you try the BLE examples from the ArduinoBLE library to get an understanding of BLE?
Klaus - thanks for responding so quickly. It is very useful information. I did not realize the differences between the BT technologies.
The amount of data is small, a string of 30 bytes every few seconds. It is for monitoring weather conditions in an observatory, but I do not want trailing cables for safety reasons. The observatory computer is a NUC, a few meters away. I have already designed the sensor array on a normal Nano Every and I'm hoping it is a fairly easy task to change that for the IoT version.
I would normally use VCPs on the NUC, but in this case, I need to go wireless. I would prefer, if possible to use BT, as this may also be used out in the countryside, with no home network.
For some reason I did not find the libraries before... but I have just refreshed the Arduino app and I can see some now. I understand I might be able to use something called a Bluetooth Serial Port Profile on the PC side.
The BLE standard doesn't include a standard for UART.
The basic way to trigger/read/write services and characteristics is through BLE standard protocol
for example If I upload the ArduinoBLE library example Peripheral/LED/LED.ino to my Arduino Nano BLE Sense and then open BlueSee (on my Mac, exists on Windows I believe) then I can see a device named LED.
if I double click on it to open it's inspector and connect then I can see the characteristic the device advertises and read or write it. if I write 01 then the LED on my Arduino turns on, if I write 00 then the LED turns off.
1: connect
2: select the characteristic
3: enter 00 or 01
4: press Write
5 -> see light changes on your Arduino Nano BLE
basically you would need to write an app on your PC doing something similar. Connecting through BLE to your Arduino and read the data every few seconds. There are various ways of advertising data changes whilst you are connected.
if writing an App on the PC is too much of an hassle, you can just buy a second arduino Nano BLE you attach to a Serial port of your PC and this second arduino will basically be reading the data from the sensor and spitting it out to your PC:
The data can be sent out just as if your Arduino was a keyboard (you might want a physical button on the Arduino to enable / disable this)
or send out your 30 bytes through Serial in which case you can then use the COM port from your Arduino to get your data
There are ways to hide the BLE work in your code, you can have a look at HardwareBLESerial which is an Arduino library for Nordic Semiconductors' proprietary UART/Serial Port Emulation over BLE protocol.
that is brilliant, many thanks. I checked out the Nordic link - that is basically what I need, a data logger over serial. I will get a test link working and then pile in the rest of the code. I just need to check there are no gotchas between the two Nano versions.
You can use my free pfodDesigner app to generate Arduino code that includes a BLE Serial connection
I recently updated the code generator to support the latest ArduinoBLE library V2.0.0
OR you can just copy the code from the tutorial Arduino NANO 33 Made Easy