Programming the CubeCell

To program the CubeCell in this project it is used Arduino IDE. CubeCell have a framwork that is needed before starting to use the program in Arduino IDE

CubeCell framework

To download the cubecell framwork simply go to Heltec's "CubeCell Series Quick Start".

Remember you have to have Arduino IDE downloaded.

Librarys used to collect data from sensors

Adafruit AS7341 10-Channel Light / Color Sensor Breakout

Adafruit AS7341 library. As7341 guide.

BH1750 Ambient Light Sensor

BH1750 library by Christopher Laws. BH1750 guide.

SCD30 Co2, temperature and humidity sensor

Seed SCD30 Library. Scd30 guide.

Ads1115 analog to digital converter

Ads1X15-WE library by Rob tillaart. ADS1x15 guide.

Thermocouple amplifier MCP9600

Adafruit MCP9600 library. MCP9600 guide.

MAIN CODE

The main code can be found here: Main code. Download the code and open it in your arduino IDE. Compile and upload to the CubeCell. If the error "nullptr is not defined" or any error related to nullptr it is because nullptr is not declared in heltec's CubeCell framework. To fix this error follow the guide below.

Connecting to The Things Stack

After creating a new node in the things stack enter the information provided into the variables at the top of the main code depending on what connection type you chose.

Formatting is important, you can press the button to change the format of the variable.

//LoraWAN (find these in The Things Stack when creating a new node)
/* OTAA para*/
uint8_t devEui[] = { 0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x05, 0xBE, 0xBC };
uint8_t appEui[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint8_t appKey[] = { 0x0D, 0x27, 0x8C, 0x28, 0x57, 0x3E, 0xAA, 0xF8, 0xCE, 0x93, 0x49, 0x0F, 0x0F, 0x09, 0xB7, 0x77 };

/* ABP para*/
uint8_t nwkSKey[] = { 0x4E, 0xF8, 0x98, 0x1A, 0xFA, 0x6D, 0x20, 0xDD, 0x4F, 0x0F, 0x74, 0x61, 0x97, 0x99, 0x77, 0x9C };
uint8_t appSKey[] = { 0xC0, 0xE0, 0xF6, 0x43, 0xDB, 0xDE, 0x4F, 0xC4, 0xDB, 0x54, 0x7A, 0x42, 0x23, 0x9E, 0x89, 0xBB };
uint32_t devAddr =  ( uint32_t )0x260BBFEB;

Remember to select the right settings before programming. These settings should be the same as you chose in the things stack when adding a new node.

  • LORAWAN_ADR: "ON"

  • LORAWAN_AT_SUPPORT: "ON"

  • LORAWAN_CLASS: "CLASS_A"

  • LoRaWAN Debug Level: NONE

  • LORAWAN_DEVEUI: "CUSTOM" (set in code)

  • LORAWAN_Net_Reservation: "OFF"

  • LORAWAN_NETMODE: "OTAA or ABP"

  • LORAWAN_PREAMBLE_LENGTH: "8(default)"

  • LORAWAN_REGION: "REGION_EU868" (or your region)

  • LORAWAN_RGB: "ACTIVE" (useful for debugging)

  • LORAWAN_UPLINKMODE: "UNCONFIRMED" (makes it so the node doesn't have to wait for confirmation before sending new data)

Nullptr ERROR

In the current CubeCell framework v.1.5.0 nullptr is not declared. This can affect some libraries and cause an error compiling. To fix this all that is required is to #define nullptr NULL in arduino packages cubecell h file.

How to define nullptr

Open the packages for your arduino IDE, then locate the "CubeCell" package and open it. From there go to hardware -> CubeCell -> 1.5.0 -> cores -> asr650x.* When you have reached the folder asr650x open the arduino.h file and define nullptr as #define nullptr NULL. exit, save and now try to compile the arduino program .

*example where the folder can be located at, depending on where Arduino IDE is downloaded C:\Users\username\AppData\Local\Arduino15\packages\CubeCell\hardware\CubeCell\1.5.0\cores\asr650x

Last updated