Menu
Microbots
0
  • Learn
    • Getting Started
    • Maker Builds
    • Education
  • Shop
    • Modules & Parts
    • Tools & Gears
    • Robots & Displays
  • About
    • Our Story
    • Reach Out
    • FAQs
  • Sign in
  • English
  • Your Cart is Empty
Microbots
  • Learn
    • Getting Started
    • Maker Builds
    • Education
  • Shop
    • Modules & Parts
    • Tools & Gears
    • Robots & Displays
  • About
    • Our Story
    • Reach Out
    • FAQs
  • Language

  • 0 0

CodeCell: Activity

CodeCell Activity Detection

CodeCell can recognize your physical activity, such as walking, running, cycling, or driving - using its onboard BNO085 motion sensor. 

How It Detects Activity

The BNO085 uses built-in sensor fusion algorithms to classify your movement patterns. It processes data from the accelerometer, gyroscope, and magnetometer to estimate your current activity.

Enable activity recognition with:

myCodeCell.Init(MOTION_ACTIVITY);   // Enable activity classification

Read the detected activity using:

int activity = myCodeCell.Motion_ActivityRead();   // Returns activity ID (1–8)

Activity ID Reference

ID Activity
1 Driving
2 Cycling
3 Walking
4 Still
5 Tilting
6 Walking 
7 Running
8 Climbing Stairs

Example – Display Activity on OLED

This example reads CodeCell’s current activity and displays it on an OLED screen using the Adafruit SSD1306 library. Connect your OLED display to 3V3, GND, SDA, and SCL pins.


#include <CodeCell.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

CodeCell myCodeCell;

/* OLED Configuration */
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

int read_timer = 0;

void setup() {
  Serial.begin(115200);
  myCodeCell.Init(MOTION_ACTIVITY);  // Enable activity sensing

  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("Display Error"));
  }

  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.display();
  delay(2000);
}

void loop() {
  if (myCodeCell.Run(10)) {          // Run loop at 10 Hz
    if (read_timer < 10) {
      read_timer++;
    } else {
      read_timer = 0;                // Update every 1 second
      display.clearDisplay();
      display.setCursor(32, 16);
      display.print(F("Activity: "));
      display.setCursor(32, 24);

      switch (myCodeCell.Motion_ActivityRead()) {
        case 1: display.print("Driving"); break;
        case 2: display.print("Cycling"); break;
        case 3:
        case 6: display.print("Walking"); break;
        case 4: display.print("Still"); break;
        case 5: display.print("Tilting"); break;
        case 7: display.print("Running"); break;
        case 8: display.print("Stairs"); break;
        default: display.print("Reading.."); break;
      }

      display.display();
    }
  }
}

Note: It may take 10–30 seconds for the sensor to stabilize and begin accurately classifying motion, depending on mounting orientation and environment.

Customization Tips

  • Combine with Step Counting: Pair with MOTION_STEP_COUNTER for full fitness tracking.
  • Trigger Feedback: Use LEDs or buzzers to indicate when specific activities are detected.
  • Data Logging: Record time spent in each activity type for performance tracking.
  • Share:

Follow

Github

  • About
  • Software
  • Education
  • Contact
  • FAQs
  • Terms
  • Refund Policy
  • Privacy Policy

Join our Community ~ Be the first to know about new products and get exciting deals!

© 2026 Microbots.

★ Reviews

Let customers speak for us

50 reviews
Write a review
84%
(42)
4%
(2)
2%
(1)
4%
(2)
6%
(3)
21
46
B
CodeCell C6 Drive
Brandon

Awesome product with great tutorials and example code

G
MotorCell
Gerald Kendrick

Very happy with my MotorCell. I'm incorporating it into a prototype project that will hopefully result in me needing a few more!

User picture
A
CodeCell C6 Drive
Anonymous

Great product! Having the IMU, motor driver, and battery management directly on the board is incredibly handy for quick prototyping. Love it!

Improvement ideas:
- using an ESP32 other than the C6 to get more cores. On a single-core chip, WiFi tasks often interfere with real-time applications.
- adding two more motor drivers (with a slightly higher current rating) would be awesome for drone projects!
- I know the compactness of the board is a huge selling point and really optimised, but exposing a few more pins would be great. With the motor drivers already occupying 4 pins, having only 4 GPIOs left can be tight for complex projects (though I’m nitpicking, I’m really pushing this board to its limits!).

A
CodeCell C6
Anonymous

I use CodeCell C6, like all the Features, and compactness. The remote Link to the iPhone with some Controls for 2 Motors is just perfect for the job.

O
CodeCell C6 Drive
Odd_Jayy

This is one of my Favorite finds, this board has everything you need to make a quick and small robot, easy to set up and install. Perfect for beginners or a person who needs to save room in their build.

User picture
123