Blusmirf Gold and teensy 3.0

Status
Not open for further replies.

JittrBox

Member
Hi all ,

situation: I was able to pair and get BNO05 9dof from adafruit up and running using a regular UNO ,
But what I need is to use it with the teensy 3.0 <-- because of it small size. Needs to fit in a bottle.
I hooked up everything like on the UNO , but no dice. The code works fine on the teensy 3.0 when using the usb,
but not with the bluesmirf gold.

I searched the forum here and could not find any answer.
the sketch I am using to get the BNO05 9dof sensor is the following. Except I change the baudrate to 115200 <- because I discovered
this is the speed the bluetooth runs at.


#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>

/* This driver uses the Adafruit unified sensor library (Adafruit_Sensor),
which provides a common 'type' for sensor data and some helper functions.

To use this driver you will also need to download the Adafruit_Sensor
library and include it in your libraries folder.

You should also assign a unique ID to this sensor for use with
the Adafruit Sensor API so that you can identify this particular
sensor in any data logs, etc. To assign a unique ID, simply
provide an appropriate value in the constructor below (12345
is used by default in this example).

Connections
===========
Connect SCL to analog 5
Connect SDA to analog 4
Connect VDD to 3-5V DC
Connect GROUND to common ground

History
=======
2015/MAR/03 - First release (KTOWN)
2015/AUG/27 - Added calibration and system status helpers
*/

/* Set the delay between fresh samples */
#define BNO055_SAMPLERATE_DELAY_MS (100)

Adafruit_BNO055 bno = Adafruit_BNO055(55);

/**************************************************************************/
/*
Displays some basic information on this sensor from the unified
sensor API sensor_t type (see Adafruit_Sensor for more information)
*/
/**************************************************************************/
void displaySensorDetails(void)
{
sensor_t sensor;
bno.getSensor(&sensor);
Serial.println("------------------------------------");
Serial.print ("Sensor: "); Serial.println(sensor.name);
Serial.print ("Driver Ver: "); Serial.println(sensor.version);
Serial.print ("Unique ID: "); Serial.println(sensor.sensor_id);
Serial.print ("Max Value: "); Serial.print(sensor.max_value); Serial.println(" xxx");
Serial.print ("Min Value: "); Serial.print(sensor.min_value); Serial.println(" xxx");
Serial.print ("Resolution: "); Serial.print(sensor.resolution); Serial.println(" xxx");
Serial.println("------------------------------------");
Serial.println("");
delay(500);
}

/**************************************************************************/
/*
Display some basic info about the sensor status
*/
/**************************************************************************/
void displaySensorStatus(void)
{
/* Get the system status values (mostly for debugging purposes) */
uint8_t system_status, self_test_results, system_error;
system_status = self_test_results = system_error = 0;
bno.getSystemStatus(&system_status, &self_test_results, &system_error);

/* Display the results in the Serial Monitor */
Serial.println("");
Serial.print("System Status: 0x");
Serial.println(system_status, HEX);
Serial.print("Self Test: 0x");
Serial.println(self_test_results, HEX);
Serial.print("System Error: 0x");
Serial.println(system_error, HEX);
Serial.println("");
delay(500);
}

/**************************************************************************/
/*
Display sensor calibration status
*/
/**************************************************************************/
void displayCalStatus(void)
{
/* Get the four calibration values (0..3) */
/* Any sensor data reporting 0 should be ignored, */
/* 3 means 'fully calibrated" */
uint8_t system, gyro, accel, mag;
system = gyro = accel = mag = 0;
bno.getCalibration(&system, &gyro, &accel, &mag);

/* The data should be ignored until the system calibration is > 0 */
Serial.print("\t");
if (!system)
{
Serial.print("! ");
}

/* Display the individual values */
Serial.print("Sys:");
Serial.print(system, DEC);
Serial.print(" G:");
Serial.print(gyro, DEC);
Serial.print(" A:");
Serial.print(accel, DEC);
Serial.print(" M:");
Serial.print(mag, DEC);
}

/**************************************************************************/
/*
Arduino setup function (automatically called at startup)
*/
/**************************************************************************/
void setup(void)
{
Serial.begin(9600);
Serial.println("Orientation Sensor Test"); Serial.println("");

/* Initialise the sensor */
if(!bno.begin())
{
/* There was a problem detecting the BNO055 ... check your connections */
Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
while(1);
}

delay(1000);

/* Display some basic information on this sensor */
displaySensorDetails();

/* Optional: Display current status */
displaySensorStatus();

bno.setExtCrystalUse(true);
}

/**************************************************************************/
/*
Arduino loop function, called once 'setup' is complete (your own code
should go here)
*/
/**************************************************************************/
void loop(void)
{
/* Get a new sensor event */
sensors_event_t event;
bno.getEvent(&event);

/* Display the floating point data */
Serial.print("X: ");
Serial.print(event.orientation.x, 4);
Serial.print("\tY: ");
Serial.print(event.orientation.y, 4);
Serial.print("\tZ: ");
Serial.print(event.orientation.z, 4);

/* Optional: Display calibration status */
displayCalStatus();

/* Optional: Display sensor status (debug only) */
//displaySensorStatus();

/* New line for the next sample */
Serial.println("");

/* Wait the specified delay before requesting nex data */
delay(BNO055_SAMPLERATE_DELAY_MS);
}



Do I have to switch the baudrate of the bluetooth module for it to work with the teensy 3.0 ?
To do so I would use something like Zterm for OS X.

I also stumbled upon this:

TODO: Bluetooth hardware example - using "BlueSMiRF" module from
http://www.pjrc.com/teensy/td_uart.html

Should I add this but of sketch to my BNO05 code ?


The deadline is in the next day , hopefully can provided their expertise

Endless thanks phil
 
Did you connect the BlueSMiRF to Teensy RX1 and TX1 pins? (pins 0 and 1) How you're actually connecting everything isn't clear (at least to me) from your message. So this reply is based on guessing that's the connection....

On Uno, there's only one "Serial". Pins 0 and 1 connect to the USB chip, so the same Serial talks to both USB and to pins 0 & 1.

On Teensy 3.x, there are 4 serial objects. Serial only talks to the USB. Serial1, Serial2 and Serial3 talk to the pins. This has the nice advantage that you can send different (and more) info to the USB while also sending to the 3 hardware serial ports, which is really useful for troubleshooting. :)

Perhaps simply changing "Serial" to "Serial1" might make your program work? (this is just a guess... again, I don't know how you've really connected the wires....)
 
1st, Thank you very much for the quick Reply paul.

Here is my connection setup:

BNO05 9 dof sensor (as shown in this pict. https://learn.adafruit.com/assets/24667)

gnd to teensy grnd (pin0)
Vin to teensy 3.3V (100 mA max)
SDA to teens pin 4
SCL to teensy pin 5

BlueSmirf Mate (the only difference is the pin order)
https://cdn.sparkfun.com/assets/9/9/a/3/0/5217910c757b7ffb748b4567.png

Gnd to teensy gnd (pin 0) <- the BNO05 and the blueSmirf are on the same gnd in the breadboard strip
Rx to teensy TX1 (pin 1)
TX to teensy Rx (pin 0)
Vcc to teensy 3.3V(pin V) <-- not on same 3.3V(100 mA max)pin already used by the BNO05 sensor

LIPO battery
(+) on teensy Vin (3.7 to 5.5 volts)
(-) on teensy grnd (pin 0) <-- same ground as others


Hope this is clearer .

In the meantime I will try you suggestions

endless thanks Paul
Can't wait to read you
 
Last edited:
UPDATE:
I put Serial1print or Serial1println everywhere in the code and sure enough,
I'm am able to connect in MaxMSP using Serial1. Because my bluesmirf now shows up for me to select in the serial port option.

Now the problem , (both in arduino and in MaxMSP) is that the data values are no longer getting printed in the serial Monitor
Or in I can't parse the data in MaxMSP either. Since nothing is getting print. No ASCII val are getting sent.

I honestly don'T know how to solve this

Any suggestion welcomed
thanks

phil
 
I'm sorry to maybe off as impatient, but I was wondering if you (Paul) or anyone had any other suggestions of ideas.

Endless thanks

Phil
 
thanks for the reply Paul,
As I've mentioned above, I managed to connect the Bluesmirf using Serial1, but I no longer get ASCII data values to Parse in MaxMSP.
Again, The BlueSmirf is connected but the Serial1.println "ASCII Value" is no longer getting sent.

What would you kindly suggest. What would this be.

Another question would be, have you manage to run the teensy with a BlueSmirf ?

Endless thanks
 
t
Again, The BlueSmirf is connected but the Serial1.println "ASCII Value" is no longer getting sent.

What would you kindly suggest.

You didn't follow the Forum Rule. You must post the complete code again, with the changes you've made. Nobody can see your screen and know what you've done!
 
You are absolutely right, I apologize for that.

It is precisely the same code , except all the Serial Have Serial1

------

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>

/* This driver uses the Adafruit unified sensor library (Adafruit_Sensor),
which provides a common 'type' for sensor data and some helper functions.

To use this driver you will also need to download the Adafruit_Sensor
library and include it in your libraries folder.

You should also assign a unique ID to this sensor for use with
the Adafruit Sensor API so that you can identify this particular
sensor in any data logs, etc. To assign a unique ID, simply
provide an appropriate value in the constructor below (12345
is used by default in this example).

Connections
===========
Connect SCL to analog 5
Connect SDA to analog 4
Connect VDD to 3-5V DC
Connect GROUND to common ground

History
=======
2015/MAR/03 - First release (KTOWN)
2015/AUG/27 - Added calibration and system status helpers
*/

/* Set the delay between fresh samples */
#define BNO055_SAMPLERATE_DELAY_MS (100)

Adafruit_BNO055 bno = Adafruit_BNO055(55);

/**************************************************************************/
/*
Displays some basic information on this sensor from the unified
sensor API sensor_t type (see Adafruit_Sensor for more information)
*/
/**************************************************************************/
void displaySensorDetails(void)
{
sensor_t sensor;
bno.getSensor(&sensor);
Serial1.println("------------------------------------");
Serial1.print ("Sensor: "); Serial1.println(sensor.name);
Serial1.print ("Driver Ver: "); Serial1.println(sensor.version);
Serial1.print ("Unique ID: "); Serial1.println(sensor.sensor_id);
Serial1.print ("Max Value: "); Serial1.print(sensor.max_value); Serial.println(" xxx");
Serial1.print ("Min Value: "); Serial1.print(sensor.min_value); Serial.println(" xxx");
Serial1.print ("Resolution: "); Serial1.print(sensor.resolution); Serial.println(" xxx");
Serial1.println("------------------------------------");
Serial1.println("");
delay(500);
}

/**************************************************************************/
/*
Display some basic info about the sensor status
*/
/**************************************************************************/
void displaySensorStatus(void)
{
/* Get the system status values (mostly for debugging purposes) */
uint8_t system_status, self_test_results, system_error;
system_status = self_test_results = system_error = 0;
bno.getSystemStatus(&system_status, &self_test_results, &system_error);

/* Display the results in the Serial Monitor */
Serial1.println("");
Serial1.print("System Status: 0x");
Serial1.println(system_status, HEX);
Serial1.print("Self Test: 0x");
Serial1.println(self_test_results, HEX);
Serial1.print("System Error: 0x");
Serial1.println(system_error, HEX);
Serial1.println("");
delay(500);
}

/**************************************************************************/
/*
Display sensor calibration status
*/
/**************************************************************************/
void displayCalStatus(void)
{
/* Get the four calibration values (0..3) */
/* Any sensor data reporting 0 should be ignored, */
/* 3 means 'fully calibrated" */
uint8_t system, gyro, accel, mag;
system = gyro = accel = mag = 0;
bno.getCalibration(&system, &gyro, &accel, &mag);

/* The data should be ignored until the system calibration is > 0 */
Serial1.print("\t");
if (!system)
{
Serial1.print("! ");
}

/* Display the individual values */
Serial1.print("Sys:");
Serial1.print(system, DEC);
Serial1.print(" G:");
Serial1.print(gyro, DEC);
Serial1.print(" A:");
Serial1.print(accel, DEC);
Serial1.print(" M:");
Serial1.print(mag, DEC);
}

/**************************************************************************/
/*
Arduino setup function (automatically called at startup)
*/
/**************************************************************************/
void setup(void)
{
Serial1.begin(115200);
Serial1.println("Orientation Sensor Test"); Serial1.println("");

/* Initialise the sensor */
if(!bno.begin())
{
/* There was a problem detecting the BNO055 ... check your connections */
Serial1.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
while(1);
}

delay(1000);

/* Display some basic information on this sensor */
displaySensorDetails();

/* Optional: Display current status */
displaySensorStatus();

bno.setExtCrystalUse(true);
}

/**************************************************************************/
/*
Arduino loop function, called once 'setup' is complete (your own code
should go here)
*/
/**************************************************************************/
void loop(void)
{
/* Get a new sensor event */
sensors_event_t event;
bno.getEvent(&event);

/* Display the floating point data */
Serial1.print("X: ");
Serial1.print(event.orientation.x, 4);
Serial1.print("\tY: ");
Serial1.print(event.orientation.y, 4);
Serial1.print("\tZ: ");
Serial1.print(event.orientation.z, 4);

/* Optional: Display calibration status */
displayCalStatus();

/* Optional: Display sensor status (debug only) */
//displaySensorStatus();

/* New line for the next sample */
Serial1.println("");

/* Wait the specified delay before requesting nex data */
delay(BNO055_SAMPLERATE_DELAY_MS);
}
 
It works !!!! @baudrate 115200

I believe the problem is that I hadn't put Serial1.begin(115200)

The bluesmirf runs @ 115200.

Endless thanks for you great product Paul .
You rock

Thanks !!
 
Status
Not open for further replies.
Back
Top