Author Topic: Both RFduino and Simblee with other BLE's  (Read 294 times)

Wayne

  • RFduino Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Both RFduino and Simblee with other BLE's
« on: March 16, 2017, 02:07:36 PM »
Hi,
I'm planning on using either of the 2 products in a new production of our current Wireless (Bluetooth RN42) product. Actually it is a 3rd version since introduction, but thats on the sales side.

What we do is mimic a medical footswitch and or handset unit using BT.
The actions are (depends of the x-ray system) Save or mode (save being a one time pulse per press) and or X-ray or Hi-Level x-ray (these use a security closure as well).
I have written code using arduino under the Teensy devices.  All pass are are out in the field.
Yes, we need to certify these, but in time. 

Reason the newer system is for battery use.  We want to get away from chargers and Li-Ion batteries which currently we need to go through hoops to qualify.
Also, the RN42 and current system kills batteries in less than 40 hrs.

Le can now use alkaline batteries and not worry over Fedex issues.  And low power is also a nice item (need less that 20ft.)
Our current BT module setup is 1 for FS, 1 for HS and 2 for the receiver.

If I understand correctly, I could make one unit Simblee or RFDuino a Master or central ?? and the other as slave or peripheral ??

Since the HS and FS mimic each other.

Since I do not have my stuff yet (kits and all), I like to find how to connect the units easily for production.
We program the FS/HS under one freescale and the recvr on another. The other programmers had selections for functions etc.
They can flip banks of switches to do certain functions, but most important is getting the BT modules to talk. When the link, the BT led lites.  They do FS first and then HS next to the recvr.

I'm hoping I can do this and lock out other BT devices. 

If someone can point me to where to look so I can start thinking on how to program it, be great.

And if I recall, the devices have AES security.. But if we lock it down, should be good too..

RFD_Nelson

  • RFduino Team
  • *****
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: Both RFduino and Simblee with other BLE's
« Reply #1 on: March 22, 2017, 08:03:15 AM »
Hi Wayne,

Simblee is perfectly suited for this application! Simblee's Ultra-Low Power mode enables you to run for years on a single coin cell battery!

For this application, you could easily put the Simblee in ULP mode, and wait for a button press. The Simblee would then wake, send a packet via our low-latency ultra-fast SimbleeCOM protocol, and go back to sleep.

This application could easily run in the field for years!

Do you have any specific questions about how to implement this?

Wayne

  • RFduino Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Both RFduino and Simblee with other BLE's
« Reply #2 on: March 22, 2017, 11:10:53 AM »
Yes I will have some questions. 

I would like to have like 2 or 3 devices to 1 host.

The host will drive relays..

The devices will send button presses.  Min of 3, max of 8.. Different configurations.

I have been in contact with a Patty Steiman on this.

but suggestions will help since this is new to me.

RFD_Nelson

  • RFduino Team
  • *****
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: Both RFduino and Simblee with other BLE's
« Reply #3 on: March 23, 2017, 11:04:26 AM »
Hi Wayne,

You can use an unlimited number of devices with SimbleeCOM. Here's a sample sketch that you could load on one of your devices to speak with the host when a button is pushed:

Code: [Select]
uint8_t buttonA = 5;
char node = 'A';

void setup() {
  pinMode(buttonA, INPUT);
  SimbleeCOM.mode = LOW_LATENCY;
  SimbleeCOM.begin();
}

void loop() {
  if (digitalRead(buttonA)) {
    SimbleeCOM.send(node, 1);
  }
}

NOTE: This is an extremely simple sketch to simply show you the basics of using SimbleeCOM. Please also check out the SimbleeCOM examples in the Simblee package.

Wayne

  • RFduino Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Both RFduino and Simblee with other BLE's
« Reply #4 on: March 23, 2017, 11:37:05 AM »
Will this work connected to another Simblee as a host.

I might need to send you a rough draft of the project because we will need bonding (some type of security) and signal of button/pedals that mimic the action of the buttons or pedal.
Like if it is depress, send the signal until released.

Been trying some examples now and changing as I go.

I thought com was related to apps like on iPhone and Android.

Guess I was thinking mobile..

RFD_Nelson, can you check to see if SimbleeCOM.mode = LOW_LATENCY; works.  The .mode part is black type, while the SimbleeCOM is red.
The line that says SimbleeCOM.send is all red..
« Last Edit: March 23, 2017, 02:23:34 PM by Wayne »

Wayne

  • RFduino Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Both RFduino and Simblee with other BLE's
« Reply #5 on: March 24, 2017, 06:41:21 AM »
Ok, I have learn that the SimbleeCOM.mode has to be in both the send and recv.  Done and works.

I have now change the payload of the sketch to work with buttons assignments and will attempt to light led's

This to mimic the easiest system.

How can I bond or link these together so to lockdown that other stuff can't sniff or interfere.

Wayne



tolson

  • Global Moderator
  • *****
  • Posts: 812
  • Karma: +19/-0
    • View Profile
    • Thomas Olson Consulting
Re: Both RFduino and Simblee with other BLE's
« Reply #6 on: March 24, 2017, 10:05:15 AM »
Ok, I have learn that the SimbleeCOM.mode has to be in both the send and recv.  Done and works.

I have now change the payload of the sketch to work with buttons assignments and will attempt to light led's

This to mimic the easiest system.

How can I bond or link these together so to lockdown that other stuff can't sniff or interfere.

Wayne

Hi Wayne,
[HINT] SimbleeCOM has access to a unique ESN for each Simblee chip. So you will need to develop a method how you can best access, share, and  sync up the ESNs for your devices.
It would be cool if you can share your concept of doing so in this thread as I am sure many others want to know too.
« Last Edit: March 24, 2017, 10:07:33 AM by tolson »

Wayne

  • RFduino Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Both RFduino and Simblee with other BLE's
« Reply #7 on: March 24, 2017, 10:47:58 AM »
I have assigned buttons as "1", "2" as signals for send. These end up as mode ( changes workstation modes) and Xray (this has 2 closures)
I mimic this by RED led for mode and GREEN and BLUE led's for Xray and Security.

I ended up using Switch Case to read the byte code.

1st part of code:
Code: [Select]
#include "SimbleeCOM.h"
int button = 0;
int mode_led = 2;
int xray_led = 3;
int security_led = 4;


2nd part.. Setup   

Code: [Select]
void setup() {
  Serial.begin(9600);
  SimbleeCOM.mode = LOW_LATENCY;
  SimbleeCOM.begin();
  printf("The factory assigned ESN for this Simblee is: 0x%08x\n", SimbleeCOM.getESN());
  pinMode(mode_led, OUTPUT);
  pinMode(xray_led, OUTPUT);
  pinMode(security_led, OUTPUT);

The void loop has to take care of turning off the LEDs. Still working out how to make faster, but for testing.. good enuf

Code: [Select]
void loop() {

  if (button == 0)
  {
    digitalWrite(mode_led, LOW);
    digitalWrite(xray_led, LOW);
    digitalWrite(security_led, LOW);
  }
}

Now the bulk..
Thanks to RFD_Nelson for pointers..

Code: [Select]
void SimbleeCOM_onReceive(unsigned int esn, const char *payload, int len, int rssi)
{

  printf("%d ", rssi);
  printf("0x%08x ", esn);
  // for (int i = 0; i < len; i++)
  // printf("%02x ", byte (payload[0]));
  button = byte (payload[0]);
  printf("\n");

  Serial.println(button);
  switch (button)
  {
    case 49:        // mode only
      //     Serial.println("its mode");
      digitalWrite(mode_led, HIGH);

      break;

    case 50:        // x-ray with security
      //    Serial.println("X-ray and Security");
      digitalWrite(xray_led, HIGH); digitalWrite(security_led, HIGH);
      break;
  }
  button = 0;

}

on recv, read in payload as a byte..set var button to its value.. number please for switch case

on the case of 49 ("1") recv, lite RED led
on case 50 ("2") recv, lite both Blue and Green leds

all done, button to zero.

This is the recv..  I will post the send if you like.

Wayne

Wayne

  • RFduino Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Both RFduino and Simblee with other BLE's
« Reply #8 on: March 24, 2017, 11:01:05 AM »
Ok, on the other computer, here is the send code

Code: [Select]
#include "SimbleeCOM.h"

uint8_t buttonA = 5;
char nodeA[] = {'1'};
uint8_t buttonB = 6;
char nodeB[] = {'2'};

void setup() {
  Serial.begin(9600);
  pinMode(buttonA, INPUT);
  pinMode(buttonB, INPUT);
  SimbleeCOM.mode = LOW_LATENCY;
  SimbleeCOM.begin();
  printf("The factory assigned ESN for this Simblee is: 0x%08x\n", SimbleeCOM.getESN());
}

void loop() {

   if (digitalRead(buttonA))
  {
    SimbleeCOM.send(nodeA, sizeof(nodeA));
  }
  if (digitalRead(buttonB))
  {
    SimbleeCOM.send(nodeB, sizeof(nodeB));
  }
  // SimbleeCOM.send(payload, sizeof(payload));
}


I need data now.. I mean a list of commands with some explanation.  I have all what is posted..  Or where to find more info like what exactly does SimbleeCom commands do?
Can I mix other stuff in with it .. 
Since this is new to me and I'm old (68), sometimes things seem right but caution pops up and changes logic.
Also, can a Simblee talk to or work with a RFDuino? 


3/29
I have since added low power and in idle drawing about 1ma and send is around 16ma.

« Last Edit: March 29, 2017, 07:40:45 AM by Wayne »

 

anything