BLE Bluetooth Settings Management for Arduino Code

Hey guys,

I'm looking into adding a BLE chip to my project to set settings remotely via my mobile device (website basically).

I don't want to use the device for constant communication between devices just to set a few settings and let it do its thing; I also want the settings to survive a reset. Am I right in assuming that I would use EEPROM for this?

If so, I want to be able to save arrays and other data structures, but i haven't found a way to do this. Is something like that possible?

I'm thinking there will be at least 20+ settings that I will be sending per connection...

Can anyone offer any guidance?

thanks!

Can you provide more details. An example of the data that you would like to save to the EEPROM would be useful. How many examples do you want to save? How often will the EEPROM data need to change. I presume you have read the manual

What will the Bluetooth device connect to in order to receive new data.

What sort of Arduino will you be using?

...R

Sorry just got this. I didn't get an email.

I don't have many more details. Just thinking it through I've come up with the fact that Im going to modify 5 settings.

  • array of 20 various data types
  • String value
  • integer
  • array of 5 booleans
  • boolean
  • possibly many more settings as the project expands

so, these are settings that i will set then use the device. I may want to change the configuration many times per day or more.

What Im trying to accomplish is a settings app for robot i'm making. so, I "program" it, run it; change the settings ("program it") again and run...etc.. I don't want to stream the serial data from my phone, because the robot could go out of range during its operation cycle. So i want to set it and have it carry out its instruction and reset it again if needed.

This is a very efficient Forum. You should always expect a reply within a few hours.

I am wondering, based on your description of the project, why there is any need to store the values in an eeprom. You only need to do that if you want to retain the values when the Arduino is switched off - not because the Arduino would go out of range.

And, if there really is a need to write the data to eeprom ...

I'm not entirely clear from your answer if the items 2 to 6 are the contents of the array in item 1?

Or do you plan to save about 70 bytes or more of data. What does "many times per day" mean?

If you change each byte 10 times per day that is 3650 times per year. If the EEPROM can withstand 100,000 writes it should last a few years.

Another option might be to add an SDcard or an external I2C eeprom.

...R

Or an FRAM - EEPROM nonvolatility, SRAM write speeds, no battery backup needed. 3.3 & 5V versions available, SPI & I2C interfaces, all kinds of memory sizes: http://www.digikey.com/product-search/en/integrated-circuits-ics/memory/2556980?k=fram%20memory

CrossRoads: Or an FRAM - EEPROM nonvolatility, SRAM write speeds, no battery backup needed. 3.3 & 5V versions available, SPI & I2C interfaces, all kinds of memory sizes: http://www.digikey.com/product-search/en/integrated-circuits-ics/memory/2556980?k=fram%20memory

This is a great idea, thanks! But i'm using most of my pins as outputs (9 pins - which may be reduced to 8 ), 2 for softserial (bluetooth), leaving the tx, rx open for programming/prototyping. Is it easy to incorporate into the code?

Robin2: This is a very efficient Forum. You should always expect a reply within a few hours.

I am wondering, based on your description of the project, why there is any need to store the values in an eeprom. You only need to do that if you want to retain the values when the Arduino is switched off - not because the Arduino would go out of range.

And, if there really is a need to write the data to eeprom ...

I'm not entirely clear from your answer if the items 2 to 6 are the contents of the array in item 1?

Or do you plan to save about 70 bytes or more of data. What does "many times per day" mean?

If you change each byte 10 times per day that is 3650 times per year. If the EEPROM can withstand 100,000 writes it should last a few years.

Another option might be to add an SDcard or an external I2C eeprom.

...R

I would like the last settings i send to the chip to survive a reset (simply because i dont want to enter them all again)... the 100,000 seems like a lot, but i still see it as a limitation. I guess i could store the settings on the phone and "sync" the data just after a successful connection- but I'm sure there will be times were i just want to turn it on and make simple hardware adjustments; not worrying about the phone.

I like the sd card idea, but it seems complicated to read the data from it - although it seems great for data logging over a large period of time to a csv.

Thank you both for your responses - im still a bit green - so, i guess my biggest limitation is i dont know all my options.

I should get my first prototype boards next week from oshpark.

Can you guys provide more insight on how to program the alternatives you suggested (ie the FRAM and SD card)

Thanks, Keith

The details of the SD Card library are in the Reference section of this website.

...R

I want to be able to setup led strips from my bluetooth app. am I able to do something like this were i get the settings from softSerial somehow?

int knobPositions[];
int switchPositions[];


//define Zone pins
int ZONES = [6,7,8,9,10,11,12,13];
int numLEDsPerZone[8];
CRGB zoneLEDS[];

//define utility/led pins
int status_led = 2;


void setup() {
  BLE_Shield.begin(9600);

  //setup zones
  for (var i=0; i < ZONES.length; i++){
   CRGB zoneLEDS[numLEDsPerZone[i]]; 
   FastLED.addLeds<NEOPIXEL, ZONES[i]>(zoneLEDS, numLEDsPerZone[i]); 
  }
}

void loop() {
  //read from the BLE Board, somehow... :/

  /*if (BLE_Shield.available() >= 9) // this will only be true if there are at least 9 bytes to read
 {
   for (int i=0; i <=8 ; i++)
   {
    array[i] = BLE_Shield.read(); 
   }
 }*/

}