Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
Because of un-manageable amounts of spam despite our use of CAPTCHAs, email authorization, and other tools, we have discontinued this forum (see the 700k+ registered users with validated email addresses at right?). Please email us any questions or post bug reports and feature requests on GitHub at https://github.com/jevois -- The content below remains available for future reference.

Wireless serial

0 votes

Hi,

I have some queries on the wireless serial transmission. As extracted from the vision toolkit documentation:

"Wireless serial

We have successfully used an Adafruit Feather 32u4 Bluefruit LE. We connected its serial pins to the serial port of JeVois, and wrote a trivial piece of code that would just forward serial data between the serial pins and the BLE module of the Feather. It worked well at 9600 bauds but choked at 115200. Looks like serial transmission over BLE is limited to 9600 bauds. Have a look in JEVOIS:/config/params.cfg for config options we used when transmitting serial data over Bluetooth. Other serial-to-BLE modules are available and should work fine as well, but we have not yet tested. The main drawback with the Feather 32u4 Bluefruit LE is its price ($30)."

I was trying to find out the config options in JEVOIS:/config/params.cfg but I couldn't find any. Possible to point me in the right direction for writing the configurations required for forwarding the data from serial com port of the jevois cam over via bluetooth wireless?

Thanks!

asked Feb 14, 2019 in Hardware Questions by adrielkuek (210 points)

2 Answers

+1 vote
oh, yes, we did not include this config file in JeVois inventor in an attempt to reduce the number of config files that could confuse people. But for serial baud settings this is the file you want. params.cfg is parsed only once at boot up and before any other config file. This is the only time the baud rate can be set.

In the inventor, go to the System tab and export the microSD to host computer. A new flash drive will appear on your host. Open it, then go to config, then you can open params.cfg and in there read the comments and then uncomment the lines that set serial baud rate.
answered Feb 14, 2019 by JeVois (46,580 points)
+1 vote

and now (continuing from another computer), here is the code we flashed to the bluefruit LE at the time:

// Sample UART relay using AdaFruit Feather 32u4 LE

#include <Arduino.h>
#include <SPI.h>
#if not defined (_VARIANT_ARDUINO_DUE_X_) && not defined (_VARIANT_ARDUINO_ZERO_)
  #include <SoftwareSerial.h>
#endif

#include "Adafruit_BLE.h"
#include "Adafruit_BluefruitLE_SPI.h"
#include "Adafruit_BluefruitLE_UART.h"

#define BUFSIZE                        128   // Size of the read buffer for incoming data
#define VERBOSE_MODE                   true  // If set to 'true' enables debug output
#define BLUEFRUIT_HWSERIAL_NAME      Serial1
#define BLUEFRUIT_UART_MODE_PIN        12    // Set to -1 if unused
#define BLUEFRUIT_SPI_CS               8
#define BLUEFRUIT_SPI_IRQ              7
#define BLUEFRUIT_SPI_RST              4    // Optional but recommended, set to -1 if unused
#define FACTORYRESET_ENABLE         1
#define MINIMUM_FIRMWARE_VERSION    "0.6.6"
#define MODE_LED_BEHAVIOUR          "MODE"

// Create the bluefruit object
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);

// A small helper
void error(const __FlashStringHelper*err) {
  //Serial.println(err);
  while (1);
}

/**************************************************************************/
void setup(void)
{
  //while (!Serial);  // required for Flora & Micro
  //delay(500);

  //Serial.begin(115200);
  //Serial.println(F("JeVois Bluetooth Camera Interface"));
  //Serial.println(F("------------------------------------------------"));
  Serial1.begin(9600);

  /* Initialise the module */
  //Serial.print(F("Initialising the Bluefruit LE module: "));

  if ( !ble.begin(VERBOSE_MODE) )
     error(F("Couldn't find Bluefruit, make sure it's in CoMmanD mode & check wiring?"));
  //Serial.println( F("OK!") );

  if ( FACTORYRESET_ENABLE )
  {
    /* Perform a factory reset to make sure everything is in a known state */
    //Serial.println(F("Performing a factory reset: "));
    if ( ! ble.factoryReset() ) error(F("Couldn't factory reset"));
  }

  /* Disable command echo from Bluefruit */
  ble.echo(false);

  //Serial.println("Requesting Bluefruit info:");
  /* Print Bluefruit information */
  //ble.info();

  //Serial.println(F("Please use Adafruit Bluefruit LE app to connect in UART mode"));
  //Serial.println(F("Then Enter characters to send to the JeVois camera"));
  //Serial.println();

  ble.verbose(false);  // debug info is a little annoying after this point!

  /* Wait for connection */
  while (! ble.isConnected()) {
      delay(500);
  }

  //Serial.println(F("******************************"));

  // LED Activity command is only supported from 0.6.6
  if ( ble.isVersionAtLeast(MINIMUM_FIRMWARE_VERSION) )
  {
    // Change Mode LED Activity
    //Serial.println(F("Change LED activity to " MODE_LED_BEHAVIOUR));
    ble.sendCommandCheckOK("AT+HWModeLED=" MODE_LED_BEHAVIOUR);
  }

  // Set module to DATA mode
  //Serial.println( F("Switching to DATA mode!") );
  ble.setMode(BLUEFRUIT_MODE_DATA);

  //Serial.println(F("********** READY *************"));
}

/**************************************************************************/
void loop(void)
{
  while (ble.available()) Serial1.write(ble.read());
  while (Serial1.available()) ble.write(Serial1.read());
}

answered Feb 14, 2019 by JeVois (46,580 points)
note that the arrival of the Raspberry Pi zero W is why we did not look further into this: why pay $30 for the bluefruit solution at 9600 bauds when we can pay less for a Pi zero W and get WIFI speeds?
Hi Jevois, when using the adafruit Feather or Raspberry Pi Zero W, we are using an intermediate controller to receive the serial outputs from the Jevois module and forwarding it to the bluetooth com port for wireless transmission. I see that the camera module is more than capable to configure and control a standalone BLE module on its on. I have a couple of such modules lying around in the lab and I'm thinking of directly connecting the serial TX/RX from the Jevois Cam directly to the BLE module TX/RX. The only issue is that I would need to modify the vision module code to replace the existing serial.out function with another that can directly do whatever you were trying to do in the above Arduino code to control the BLE module directly. Is this possible?

If so, perhaps I figure my starting point would be to look into the vision module C++ code where the corresponding serial.out function is used and modify from there accordingly?

Am I missing out anything?
...