Sensor data from Arduino to Mac via BLE Friend

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
davidestevens
 
Posts: 35
Joined: Thu Oct 20, 2022 7:44 am

Sensor data from Arduino to Mac via BLE Friend

Post by davidestevens »

Getting ambitious now. I have various Adafruit sensors/multiplexers working with the Arduino Micro, and I'd like to send the output of one of the Micro's to my Mac via BLE instead of via USB. And I'm plumbing new depths of ignorance here!

First thing is - have I bought the wrong module (the SPI version). I want to send the serial data from the sensors to the [serial] object in Max, and from looking at the web info, it seems that I should have gotten the UART version of the board. ? ? ?

Then, the examples I can find on the Adafruit site seem to be help with connecting the BLE Friend SPI to a mobile device, which then acts as a controller. But I want to go the other way, from the Arduino via the bluetooth module to a desktop. Can anyone point me to any info & sketches that will help me figure that out, both connecting the Friend to my Mac and the Arduino Micro to the Friend?

thanks in advance!

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Sensor data from Arduino to Mac via BLE Friend

Post by mikeysklar »

You have the right hardware and should be able to connect to your MacOS desktop using BLEIO.

https://github.com/adafruit/Adafruit_Blinka_bleio

Code: Select all

sudo pip3 install adafruit-blinka-bleio
Full guide explaining how to get started here:

https://learn.adafruit.com/circuitpytho ... y-computer

User avatar
davidestevens
 
Posts: 35
Joined: Thu Oct 20, 2022 7:44 am

Re: Sensor data from Arduino to Mac via BLE Friend

Post by davidestevens »

Thanks for that. So far I'm trying to translate the Uno PIN numbers from the bluefruit/wiring page to the Micro.
So the Bluefruit/Arduino pins given are:
SCK - 13; MISO (CIPO) - 12; MOSI (COPI) - 11.
Does this mean D13, D12 & D11?

On the Arduino printout for the Micro:
D15 is given as SCK (first pin on bottom left side of board)
D14 is given as MISO/CIPO
D16 is given as MOSI/COPI

Assuming that I should use the latter set of three, I presume I need to change the #define part of the example code from Adafruit to match these pins?
And I choose any free D- pins for CS, IRQ & RST (eg D6,7 & 8) and set those in the sketch?

thanks

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Sensor data from Arduino to Mac via BLE Friend

Post by mikeysklar »

I am seeing different pinouts than you mentioned for the Arduino Micro. Maybe there are different revisions or even models?

This page is a good UNO reference, but you will need to follow the pins for your controller.

https://learn.adafruit.com/introducing- ... out/wiring
Screenshot from 2022-11-14 14-35-46.png
Screenshot from 2022-11-14 14-35-46.png (16.67 KiB) Viewed 121 times
adafruit_products_2633-SPIPinout.jpg
adafruit_products_2633-SPIPinout.jpg (128.16 KiB) Viewed 121 times
Screenshot from 2022-11-14 14-39-13.png
Screenshot from 2022-11-14 14-39-13.png (629.7 KiB) Viewed 119 times

User avatar
davidestevens
 
Posts: 35
Joined: Thu Oct 20, 2022 7:44 am

Re: Sensor data from Arduino to Mac via BLE Friend

Post by davidestevens »

Thanks again!

I have the pin diagrams from Arduino’s site already, but the metro image is useful, and it does suggest that the PIN numbers in the LE SPI Friend table _are_ referring to digital pin numbers. So I’ll go with that.

Next is sorting out the sketch for initialising the Friend and figuring out how to send the data from the sensor parts of the sketch over BLE to my Mac. The good bit of news (for me) is that there is already a Max object that receives Bluetooth. I managed to get it to connect to the Nano 33 BLE that I also have, so now I just need to figure out the sketch for the Friend/Micro/ToF sensors rig.

Locked
Please be positive and constructive with your questions and comments.

Return to “Wireless: WiFi and Bluetooth”