I have made a Matlab script to receive data from a Mega2560 and two ultrasonic sensors, but now I would like to make something more compact and wireless data transfer.
So can the Adafruit Feather 32u4 Bluefruit LE board replace Mega2560, and Adafruit VL6180X sensors replaces ultrasonic sensors?
Core Electronics technician mentioned using the I2C to solve the problem. Any tips and information/suggestions are much appreciated!
Thanks a lot!
We spoke on the phone. The sensors you’re referring to use I2C to communicate so there’s no other way to interface with them. The board that you showed me on the site was different than the 32u4 feather, but it will work just as well. I would recommend that you take a look at our Arduino Workshop for more info on Arduino to help get you started, and our I2C Arduino tutorial for some specific info on using I2C with Arduino.
Speaking from a general top-down point of view if you want to pull data into matlab from a sensor then you’ll need to meet the following criteria:
- The sensor has to interface to some microcontroller. This can be in any way that works for your application - the sensor has to be chosen with an interface that is compatible with your micro.
- The microcontroller has to interface with matlab. This is easiest done over UART or bluetooth (which the computer sees as a virtual com port anyway, so it’s “identical” to UART).
If you really need wireless, then perhaps a sensor connected to a bluetooth-enabled micro will form a single measurement device, and be shown on your computer (matlab) as an individual COM port. More sensors means more sensor-micro pairs, each enumerating as their own COM port.
Thank you Sam! I was sort of know what you were telling me, but now I have a more clear idea of how to do it. I will go ahead and order the items and try to figure it out as I play with them.
Thanks Michael! Im probably wrong: the Adafruit Feather 32u4 should act like a microcontroller and the bluetooth module is integrated to the board like a shield that receives data from the Feather board and transmits the data to a COM connection. So my understanding of the setup is: two sensors connected to bluetooth-enable Feather; sensors generate data; Feather board receive data from sensor and conveys it to the bluebooth unit; the bluebooth unit finally transfers the data to pc COM.
But you might have just told me the same thing… and I just don’t have enough knowledge to understand the whole picture.
Hey @Daniel47122. Sorry, I’ve been out of the office last week.
You’re correct, and we’ve described the same/similar architecture. If you have a micro (Feather) collecting data from to two sensors and streaming it out via bluetooth then you should be able to parse it in from a COM port in MATLAB.
If you’re using Simulink within MATLAB then you’ll want the
From device block to bring data in from a COM port. Parsing can be done with some function block you write yourself that demuxes your formatted data.