Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Data acquisition with nRF52832 Bluefruit Feather card
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Data acquisition with nRF52832 Bluefruit Feather card

by Samou on Mon Jun 15, 2020 5:36 am

Hello,

I bought a NRF52832 Bluefruit Feather card to recover data from a
piezoelectric sensor, I needed a card with low energy Bluetooth and small
dimensions.
The signal I want recovered has positive and negative parts, I just get
the positive part of the data with this card.My question is, can we change
the reference or the whole program to be able to recover the negative data
(the sign bits).
If this is not possible, have you a card which meets my needs level size,
energy and of course complete negative and positive signal.

waiting for an answer.
thanks.
Samia[size=200][/size]

Samou
 
Posts: 25
Joined: Thu May 07, 2020 12:19 pm

Re: Data acquisition with nRF52832 Bluefruit Feather card

by adafruit_support_bill on Mon Jun 15, 2020 6:00 am

Like most ADCs, the one on the nRF52832 can only measure positive voltages between GND and the analog reference voltage. However, you can build a simple resistor network to re-scale your positive and negative signals to all fall within that measurement range. See this thread for an example:

viewtopic.php?f=8&t=59889&p=302894

adafruit_support_bill
 
Posts: 78709
Joined: Sat Feb 07, 2009 10:11 am

Re: Data acquisition with nRF52832 Bluefruit Feather card

by Samou on Thu Jun 18, 2020 3:39 am

Hello;
Thanks you for the answer.

for my project, I need to recover all the signal for studying and processing the curve. if i use a voltage divider i will lose half the signal from my sensor.

Do you have a solution to recover this type of signal knowing that it is around 200mV (Alternative)? or another proposed card?

THANKS.

Samou

Samou
 
Posts: 25
Joined: Thu May 07, 2020 12:19 pm

Re: Data acquisition with nRF52832 Bluefruit Feather card

by adafruit_support_bill on Thu Jun 18, 2020 5:50 am

The signal curve does not change, it is only scaled down and offset. The only thing that changes is the calculation to convert the raw ADC counts readings to engineering units.

adafruit_support_bill
 
Posts: 78709
Joined: Sat Feb 07, 2009 10:11 am

Re: Data acquisition with nRF52832 Bluefruit Feather card

by Samou on Fri Jun 26, 2020 3:01 am

Hi;

I would like to digitize a signal with a frequency between 0.5 - 2 hz to be able to send it by bleutooth, the adafruit feather card nR52832 gives me just 10 POINTS / second , I want to have or less 100 points / second to be able to recover a signal closer to the original signal.

do you know how can I do it with this card , or what can I change pour have more point ?

THanks.

Samou
 
Posts: 25
Joined: Thu May 07, 2020 12:19 pm

Re: Data acquisition with nRF52832 Bluefruit Feather card

by adafruit_support_bill on Fri Jun 26, 2020 5:43 am

Please post the code you are using.

adafruit_support_bill
 
Posts: 78709
Joined: Sat Feb 07, 2009 10:11 am

Re: Data acquisition with nRF52832 Bluefruit Feather card

by Samou on Fri Jun 26, 2020 8:24 am

Code: Select all | TOGGLE FULL SIZE
int adcin    = A0;
int adcvalue = 0;
float mv_per_lsb = 3600.0F/1024.0F; // 10-bit ADC with 3.6V input range

void setup() {
  Serial.begin(115200);
  while ( !Serial ) delay(10);   // for nrf52840 with native us

}

void loop() {
  // Get a fresh ADC value
  adcvalue = analogRead(adcin);

  // Display the results

 
  Serial.print((float)adcvalue * mv_per_lsb);
  Serial.print(";");
  Serial.println(millis());

delay(100);
}
Last edited by adafruit_support_bill on Fri Jun 26, 2020 8:24 am, edited 1 time in total.
Reason: Pleas use [code] tags when posting code to the forums

Samou
 
Posts: 25
Joined: Thu May 07, 2020 12:19 pm

Re: Data acquisition with nRF52832 Bluefruit Feather card

by adafruit_support_bill on Fri Jun 26, 2020 8:26 am

This delay in your code is what is limiting your sample rate:

Code: Select all | TOGGLE FULL SIZE
delay(100);

adafruit_support_bill
 
Posts: 78709
Joined: Sat Feb 07, 2009 10:11 am

Re: Data acquisition with nRF52832 Bluefruit Feather card

by Samou on Thu Jul 09, 2020 8:45 am

Hi;
I want to be able to send the signal and save it on my computers by bluetooth directly in file format (dat, txt .....or other format).

I tried with meet inventor app but its not working.
is there any tutorial on creating a program to send by bluetooth (also because the one in the library is too complicated ) because I just want to read one pin and send the data by bluetooth to my computer and i dont know if i can use android studio with NRF52 card because I see no example on this.

thanks.

Samia

Samou
 
Posts: 25
Joined: Thu May 07, 2020 12:19 pm

Re: Data acquisition with nRF52832 Bluefruit Feather card

by adafruit_support_bill on Thu Jul 09, 2020 9:27 am

The bleuart example is probably the best place to start. It takes serial input and sends it over the BLE UART interface. You would just need to replace the serial data with your analog read data.

https://github.com/adafruit/Adafruit_nR ... leuart.ino

On the host side, it will look like a serial input stream. There is source code for an Android app for that here: https://github.com/adafruit/Adafruit_Android_BLE_UART

adafruit_support_bill
 
Posts: 78709
Joined: Sat Feb 07, 2009 10:11 am

Re: Data acquisition with nRF52832 Bluefruit Feather card

by Samou on Wed Jul 15, 2020 3:42 am

HELLO
I have a little problem I can't change my arduino program to be able to send data directly to my computer, could you remember which part to change exactly in the program you sent me.

For android studio,have you another solution to reseave my data in my computer using another soft, because i have many probleme tu use this https://github.com/adafruit/Adafruit_Android_BLE_UART.

thanks.

Samou
 
Posts: 25
Joined: Thu May 07, 2020 12:19 pm

Re: Data acquisition with nRF52832 Bluefruit Feather card

by adafruit_support_bill on Wed Jul 15, 2020 9:29 am

could you remember which part to change exactly in the program you sent me.

Replace the code that reads serial data with the code you already have for reading analog data. You can keep the part that sends the data over bluetooth.

For android studio, have you another solution to reseave my data in my computer using another soft, because i have many probleme tu use this

That is the only Android Studio app we have for reading data from the UART. What are the problems you are having with it?

adafruit_support_bill
 
Posts: 78709
Joined: Sat Feb 07, 2009 10:11 am

Re: Data acquisition with nRF52832 Bluefruit Feather card

by Samou on Mon Jul 20, 2020 5:46 am

Hi;
I changed the program for bluetooth transmission, this is it
Code: Select all | TOGGLE FULL SIZE
   #include <bluefruit.h>
#include <Adafruit_LittleFS.h>
#include <InternalFileSystem.h>

// BLE Service
BLEDfu  bledfu;  // OTA DFU service
BLEDis  bledis;  // device information
BLEUart bleuart; // uart over ble
BLEBas  blebas;  // battery
int adcin    = A0;
int adcvalue = 0;
float mv_per_lsb = 3600.0F/1024.0F;
void setup()
{
  Serial.begin(115200);
 

#if CFG_DEBUG
  // Blocking wait for connection when debug mode is enabled via IDE
  while ( !Serial ) yield();
#endif
 
  Serial.println("Bluefruit52 BLEUART Example");
  Serial.println("---------------------------\n");

 
  Bluefruit.autoConnLed(true);
  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);

  Bluefruit.begin();
  Bluefruit.setTxPower(4);    // Check bluefruit.h for supported values
  Bluefruit.setName("Bluefruit52");
  //Bluefruit.setName(getMcuUniqueID()); // useful testing with multiple central connections
  Bluefruit.Periph.setConnectCallback(connect_callback);
  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);

  // To be consistent OTA DFU should be added first if it exists
  bledfu.begin();

  // Configure and Start Device Information Service
  bledis.setManufacturer("Adafruit Industries");
  bledis.setModel("Bluefruit Feather52");
  bledis.begin();

  // Configure and Start BLE Uart Service
  bleuart.begin();

  // Start BLE Battery Service
  blebas.begin();
  blebas.write(100);

  // Set up and start advertising
  startAdv();

  Serial.println("Please use Adafruit's Bluefruit LE app to connect in UART mode");
  Serial.println("Once connected, enter character(s) that you wish to send");
}

void startAdv(void)
{
  // Advertising packet
  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
  Bluefruit.Advertising.addTxPower();

  // Include bleuart 128-bit uuid
  Bluefruit.Advertising.addService(bleuart);

  // Secondary Scan Response packet (optional)
  // Since there is no room for 'Name' in Advertising packet
  Bluefruit.ScanResponse.addName();
  Bluefruit.Advertising.restartOnDisconnect(true);
  Bluefruit.Advertising.setInterval(32, 244);    // in unit of 0.625 ms
  Bluefruit.Advertising.setFastTimeout(30);      // number of seconds in fast mode
  Bluefruit.Advertising.start(0);                // 0 = Don't stop advertising after n seconds 
}

void loop()
{

// Get a fresh ADC value
  adcvalue = analogRead(adcin);

  // Display the results

 
  Serial.print((float)adcvalue * mv_per_lsb);
  Serial.print(";");
  Serial.println(millis());
  bleuart.write(((float)adcvalue * mv_per_lsb),millis());


}

// callback invoked when central connects
void connect_callback(uint16_t conn_handle)
{
  // Get the reference to current connection
  BLEConnection* connection = Bluefruit.Connection(conn_handle);

  char central_name[32] = { 0 };
  connection->getPeerName(central_name, sizeof(central_name));

  Serial.print("Connected to ");
  Serial.println(central_name);
}

void disconnect_callback(uint16_t conn_handle, uint8_t reason)
{
  (void) conn_handle;
  (void) reason;

  Serial.println();
  Serial.print("Disconnected, reason = 0x"); Serial.println(reason, HEX);
}


I do not know if it is correct what I did or nn, because I can not verify the operation with the application Bluefruit Connect.

My second question in about android studio app :
it is very important to instal the latest version of Android Studio ? because when i tray to use your soft app i have many warning and errors.

Thanks

Samou
 
Posts: 25
Joined: Thu May 07, 2020 12:19 pm

Re: Data acquisition with nRF52832 Bluefruit Feather card

by adafruit_support_bill on Mon Jul 20, 2020 7:52 am

According to the documentation, it was written using version 0.8 Beta which is quite old. I'll check with the authors to see if they have any recommendations for a more recent version.

If you post the error messages that you are seeing, we might be able to help resolve them.

adafruit_support_bill
 
Posts: 78709
Joined: Sat Feb 07, 2009 10:11 am

Re: Data acquisition with nRF52832 Bluefruit Feather card

by antopenroad on Mon Jul 20, 2020 7:59 pm

That UART demo is very old and has not been updated for the permission system introduced on Android 6.0 or the current version of Android Studio.

I would recommend using Adafruit Bluefruit Connect app. It includes UART reading and it can export data to .txt, csv, etc...

The app can be installed directly from the Google PlayStore: https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect
and the source code is available here: https://github.com/adafruit/Bluefruit_LE_Connect_Android_V2
(and it should work in the latest version of Android Studio)

antopenroad
 
Posts: 4
Joined: Thu Jan 08, 2015 4:59 pm

Please be positive and constructive with your questions and comments.