Use the Bluetooth interface to connect to devices over the Bluetooth interface and to transmit and receive ASCII and binary data. The toolbox supports the Bluetooth Serial Port Profile (SPP). You can identify any SPP Bluetooth device and establish a two-way connection with that device.
Active5 years ago
Matlab Tutorial Download
I am facing a problem between Arduino Uno and Matlab. The idea is to connect a sinusoid generator at the Arduino's analog pin, do A/D conversion and send the results at Matlab for further processing (filtering and FFT). The frequencies will vary between 10 and 20 Hz.
The first strange thing is that the values at Arduino's serial terminal can be seen only at 19200 baud rate, despite the fact that in the following code the baud rate is defined 9600. When I tried to change the baud rate at the terminal (back to 9600), I see only junk values.
The second strange thing is that when I change the frequency between the interval of 10 and 20 Hz, the serial prints values which don't look like a sinus signal. However, when the frequency is stable at 20 Hz or 10 Hz the output is stable.
Matlab Programming Tutorial
This is the code that runs at Arduino:
This the code which runs at Matlab:
The final strange thing is that despite the fact that the generator produces 20 Hz sinus signal, the FFT graph illustrates a signal at different frequency (8 and 18 Hz). I guess I was supposed to see one signal at 20 Hz. The generators output is verified by using an oscilloscope.
I would like someone to help me clarify this problem. I am very confused, I have searched many links on the web for WEEKS but nothing yet. Forgive me for this big post. I tried to give as much information as possible. However, if someone wants to know something more or if I have not mentioned anything feel free to ask.
anarnikanarnik
1 Answer
your program have many mistakes.
- you have set different boudrate for arduino and PC.
- are u getting correct waveform? u have not mention it.
- send the hardware circuit also.
- u can try this f = [0:N/2]*500/N; f=f/.05
sunilsunil
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Not the answer you're looking for? Browse other questions tagged matlabarduino or ask your own question.
Active1 year, 3 months ago
So I'm working in Unity3D, programming in C#, and I heard that one can read data from a Bluetooth adaptor via SerialPort. I have several Bluetooth USB adaptors that I've tried to connect on my PC using this method. However, when I try to open the SerialPort, I get an error message that says port does not exist. I only included the code relevant to the question, but portI is a string ('COM11' or 'COM12') and PortIn is of type SerialPort.
Rice_Crisp
Rice_CrispRice_Crisp63611 gold badge88 silver badges2424 bronze badges
2 Answers
Here is some code I'm working on and it gets data from the bluetooth connection to a standalone pc build (or in the editor) as long as the COM port (in my case COM9) is the same as the bluetooth device when you pair it.
After you pair it go to Bluetooth Settings > COM Ports and see what port is there with the name of your device. It might say COM8 or COM9 or whatever. If the device is paired and the COM Port is the same in the code as it is in your Bluetooth Settings, AND the timeout number and baud rate are the same as in the application you are sending the data from... then you will get something from this code when you run it. This is just meant to help make a connection to the serial over bluetooth connection.
Hope it helps someone. I've gotten a lot of great advice from reading these forums ;)
Tony8,97377 gold badges4949 silver badges8888 bronze badges
Matlab Gui Tutorial Pdf
KrisCodeKrisCode
It should be possible. The bluetooth rfcomm/spp services emulate a serial port. A COM port if it's on Windows. Baudrate doesn't matter in this emulation, it will always go as fast as possible.
You need to have the devices paired and connected though.To what device are you connecting? Try to make a connection first with Putty or some terminal application.
Eric SmekensEric Smekens