Create Bluetooth Projects using TI CC2640R2F Launchpad Online Course

A lot of people have difficulty doing anything with CC2640R2F. But its just a matter of proper procedure of doing it. By enrolling to my online course, you get more familiar and it’s not difficult anymore.

If you are in executive level this online course could be used as training videos for your new Bluetooth Firmware Developers.

If you are a student, the online course can give you expertise with CC2640R2F. You can make Bluetooth Projects using TI CC240R2F and then publish it at hackster.io, This way your profile will be higher and might help getting a job.

If you are a professional engineer, a few more steps and you can develop the projects in the online course to products you can sell.

Check out my online course below. It is currently free.

Create Bluetooth Projects using TI CC2640R2F Launchpad

 

TI CC3220SF MQTT Exosite Murano IOT

 

CC3200SF Exosite Murano2

This project features the Texas Instruments SimpleLink™ Wi-Fi® CC3220SF LaunchPad™ and demonstrates Internet Of Things capability by sending and receiving data from Exosite Murano using MQTT.

Setting up Exosite Murano to communicate with TI CC3220SF LP:

  1. Login to exosite.io . If you do not have an existing account, create an account by signing up.
  2. Go to IOT Marketplace and select TI SimpleLink Launchpad to create a new IOT Connector.

    This slideshow requires JavaScript.

  3. Set a IOT Connector Name.exosite4
  4. Go to Home Page and select your new IOT Connector.
  5. Go to “Devices” and add a new device. Name your new device “cc3220sf”. Uncheck “Restrict provisioning period”.exosite5
  6. Click the 3 dots and select “Manually set device credentials”. Save the randomly generated token at notepad.exosite6
  7. Copy product domain link. Save domain link at notepad.

    This slideshow requires JavaScript.

  8. Go to “Settings” and select “MQTT”. Set “Password” for Authentication.

    This slideshow requires JavaScript.

  9. Go to “Resources”, and delete all resources.
  10. Create a new resource “sw1”, with data format “String”. Create 3 resource for led0, led1, led2, with data format “Boolean” and select “I want to modify this value from the cloud”.

    This slideshow requires JavaScript.

  11. Go to “Device”, click the 3 dots and select “View dashboard”. The Dashboard window, where you can set GUI, to represent your data.exosite13 
  12. Select “ADD PANE”. At the new pane click the plus sign to add widget. Create a toggle switch widget for led0, led1, and led2. Optional is to create a new pane and widget for the sw1 string.

    This slideshow requires JavaScript.

  13. Select the up arrow to hide the dashboard settings.exosite17

 

Modifying the MQTT CCS Project for Exosite Murano:

  1. You need to have the latest CCSv9.20, CC3220SF SDKv3.30, Uniflash installed.
  2. Import the CCS Project to your CCSv9.20 workspace.
  3. At mqtt_client_app.c set the SERVER_ADDRESS, device name, password.

    This slideshow requires JavaScript.

  4. Rebuild all, tirtos_builds_CC3220SF_LAUNXL_release_ccs, and mqtt_client_CC3220SF_LAUNXL_tirtos_ccs.

Uniflash Setup:

  1. Open Uniflash, and Start Image Creator for CC3220SF Launchpad. Create a project, and set Device Type “CC3220SF” and Device Mode “Develop”.

    This slideshow requires JavaScript.

  2. At Uniflash Simple View, select your CCS project bin file and select the CC2640R2F SDKv3.30 service pack bin file located at “C:\ti\simplelink_cc32xx_sdk_3_30_01_02\tools\cc32xx_tools\servicepack-cc3x20”.uniflash3
  3.  

    Go to Uniflash Development Mode -> User Files. Select the document icon to add rootca.der file.uniflash4x

  4. Make sure the CC3220SF SOP Jumper is set to 010. Select “Connect”, then “Burn”. Select Program Image.

Testing the Program:

  1. After the program is flashed to the CC3220SF Launchpad, open Serial Console. A print out of “Connection Success” indicate successful connection to Exosite Murano.teraterm1
  2. Go to “Devices”. Select the led resources to change it’s state.exosite22
  3. Go to Dashboard, change the led state using toggle switch as shown in this video below.

 

References:

Exosite Murano MQTT Reference

Next Steps:

  1. Send several sensor data to Exosite Murano.
  2. Try out ExoSense, “it is an end-to-end solution for remote monitoring applications that need to gather data from sensors, machines, PLCs, legacy controls”.

 

Continue reading TI CC3220SF MQTT Exosite Murano IOT

Adding Bluetooth Connectivity to DPS3005 PSU using TI CC2640R2F BLE MCU

This project features the Texas Instruments SimpleLink Bluetooth Low Energy CC2640R2F Launchpad interfaced to a DPS3005 Programmable Power Supply. Making the DPS3005 to have Bluetooth Connectivity.

Serial Modbus RTU is the communication protocol used between TI CC2640R2F and DPS3005. DPS3005 has a connector with pins GND, RX, TX and VCC which is used to connect to TI CC2640R2F Launchpad 3.3V pins and GND for power and also RX and TX for Serial Modbus RTU Communication.

Values set during Video Demo:

  1. Voltage – 0x0096 (1.50V), 0x00C8 (2.00V), 0x012C (3.00V), 0x0190 (4.00V)
  2. Current – 0x01F4 (0.500A)

Single Write Register Serial Modbus Format:

Address Code (1 byte), Function Code (1 byte), Register Address (2 bytes), Register Data (2 bytes), CRC Code (2 bytes)

Example Serial Modbus Format setting Voltage to 0x012C (3.00V):

0x01 0x06 0x0000 0x012C CRC Code

Bluetooth Low Energy Services shown at IOS LightBlue App:

  1. DPS Modbus Service – Custom Bluetooth Service.

 

 

Program: TI CC2640R2F DPS Peripheral

Note: See, program link README.md for instructions.

Check out my online course below:

Create Bluetooth Projects using TI CC2640R2F Launchpad

 

Bluetooth Low Energy Point of Sale using TI CC2652RB SimpleLink™ crystal-less BAW wireless MCU

IMG_20190321_234500
Bluetooth Low Energy Point of Sale System

This project features the TI CC2652RB SimpleLink™ crystal-less BAW multiprotocol 2.4-GHz wireless MCU. The CC652RB BAW technology is explained in the video below.

Overall Project Features:

  1. CC2652RB Bluetooth Low Energy Weighing Scale with 3Kg Weighing Scale Kit. This functions as a Bluetooth Peripheral Device. To properly calibrate the 3Kg Weighing Scale Kit refer to my blog post MSP430 Serial Weighing Scale. You need to get the correct calibration factor value for the Weighing Scale Kit.
  2. CC2652RB Bluetooth Low Energy Weighing Scale Point Of Sale. This functions as a Bluetooth Central Device.

Program: TI CC2652RB BLE Point Of Sale

Note: See, program link README.md for instructions.

Project Demo:

 

Check out my online course below:

Create Bluetooth Projects using TI CC2640R2F Launchpad

MSP430 Serial Weighing Scale

IMG_20190311_013602

The picture above shows a 3Kg Weighing Scale Kit with HX711 Load Cell Amplifier Board. The Weighing Scale is interfaced to the MSP430FR5969 Launchpad. The weight value is then send to PC through USB connection and then displayed at Tera Term. For testing I am using a water bottle with 1 litre of water. 1 litre of water is equivalent in weight to 1 Kg.

The Energia Program for this project is based from the resources of Sparkfun HX711 Load Cell Amplifier Board. However, the program originally works for Arduino and you would need to do some procedure for it to work for Energia.

Once you downloaded the HX711 github example firmware from Sparkfun link, you save the HX711-master folder to Energia Library folder location “C:\energia-1.8.7E21-windows\energia-1.8.7E21\libraries”.

After that you need to do a few modifications to HX711 code library, .c and .h files, for it to work for Energia. Here are some below.

  1. Replace Arduino includes with Energia.
  2. Remove unnecessary codes that is for other boards such as for ESP8266.

First thing to do is to determine the calibration factor for your weighing scale setup using the code below.

#include "HX711.h"

#define DOUT  5
#define CLK  6
// most launchpads have a red LED
#define LED RED_LED

HX711 scale(DOUT, CLK);

float calibration_factor = -146940; //for 3 kg weighing scale.

void setup() {
  // initialize the digital pin as an output.
  pinMode(LED, OUTPUT);    
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  Serial.begin(9600);
  Serial.println("HX711 calibration sketch");
  Serial.println("Remove all weight from scale");
  Serial.println("After readings begin, place known weight on scale"); 
  Serial.println("Press a,s,d,f to increase calibration factor by 10,100,1000,10000 respectively");
  Serial.println("Press z,x,c,v to decrease calibration factor by 10,100,1000,10000 respectively");

  scale.set_scale();
  scale.tare();  //Reset the scale to 0

  long zero_factor = scale.read_average(); //Get a baseline reading
  Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
  Serial.println(zero_factor);

}

void loop() {
  scale.set_scale(calibration_factor); //Adjust to this calibration factor

  Serial.print("Reading: ");
  Serial.print(scale.get_units(), 3);
  Serial.print(" Kg"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
  Serial.print(" calibration_factor: ");
  Serial.print(calibration_factor);
  Serial.println();

  if(Serial.available())
  {
    char temp = Serial.read();

    if(temp == '+' || temp == 'a')
      calibration_factor += 10;
    else if(temp == '-' || temp == 'z')
      calibration_factor -= 10;
    else if(temp == 's')
      calibration_factor += 100;
    else if(temp == 'x')
      calibration_factor -= 100;
    else if(temp == 'd')
      calibration_factor += 1000;
    else if(temp == 'c')
      calibration_factor -= 1000;
    else if(temp == 'f')
      calibration_factor += 10000;
    else if(temp == 'v')
      calibration_factor -= 10000;
    else if(temp == 't')
      scale.tare(); //Reset the scale to zero
  }  
}

Using the keys a, s, d, f, z, x, c, v, you adjust the calibration factor by 10,100,1000,10000 increments or decrements. I adjust the calibration factor until the weight of 1 Kg is shown. For 1 Kg the calibration factor is -323400.

TeraTerm1

I use this calibration factor at the HX711  Example Code.

#include <SPI.h>
#include <OneMsTaskTimer.h>
#include <LCD_SharpBoosterPack_SPI.h>
#include "HX711.h"

/*
 Example using the SparkFun HX711 breakout board with a scale
 By: Nathan Seidle
 SparkFun Electronics
 Date: November 19th, 2014
 License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).

 This example demonstrates basic scale output. See the calibration sketch to get the calibration_factor for your
 specific load cell setup.

 This example code uses bogde's excellent library: https://github.com/bogde/HX711
 bogde's library is released under a GNU GENERAL PUBLIC LICENSE

 The HX711 does one thing well: read load cells. The breakout board is compatible with any wheat-stone bridge
 based load cell which should allow a user to measure everything from a few grams to tens of tons.

 Arduino pin 2 -> HX711 CLK
 3 -> DAT
 5V -> VCC
 GND -> GND

 The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.

*/

#define calibration_factor -323400.0 //This value is obtained using the SparkFun_HX711_Calibration sketch                                 

#define DOUT  5
#define CLK   6
#define LED RED_LED

//HX711 scale(DOUT, CLK, 128);
HX711 scale(DOUT, CLK);

// Variables
LCD_SharpBoosterPack_SPI myScreen;
uint8_t myOrientation = 0;
uint16_t myCount = 0;

void setup() {

  // initialize the digital pin as an output.
  pinMode(LED, OUTPUT);    
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  Serial.begin(9600);
  //myScreen.begin();
  //myScreen.clearBuffer();
  Serial.println("HX711 scale demo");

  scale.set_scale(calibration_factor); //This value is obtained by using the SparkFun_HX711_Calibration sketch
  scale.tare();  //Assuming there is no weight on the scale at start up, reset the scale to 0

  Serial.println("Readings:");
}

void loop() {
  Serial.print("Reading: ");
  Serial.print(scale.get_units(), 3); //scale.get_units() returns a float
  Serial.print(" Kg"); //You can change this to kg but you'll need to refactor the calibration_factor
  //myScreen.setFont(1);  
  //myScreen.text(10, 40, String(scale.get_units(), 2));
  //myScreen.text(10, 25, "Kg");
  //myScreen.flush();
  Serial.println();

}

Here is video demo of the HX711 Example Program.


After the correct calibration factor is set for your weighing scale setup, the correct weight will be shown at Tera Term.

Using Cheap Logic Analyzer + Sigrok Pulseview to analyze TI Launchpad I2C Signals

vktech salae clone
Enter a caption

From my previous projects and product development, I often interface I2C sensors to microcontrollers. Usually the I2C sensor manufacturer provides code library, in which you can port and make it work with the microcontroller. But If a I2C sensor was made by STMicroelectronics, the code library they have normally works for STMicroelectronics MCU. Other I2C sensor code library often works for MCU boards that are a favorite by makers and hobbyist such as Arduino Boards.

I recently experienced interfacing a old I2C Acceleromter + Magnetometer to TI CC2640R2F Launchpad. I had trouble re-using the available code library and I had to refer to the datasheet to make a code library from scratch that would work with TI CC2640R2F Launchpad. With basic I2C read and write I was eventually able to make it work. But what would be more assuring is to be able to verify my I2C code library using a Logic Analyzer.

Professional Logic Analyzers cost 200$ to several thousand dollars. For a electronic hobbyist, spending 200$ or more for a Logic Analyzer is too expensive for me. I searched in the internet and electronic hobbyist recommends to use Sigrok Pulseview. It supports several logic analyzers which can be found in this link. I choose a VKTech Saleae Clone worth around 10$, that includes shipment.

For testing the Logic Analyzer I am going to use a CC2640R2F Launchpad + Sensor BoosterPack setup. I am going to run the TMP007 Example Program.

TMP007 Example Program Tera Term Output: 

tmp007 tera term

Relevant TMP007 I2C Address:

  • 0x40 – TMP007 I2C Slave Address
  • 0x03 – TMP007 I2C Object Temperature Register Address.
  • 0x01 – TMP007 I2C Die Temperature Register Address.

Logic Analyzer + CC2640R2F Launchpad + Sensors BoosterPack Connection:

img_20190129_130000

Sigrok PulseView Installation and Setup:

  1. Download and install Sigrok PulseView from this link.
  2. Connect Logic Analyzer USB to PC.
  3. Setup your Logic Analyzer. Select fx2lafw driver and scan for devices. Select your device and press “OK”.
  4. Click probe icon and remove unnecessary channels.
  5. Set your sampling rate and frequency.
  6. Click signal icon and select I2C.
  7. Setup and select your logic analyzer.pulseview1x
  8. Click the I2C and assign the correct channels for your I2C lines.pulseview2
  9. Click “Run” to start capturing I2C signals.

I2C Logic Analyzer Capture reading TMP007 I2C Object Temperature Register 0x03:

pulseview3

I2C Logic Analyzer Capture reading TMP007 I2C Die Temperature Register 0x01:

pulseview4

I think, I learn, I create