Menu
Microbots
0
  • Faire
    • Commencer
    • Constructions de créateurs
    • Éducation
  • Boutique
    • ProtoBot
    • Modules Maker
    • Outils et engrenages
    • Robots et écrans
  • À propos
    • Notre histoire
    • Tendez la main
    • FAQ
  • Connexion
  • français
  • Votre panier est vide
Microbots
  • Faire
    • Commencer
    • Constructions de créateurs
    • Éducation
  • Boutique
    • ProtoBot
    • Modules Maker
    • Outils et engrenages
    • Robots et écrans
  • À propos
    • Notre histoire
    • Tendez la main
    • FAQ
  • Langue

  • 0 0

CodeCell

CodeCell: Getting Started with Zigbee

CodeCell: Getting Started with Zigbee

CodeCell C6 is powered by the ESP32-C6, supporting Zigbee, Thread, Wi-Fi 6, and Bluetooth LE. In this guide we’ll focus on Zigbee and how you can use it with CodeCell C6 in the Arduino IDE.

CodeCell C6 Zigbee

What Is Zigbee?

Zigbee is a wireless communication protocol built for low power and reliability. Unlike Wi-Fi, Zigbee is not meant for large data transfers. Instead, it focuses on small messages between devices such as sensors, lights, switches, and smart plugs.

Key characteristics of Zigbee:

  • Low power: Great for battery-powered devices.
  • Mesh network: Each device can relay messages, extending range across a home or building.
  • Reliable: Works well even in environments with lots of Wi-Fi traffic.
  • Smart-home friendly: Used in systems like Philips Hue, Aqara, IKEA TRÅDFRI and many hubs that support Zigbee or Matter bridges.

Zigbee vs Wi-Fi vs Bluetooth LE

  • Wi-Fi: High speed, high power. Best for internet access, web servers, and cloud-connected devices.
  • Bluetooth LE: Short-range, low power. Best for phone peripherals and direct connections.
  • Zigbee: Best for sensors, automation, and smart-home devices. Because Zigbee forms a mesh, you can place small devices around a room or house, and they help extend each other’s range.

If You’re New to Zigbee + Home Assistant

If you’re just starting with Zigbee, one of the easiest ways to experiment is with Home Assistant:

  • Grab a Zigbee USB coordinator like the SONOFF Zigbee USB Dongle (or similar).
  • Plug it into a Raspberry Pi running Home Assistant.
  • In Home Assistant, add the Zigbee integration (e.g. ZHA) and pair your CodeCell C6 as a new device.

This setup makes the USB dongle your Zigbee coordinator, and your CodeCell boards become nodes on that network. 


Arduino IDE Setup for Zigbee on CodeCell C6

Before uploading the example, make sure the Arduino Tools menu is configured for Zigbee on the ESP32-C6. In the Arduino IDE, go to Tools and check:

  • Board: ESP32C6 Dev Module
  • Flash Size: 8MB (64Mb)
    This matches the C6 module’s flash size so the Zigbee stack and your sketch fit correctly.
  • Partition Scheme: Zigbee 8MB with spiffs
    This layout reserves space for the Zigbee stack and NVS while still leaving room for SPIFFS and your application.
  • Zigbee Mode: Zigbee ED (end device)
    This makes the CodeCell behave as a Zigbee end device (sensor, switch, etc.) that joins a coordinator like your Home Assistant dongle.

Once these are set, you can compile and flash the sketch below directly to your CodeCell C6 or C6 Drive.


Example 1 – Zigbee On/Off Light (CodeCell as a Simple Light)

In this example, the CodeCell controls a real lamp using Home Assistant automations:

Home Assistant Zigbee

  • Shake the CodeCell to toggle the lamp ON/OFF
  • Hold your finger near the proximity sensor to enable “brightness mode”
  • Tilt up/down to increase/decrease brightness (while proximity is active)

The CodeCell exposes two Zigbee endpoints:

  • Endpoint 1 (ZigbeeAnalog): a brightness value (0–254) derived from Pitch angle (only when proximity is active)
  • Endpoint 4 (ZigbeeBinary): a binary toggle that flips state on each shake

Important: Home Assistant will receive these as entities, but you still need to create automations that map them to your actual lamp. In our setup we created 3 automations:

  • If shake detected → toggle lamp ON/OFF
  • If tilt up → increase brightness
  • If tilt down → decrease brightness
/*
  Example: CodeCell Zigbee Lamp Control - Tilt-Brightness + Shake Switch
  Boards: CodeCell C6 / CodeCell C6 Drive

  Overview:
  - Endpoint 1 (ZigbeeAnalog): When proximity sensor is pressed, the CodeCell's Pitch angle is mapped to brightness
      Use this value in Home Assistant to set a lamp's brightness.
  - Endpoint 2 (ZigbeeBinary): toggled by a shake gesture, toggles the binary state ON/OFF
      Use this in Home Assistant to turn the lamp on/off.

  Behavior:
  - Press proximity sensor with fingure → proximity detected → "brightness control" is active.
  - Tilt the CodeCell to change Pitch → this updates the brightness value.
  - Remove your fingure → brightness control stops (lamp can stay at last value).
  - Shake the CodeCell → endpoint toggles (can be mapped to toggle lamp automations)

  Required Arduino Tools Settings:
  - Board: ESP32C6 Dev Module
  - Flash Size: 8MB (64Mb)
  - Partition Scheme: Zigbee 8MB with spiffs
  - Zigbee Mode: Zigbee ED (end device)
*/

#ifndef ZIGBEE_MODE_ED
#error "Zigbee end device mode is not selected in Tools->Zigbee mode"
#endif

#include <CodeCell.h>
#include "Zigbee.h"
#include <math.h> 

// Zigbee endpoints
#define ZIGBEE_BRIGHTNESS_ENDPOINT  1   // Numeric brightness value (0–254)
#define ZIGBEE_SHAKE_ENDPOINT       4   // Binary toggle (shake switch)

// Proximity threshold for "brightness control active"
#define PROX_ACTIVE_THRESHOLD       200U   // Adjust to taste

// Pitch → brightness mapping
#define PITCH_MIN_DEG              -45.0f  // Fully down
#define PITCH_MAX_DEG               45.0f  // Fully up

// Shake detection
const float SHAKE_THRESHOLD           = 15.0f;   // Adjust for sensitivity
const unsigned long SHAKE_DEBOUNCE_MS = 800UL;   // Minimum time between shakes

CodeCell myCodeCell;

// Zigbee endpoints
ZigbeeAnalog zbBrightness(ZIGBEE_BRIGHTNESS_ENDPOINT);
ZigbeeBinary zbShake(ZIGBEE_SHAKE_ENDPOINT);

// Motion variables
float Roll  = 0.0f;
float Pitch = 0.0f;
float Yaw   = 0.0f;

float ax = 0.0f, ay = 0.0f, az = 0.0f;

uint8_t lastBrightness           = 0;
unsigned long lastBrightReportMs = 0;
const uint8_t BRIGHT_DELTA_MIN   = 3;      // Minimum change to report
const unsigned long BRIGHT_REPORT_INTERVAL_MS = 300UL;

bool shakeState          = false;      // Toggles ON/OFF on each shake
unsigned long lastShakeMs = 0;

void handleBrightness(uint16_t proximity);
void handleShake();

void setup() {
  Serial.begin(115200);

  // Enable Light + Rotation (pitch) + Accelerometer
  myCodeCell.Init(LIGHT + MOTION_ROTATION + MOTION_ACCELEROMETER);

  myCodeCell.LED(0, 0, 0);//Turn off on-board LED

  // Brightness endpoint (analog-like input) 
  zbBrightness.setManufacturerAndModel("Microbots", "CodeCellC6-PitchBrightness");
  zbBrightness.addAnalogInput();

  // Use Espressif's "percentage" application type so ZHA treats it as a generic level
  zbBrightness.setAnalogInputApplication(ESP_ZB_ZCL_AI_PERCENTAGE_OTHER);
  zbBrightness.setAnalogInputDescription("Brightness level (0–254) from Pitch angle");
  zbBrightness.setAnalogInputResolution(1.0f);
  zbBrightness.setAnalogInputMinMax(0.0f, 254.0f);

  // Shake endpoint 
  zbShake.setManufacturerAndModel("Microbots", "CodeCellC6-ShakeSwitch");
  zbShake.addBinaryInput();
  zbShake.setBinaryInputApplication(BINARY_INPUT_APPLICATION_TYPE_SECURITY_MOTION_DETECTION);
  zbShake.setBinaryInputDescription("Shake to toggle");

  // Register endpoints with Zigbee core 
  Serial.println("Adding Zigbee endpoints (brightness + shake)");
  Zigbee.addEndpoint(&zbBrightness);
  Zigbee.addEndpoint(&zbShake);

  // Start Zigbee
  Serial.println("Starting Zigbee...");
  if (!Zigbee.begin()) {
    Serial.println("Zigbee failed to start, rebooting...");
    ESP.restart();//If not connected - reset esp32
  }

  Serial.println("Connecting to Zigbee network...");
  while (!Zigbee.connected()) {
    Serial.print(".");
    delay(100);
  }
  Serial.println("\nZigbee connected!");
}

void loop() {
  if (myCodeCell.Run(10)) { // Run sensors at 10 Hz
    
    uint16_t proximity = myCodeCell.Light_ProximityRead(); // Read proximity first (to know if brightness control is active)

    // Read rotation (roll, pitch, yaw)
    myCodeCell.Motion_RotationRead(Roll, Pitch, Yaw);

    // Handle brightness control using Pitch when proximity is active
    handleBrightness(proximity);

    // Handle shake-based toggle
    handleShake();
  }
}

/**
 * Handle brightness control:
 * - If proximity is above threshold, use Pitch to map to brightness 0–254.
 * - Sends brightness to Zigbee as analog input.
 * - LED shows brightness using green channel.
 */
void handleBrightness(uint16_t proximity) {
  unsigned long now = millis();

  if (proximity < PROX_ACTIVE_THRESHOLD) {
    // No hand close → brightness control not active
    myCodeCell.LED(0, 0, 0);  // LED off
    return;
  }

  // Clamp pitch and map to 0–254
  float pitchClamped = Pitch;
  if (pitchClamped < PITCH_MIN_DEG) {
    pitchClamped = PITCH_MIN_DEG;
  }
  else if (pitchClamped > PITCH_MAX_DEG) {
    pitchClamped = PITCH_MAX_DEG;
  }
  else{
    //skip
  }

  // Normalize Angle
  float normalized = (pitchClamped - PITCH_MIN_DEG) / (PITCH_MAX_DEG - PITCH_MIN_DEG);
  if (normalized < 0.0f) {
    normalized = 0.0f;
  } else if (normalized > 1.0f) {
    normalized = 1.0f;
  }
  else{
    //skip
  }

  uint8_t brightness = (uint8_t)(normalized * 254.0f);

  // Only report if changed enough or enough time passed
  if ( (abs((int32_t)brightness - (int32_t)lastBrightness) >= (int32_t)BRIGHT_DELTA_MIN) ||
       (now - lastBrightReportMs >= BRIGHT_REPORT_INTERVAL_MS) ) {

    lastBrightReportMs = now;
    lastBrightness = brightness;

    zbBrightness.setAnalogInput((float)brightness);
    zbBrightness.reportAnalogInput();

    Serial.print("Pitch: ");
    Serial.print(Pitch);
    Serial.print(" deg -> Brightness: ");
    Serial.println(brightness);
  }

  // Visual feedback: LED green = brightness level
  myCodeCell.LED(0, brightness, 0);
}

/**
 * Handle shake detection:
 * - Read accelerometer.
 * - If total acceleration crosses threshold (and debounce passes),
 *   toggle a Zigbee binary endpoint.
 */
void handleShake() {
  unsigned long now = millis();

  myCodeCell.Motion_AccelerometerRead(ax, ay, az);
  float totalAcceleration = sqrt(ax * ax + ay * ay + az * az);

  if (totalAcceleration > SHAKE_THRESHOLD && (now - lastShakeMs) > SHAKE_DEBOUNCE_MS) {
    lastShakeMs = now;

    // Toggle internal state
    shakeState = !shakeState;

    Serial.print("Shake detected! New switch state: ");
    Serial.println(shakeState ? "ON" : "OFF");

    // Update and report binary input (shake switch) to Zigbee
    zbShake.setBinaryInput(shakeState);
    zbShake.reportBinaryInput();
  }
}

How It Works

  • Brightness control: When your finger is close to the proximity sensor (value above PROX_ACTIVE_THRESHOLD), the CodeCell maps Pitch to a brightness value (0–254) and reports it via ZigbeeAnalog.
  • Shake toggle: A shake gesture toggles a boolean state and reports it via ZigbeeBinary. Home Assistant can use that change as a trigger.
  • Home Assistant automations: Use the CodeCell entities as triggers/inputs, then control any lamp entity you want (smart bulb, smart plug, etc.).

Other Basic Zigbee Examples You Can Try

  • Zigbee Light Switch
  • Zigbee Color Light (Control Color & Brightness)
  • Zigbee Proximity Presence Sensor
  • Zigbee Motion Sensor (BNO085 Motion State)

Try modifying thresholds, report intervals, or combining multiple endpoints in one sketch, and you’ll quickly have your own custom Zigbee devices running on CodeCell C6.

Voir l'article entier

CodeCell: Motion State

CodeCell: Motion State

CodeCell can also detect whether the device is on a table, stationary, or in motion, using its Motion State sensing feature.

Understanding Motion State Detection

The CodeCell's BNO085 sensor provides a built-in algorithm called Motion State, which classifies the device’s movement into simple, easy-to-use states.

Enable Motion State with:

myCodeCell.Init(MOTION_STATE);    // Enable motion state sensing

Read the current state using:

int state = myCodeCell.Motion_StateRead();

Motion State Reference

ID State Description
0 MOTION_STATE_UNKNOWN Not yet classified — sensor is still initializing or calibrating.
1 MOTION_STATE_ONTABLE Device is resting on a solid surface (like a desk or table).
2 MOTION_STATE_STATIONARY Not moving at all — completely still.
3 MOTION_STATE_STABLE Movement has recently stopped; sensor is stabilizing.
4 MOTION_STATE_MOTION Device is actively moving.

Tip:
The difference between Stationary and Stable:

  • Stable = recently stopped but still settling
  • Stationary = fully still for a moment

Example – Serial Motion State Monitor

This example prints the current Motion State every 100 ms.

/*
  Example: Motion State Monitor Demo
  Boards: CodeCell C3 / CodeCell C3 Light / CodeCell C6 / CodeCell C6 Drive

  Overview:
  - Demonstrates the CodeCell's Motion State sensing.
  - Continuously reports whether the device is On-Table, In Motion, Stabilizing, or Stationary.  
*/

#include <CodeCell.h>

CodeCell myCodeCell;

void setup() {
  Serial.begin(115200);           // Start USB serial at 115200 baud
  myCodeCell.Init(MOTION_STATE);  // Enable Motion State sensing
}

void loop() {
  if (myCodeCell.Run(10)) {  // Run at 10 Hz
    Serial.print("State: ");
    switch (myCodeCell.Motion_StateRead()) {
      case MOTION_STATE_STABLE:
        Serial.println("Motion Stopped - Stabilizing");
        break;
      case MOTION_STATE_ONTABLE:
        Serial.println("On Table");
        break;
      case MOTION_STATE_STATIONARY:
        Serial.println("Stationary");
        break;
      case MOTION_STATE_MOTION:
        Serial.println("In Motion");
        break;
      default:
        Serial.println("Unknown");
        break;
    }
  }
}

When to Use Motion State

  • Notify devices when picked up: Detect when a project moves.
  • Trigger actions on motion stop: Start logging or measuring once movement stabilizes.
  • Sleep mode optimization: Enter deep sleep when stationary for better battery life.

Notes

  • Motion State may take a few seconds to stabilize after powering on.
  • Mounting orientation affects sensitivity - fixed, rigid mounting gives the best results.

Voir l'article entier

CodeCell: Re-Boot

CodeCell: Re-Boot

CodeCell boot mode

CodeCell is designed to stay compact, which means it doesn’t include physical RST or BOOT buttons like larger ESP32 development boards. Instead, the board automatically enters boot mode whenever you upload new code through the Arduino IDE.

Why There’s No BOOT Button

In most ESP32 boards, the BOOT button is used to place the microcontroller into programming mode. On CodeCell, this process is handled automatically through the USB interface, saving valuable board space and keeping the design as small as possible.

When You Might Need Manual Boot Mode

If the CodeCell gets stuck in a reset loop or fails to connect during firmware upload, you can manually enter boot mode to recover and re-flash the board.

How to Manually Enter Boot Mode

  1. Connect a wire between the SCL pin and GND pin.
  2. Unplug the USB-C cable and turn off the battery (if connected).
  3. Reconnect the USB-C cable to your computer.
  4. Re-upload your firmware from the Arduino IDE.
  5. Once the upload is complete, remove the wire between SCL and GND and restore power.

After Recovery

  • The CodeCell should restart normally and run your new sketch.
  • If it still doesn’t respond, check your USB cable and Tools > Port settings.
  • Re-enable USB_CDC_On_Boot in Tools if Serial Monitor isn’t working.

Once reflashed successfully, CodeCell will continue to enter boot mode automatically during uploads, no manual steps needed.

Voir l'article entier

CodeCell: C6 Drive


CodeCell C6 Drive is a tiny all-in-one robotics board that combines an ESP32-C6 microcontroller, onboard sensors and two H-bridge motor drivers. Each of the two built-in drivers (Drive 1 & Drive 2) can deliver PWM-controlled current to directly power:

  • DC Motors & Gearmotors – for small robots, rovers, or fans.
  • Actuators & Coil-Based Devices – such as CoilPad or FlatFlap.
  • High-Power LEDs – drive lighting or status indicators with smooth PWM dimming.
  • Buzzers & Haptic Actuators – create tones or vibration effects directly from the driver.

Drive Functions

Each driver channel includes several functions for different behaviors:


// 1️⃣ Initialize driver pins and timers
myCodeCell.Drive1.Init();      

// 2️⃣ Drive(direction, power_percent)
// Run the motor or load in a direction (true = forward, false = reverse)
// with PWM power level (0–100% duty cycle)
myCodeCell.Drive1.Drive(true, 80);

// 3️⃣ Tone()
// Generate a sweeping tone using PWM – ideal for audio or feedback vibration
myCodeCell.Drive1.Tone();

// 4️⃣ Pulse(direction, ms_duration)
// Apply a short directional pulse (in milliseconds) – great for flip actuators
myCodeCell.Drive1.Pulse(true, 150);

// 5️⃣ Buzz(us_buzz)
// Toggle output rapidly to create a buzzing sound
myCodeCell.Drive1.Buzz(800);

// 6️⃣ Toggle(power_percent)
// Alternate polarity at a set duty level – creates vibration patterns
myCodeCell.Drive1.Toggle(60);

// 7️⃣ Run(smooth, power_percent, flip_speed_ms)
// Periodically flip polarity for actuators (CoilPad, FlatFlap, etc.)
myCodeCell.Drive1.Run(false, 80, 200);   // Square wave (fast)
myCodeCell.Drive2.Run(true, 60, 400);    // Smooth wave (gentle flap)

Example – Proximity-Controlled Motors

This example links the onboard VCNL4040 proximity sensor with both drive outputs. As your hand moves closer, the output motors or LEDs, spin or brighten faster.


#include <CodeCell.h>

CodeCell myCodeCell;

#define PROXIMITY_RANGE 1000U
#define MOTOR_DEADZONE 30U
#define MOTOR_MAXSPEED 90U

void setup() {
  Serial.begin(115200);
  myCodeCell.Init(LIGHT);        // Enable proximity sensing

  myCodeCell.Drive1.Init();      // Initialize both drivers
  myCodeCell.Drive2.Init();

  myCodeCell.Drive1.Tone();      // Short feedback buzz
  myCodeCell.Drive2.Tone();
}

void loop() {
  if (myCodeCell.Run(10)) {      // Run at 10 Hz
    uint16_t proximity = myCodeCell.Light_ProximityRead();
    proximity = min(proximity, PROXIMITY_RANGE);

    uint8_t speed = map(proximity, 0, PROXIMITY_RANGE,
                        MOTOR_DEADZONE, MOTOR_MAXSPEED);

    myCodeCell.Drive1.Drive(true, speed);
    myCodeCell.Drive2.Drive(true, speed);

    Serial.printf("Proximity: %u | Speed: %u%%\n", proximity, speed);
  }
}

Customization Tips

  • Change Direction: Use false in Drive() to reverse rotation.
  • Tune Deadzone & Speed: Adjust MOTOR_DEADZONE and MOTOR_MAXSPEED for your motors.
  • Alternate Effects: Replace Drive() with Pulse() or Run() for rhythmic motion for flapping actuators.
  • Combine Sensors: Use motion, or gesture sensors to control drive behavior.

 

Voir l'article entier

CodeCell: Arduino Setup

CodeCell: Arduino Setup

Follow these steps to get your CodeCell C3 or CodeCell C6 ready for programming in just a few minutes.

Step 1 – Install the Arduino IDE

Download and install the latest version from the official Arduino website.

Step 2 – Add ESP32 Board Support

  1. Open File > Preferences.
  2. In the Additional Board Manager URLs field, paste:
    https://dl.espressif.com/dl/package_esp32_index.json
  3. Click OK and restart the IDE.
  4. Go to Tools > Board > Boards Manager, search for ESP32, and click Install.

Step 3 – Install the CodeCell Library

  1. Go to Sketch > Include Library > Manage Libraries.
  2. Search for CodeCell and install the latest version.

Step 4 – Select Your Board

For CodeCell C3

  • Go to Tools > Board → select ESP32C3 Dev Module.
  • Set CPU Frequency → 160 MHz.
  • Set Partition Scheme → Default 4MB with SPIFFS.
  • Set Flash Size → 4MB 
  • Enable USB_CDC_On_Boot under Tools.

For CodeCell C6/C6-Drive

  • Go to Tools > Board → select ESP32C6 Dev Module.
  • Set CPU Frequency → 160 MHz.
  • Set Partition Scheme → 8M with SPIFFS (3MB APP / 1.5MB SPIFFS).
  • Set Flash Size → 8MB
  • Enable USB_CDC_On_Boot under Tools.

Note: For CodeCell C6 Drive make sure to also install the 'DriveCell' library

Step 5 – Select the Port & Upload

  1. Go to Tools > Port and select the port that appears when you plug in CodeCell.
  2. Open File > Examples > CodeCell > GettingStarted.
  3. Click Upload and wait for “Done Uploading.”

Step 6 – Open the Serial Monitor

Go to Tools > Serial Monitor and set the baud rate to 115200 to see messages from your CodeCell.

Quick Tips

  • Use a USB-C cable that supports data transfer, not just power charging
  • Always keep the ESP32 core and CodeCell library updated 

Your CodeCell is now ready to program in Arduino. Try the examples, explore the library, and start building your own projects!

Voir l'article entier

CodeCell C3

CodeCell C3


CodeCell C3 is a fully featured, sensor-packed board built around the ESP32-C3. Compact yet powerful, it combines wireless connectivity, battery charging, motion sensing and light sensing, in just 1.85 cm of width.

Key Features

  • Microcontroller: ESP32-C3-MINI-1-N4
  • Connectivity: Wi-Fi 4 + Bluetooth 5 (BLE)
  • Flash / SRAM: 4 MB Flash / 400 KB SRAM
  • Power: USB-C + LiPo charging (BQ24232)
  • Sensors:
    • VCNL4040 – Light + Proximity Sensor
    • BNO085 – 9-Axis IMU (accelerometer, gyro, magnetometer)

Typical Use

Ideal for wearables, motion-tracking projects, and compact robots with wireless connectivity.

Highlights

  • Tiny 1.85 cm form factor
  • USB-C power + data with auto boot mode
  • On-board charging + battery protection
  • Full Arduino IDE and CodeCell Library support
  • Connects with the MicroLink smartphone App

View schematics and 3D models: CodeCell Hardware Files

Voir l'article entier

CodeCell C3 Light

CodeCell C3 Light

CodeCell C3 Light keeps the same compact design as the C3 but removes the IMU sensor for projects focused on basic light or proximity detection. It’s a simple, low-cost entry into the CodeCell ecosystem.

Key Features

  • Microcontroller: ESP32-C3-MINI-1-N4
  • Connectivity: Wi-Fi 4 + Bluetooth 5 (BLE)
  • Flash: 4 MB SPI Flash
  • Power: USB-C + LiPo charging (BQ24232)
  • Sensor: VCNL4040 Light + Proximity

Typical Use

Best suited for tiny robots, IoT devices, ambient light loggers, touch-free switches, and other simple diy projects.

Highlights

  • Light and proximity sensing on-board
  • Same pin layout as CodeCell C3 for easy upgrade
  • Compact 1.85 cm width and auto boot mode
  • Arduino ready with CodeCell Library examples
  • Connects with the MicroLink smartphone App

View schematics and 3D models: CodeCell Hardware Files

Voir l'article entier

CodeCell C6

CodeCell C6

CodeCell C6 upgrades the CodeCell C3 with the new ESP32-C6 microcontroller — offering Wi-Fi 6, BLE 5, and Zigbee support in the same compact footprint. It’s built for advanced IoT and wearable applications that require low-power operation and extended wireless standards.

Key Features

  • Microcontroller: ESP32-C6-MINI-1-H8
  • Connectivity: Wi-Fi 6 + BLE 5 + Zigbee
  • Flash: 8 MB SPI Flash
  • Power: USB-C + LiPo charging (BQ24232)
  • Sensors:
    • VCNL4040 – Light + Proximity
    • BNO085 – 9-Axis IMU Sensor

Typical Use

Ideal for wearables, tiny robots and connected IoT devices that need multi-protocol wireless connectivity.

Highlights

  • ESP32-C6 with Wi-Fi 6 and Zigbee support
  • 8 MB flash for larger firmware and OTA updates
  • More efficient low-power modes 
  • Fully compatible with CodeCell Library for Arduino
  • Connects with the MicroLink smartphone App

View schematics and 3D models: CodeCell Hardware Files

Voir l'article entier

CodeCell C6 Drive

CodeCell C6 Drive


CodeCell C6 Drive is the all-in-one controller built for robotics. It combines the wireless ESP32-C6 with dual H-bridge motor drivers and on-board sensors, everything you need to power small robots or smart motion systems.

Key Features

  • Microcontroller: ESP32-C6-MINI-1-H8
  • Connectivity: Wi-Fi 6 + BLE 5 + Zigbee
  • Flash: 8 MB SPI Flash
  • Motor Drivers: Dual H-Bridge Drivers for 2 DC-motors/Actuators
  • Power: USB-C + LiPo charging (BQ24232)
  • Sensors: VCNL4040 + BNO085 9-Axis IMU

Typical Use

Designed for mobile robots and sensor systems that require built-in motion control and wireless connectivity.

Highlights

  • Built-in dual motor drivers, no external boards needed
  • Tiny Form-factor 2.25x1.85cm (0.89 × 0.73 in)
  • USB-C power and charging built-in
  • Full support in CodeCell Arduino Library examples
  • Connects with the MicroLink smartphone App

View schematics and 3D models: CodeCell Hardware Files

Voir l'article entier

Linking Your CodeCell to the MicroLink App

Lier votre CodeCell à l'application MicroLink

L'application MicroLink simplifie le contrôle sans fil de votre CodeCell , que vous construisiez de petits robots, installiez des capteurs ou expérimentiez des projets interactifs. Grâce à des boutons, des curseurs, un joystick et la diffusion de données en temps réel, vous pouvez contrôler, surveiller et déboguer vos projets directement depuis votre téléphone : sans fil, sans souci.

Application MicroLink

Qu'est-ce que MicroLink ?

MicroLink est une application mobile Bluetooth conçue pour interagir avec nos appareils, dont le CodeCell . Associé à la bibliothèque MicroLink Arduino, votre CodeCell peut :

  • Lire les entrées à partir de 4 boutons, 3 curseurs et un joystick
  • Envoyez des données de capteur en direct telles que le niveau de la batterie, la proximité et le cap
  • Imprimer des messages dans l'application pour le débogage ou l'affichage
  • Réagissez en temps réel pour contrôler les entrées

Cela rend MicroLink idéal pour le contrôle à distance, le retour en direct et la construction d'électronique interactive.

Installation de la bibliothèque

Installez la bibliothèque CodeCell MicroLink depuis le gestionnaire de bibliothèques Arduino. Elle comprend six exemples de schémas couvrant les fonctions de base du retour d'information des capteurs, de la télécommande et de l'interaction avec les moteurs.

Comment ça marche

Voici un aperçu rapide de la manière dont votre CodeCell communique avec l'application :

Initialisation

myMicroLink.Init();

Cela configure les boutons, les curseurs, le joystick et les notifications Bluetooth pour la batterie, la proximité, le cap et les messages.

Envoi de données de capteur

 myMicroLink.ShowSensors(battery, proximity, heading);

Envoie uniquement lorsque les valeurs changent, réduisant ainsi le trafic BLE.

Envoi de messages

 myMicroLink.Print("Hello from CodeCell");

Utilisez cette fonction pour envoyer des messages de débogage ou d'état. Print() prend en charge les chaînes jusqu'à 20 caractères. Combinez texte et variables comme suit :

 sprintf(message, "%u RPM", MotorRPM);
 myMicroLink.Print(message);

Contrôles de lecture

Utilisez ces fonctions pour lire les entrées de l’application :

 myMicroLink.ReadButtonA(); // true if pressed
 myMicroLink.ReadButtonB();
 myMicroLink.ReadButtonC();
 myMicroLink.ReadButtonD();
 myMicroLink.ReadSlider1(); // 0–100
 myMicroLink.ReadSlider2();
 myMicroLink.ReadSlider3(); 
myMicroLink.ReadJoystickX(); // axe X du joystick
 myMicroLink.ReadJoystickY(); // axe Y du joystick

Une fois que l’un d’entre eux est utilisé dans votre code, il apparaît automatiquement dans l’application MicroLink.

Exemple 1 – Contrôle du moteur avec curseurs

Dans cet exemple, deux modules DriveCell contrôlent des moteurs. Deux curseurs dans l'application permettent de régler la vitesse des moteurs. Un bouton permet d'inverser la polarité :

 uint8_t slider1 = myMicroLink.ReadSlider1();
 uint8_t slider2 = myMicroLink.ReadSlider2();
 DriveCell1.Drive(polarity, slider1);
 DriveCell2.Drive(polarity, slider2);

Inverser la polarité en appuyant sur un bouton :

 if (myMicroLink.ReadButtonA()) {
 polarity = !polarity;
 myMicroLink.Print("Reversing Polarity");
 }

Essayez-le vous-même

Une fois installé, ouvrez l'IDE Arduino et accédez à :

Fichier → Exemples → CodeCell MicroLink

Vous trouverez 6 exemples de croquis prêts à être explorés et personnalisés ; aucune configuration avancée n'est requise. Commencez par les exemples, explorez les commandes et créez quelque chose d'amusant !

Télécharger

L'application MicroLink Connect est disponible sur Google Play Store et Apple iOS . Entièrement gratuite , elle propose une interface épurée et sans publicité.

Si vous avez besoin d'aide supplémentaire, n'hésitez pas à nous contacter - Happy Building !


Voir l'article entier

Debugging CodeCell

Débogage de CodeCell

CodeCell est conçu pour être facile à configurer et à utiliser, mais comme tout microcontrôleur, des problèmes peuvent survenir. Ce guide vous aidera à dépanner et à déboguer efficacement CodeCell.

Assurez-vous d'avoir les dernières versions de la bibliothèque

Avant de procéder au dépannage, assurez-vous que vous utilisez les dernières versions de :

  • Bibliothèque CodeCell → Mettez toujours à jour vers la dernière version pour les corrections de bogues et les améliorations.
  • Pack de support de la carte ESP32C3 → Assurez-vous que les dernières définitions de la carte ESP32-C3 sont installées dans l'IDE Arduino.

Pour mettre à jour :

  1. Ouvrez l'IDE Arduino et accédez à Sketch > Inclure la bibliothèque > Gérer les bibliothèques .
  2. Recherchez CodeCell et installez la dernière version.
  3. Accédez à Outils > Carte > Gestionnaire de cartes , recherchez ESP32 et mettez à jour vers la dernière version.

Configuration et utilisation de CodeCell

Pour faciliter la programmation, la bibliothèque CodeCell propose diverses fonctions d'initialisation, de lecture et de gestion des capteurs et de l'alimentation. Voici tout ce que vous devez savoir pour configurer votre appareil et sa bibliothèque.

Déballage de votre CodeCell

À l'intérieur de la boîte, vous trouverez :

  • CodeCell : une carte minuscule mais puissante basée sur ESP32-C3 avec des GPIO et des capteurs programmables.
  • Vis : Quatre vis M1,2 x 6 mm pour le montage.
  • Embases : Trois jeux d'embases femelles (soudées ou non soudées, selon votre sélection).
  • Batterie/Câble : Si acheté, une batterie LiPo 170mAh 20C avec un câble pré-soudé ou un câble de connecteur de batterie.

Mise sous tension de CodeCell pour la première fois

Branchez un câble USB-C et CodeCell va :

  • Initialisez ses périphériques et capteurs internes. L'état est affiché sur le moniteur série et vous indique tout problème détecté.
  • Vérifier l'état de l'alimentation :
    • Si aucune batterie n'est connectée, une animation LED respiratoire se produit.
    • Si alimenté par USB, la LED clignote en bleu .
    • Si l'appareil fonctionne sur batterie, la LED clignote en vert .
    • En cas de charge, la LED reste bleue statique jusqu'à ce que la charge soit complète.

Problèmes d'alimentation courants et solutions :

  • Le numéro de série ne fonctionne pas ?
    • Vérifiez si votre câble USB-C prend en charge à la fois l’alimentation et les données .
    • Assurez-vous que Tools/USB_CDC_On_Boot est activé
    • Essayez un autre port USB ou un autre adaptateur secteur.
  • Batterie non détectée ?
    • Assurez-vous que la batterie est correctement connectée et chargée.

Connexion de CodeCell à l'IDE Arduino

Étape 1 : installer l'IDE Arduino

Téléchargez la dernière version depuis le site officiel d'Arduino .

Étape 2 : ajouter la prise en charge de la carte ESP32

  1. Ouvrez Arduino IDE et allez dans Fichier > Préférences .
  2. Dans le champ « URL supplémentaires du gestionnaire de cartes », saisissez :
     https://dl.espressif.com/dl/package_esp32_index.json
    
  3. Cliquez sur OK et redémarrez Arduino IDE.

Étape 3 : sélectionnez la carte et le port appropriés

  1. Accédez à Outils > Carte > Module de développement ESP32C3 .
  2. Sélectionnez le port COM correct sous Outils > Port .
  3. Activez USB_CDC_On_Boot dans Outils > USB_CDC_On_Boot .
  4. Réglez la vitesse d'horloge du processeur sur 160 MHz .

Étape 4 : Installer la bibliothèque CodeCell

  1. Accédez à Sketch > Inclure la bibliothèque > Gérer les bibliothèques .
  2. Recherchez CodeCell et installez la dernière version.
  3. Ouvrez Fichier > Exemples > CodeCell et essayez l’exemple GettingStarted .

Étape 5 : Téléchargez et exécutez votre premier croquis

  1. Cliquez sur le bouton Télécharger .
  2. Ouvrez Outils > Moniteur série pour voir la sortie de votre CodeCell.

Bibliothèque et fonctions CodeCell

Initialisation de CodeCell

La première étape consiste à initialiser le CodeCell en utilisant :

 myCodeCell.Init(SENSOR_MACRO);

Macros disponibles :

  • LUMIÈRE → Active la détection de lumière.
  • MOTION_ACCELEROMETER → Active la détection par accéléromètre.
  • MOTION_GYRO → Active la détection du gyroscope.
  • MOTION_MAGNETOMETER → Active la détection du magnétomètre.
  • MOTION_STEP_COUNTER → Active le comptage des pas.
  • MOTION_ACTIVITY → Détecte la marche, la course ou la conduite.

Vous pouvez combiner plusieurs macros à l'aide de l'opérateur + :

 myCodeCell.Init(LIGHT + MOTION_ACCELEROMETER + MOTION_GYRO);

Débogage plus détaillé

  • CodeCell non détecté dans l'IDE Arduino
    • Assurez-vous que le câble USB-C prend en charge le transfert de données , pas seulement l'alimentation.
    • Redémarrez l'IDE Arduino et essayez de sélectionner le bon port COM .
    • Vérifiez le Gestionnaire de périphériques (Windows) / Rapport système (Mac) pour vérifier si CodeCell apparaît comme un périphérique USB .
  • Le téléchargement du code échoue
    • Assurez-vous que USB_CDC_On_Boot est activé.
    • Si CodeCell est bloqué dans une boucle de réinitialisation :
      • Court-circuiter SCL (GPIO9) vers GND .
      • Débranchez l'USB et éteignez la batterie.
      • Rebranchez la clé USB et téléchargez à nouveau le croquis.
      • Retirez le court-circuit une fois reprogrammé.
  • Le moniteur série n'affiche pas les données
    • Assurez-vous que le débit en bauds est défini sur 115 200 .
    • Allez dans Outils > USB_CDC_On_Boot et activez-le.
    • Assurez-vous que le câble USB-C prend en charge le transfert de données , pas seulement l'alimentation.
    • Essayez de redémarrer le moniteur série.
  • Comportement inattendu des LED
    • 🔴 Rouge clignotant → Batterie faible (<3,3 V), entrée en mode veille.
    • 🔵 Bleu statique → Chargement de la batterie.
    • 🟢 Respirer vert → Fonctionne sur batterie.
    • 🔵 Respiration bleue → Complètement chargée.
  • Les capteurs ne répondent pas
    • Assurez-vous d'avoir initialisé le bon capteur à l'aide de myCodeCell.Init(SENSOR_MACRO);
    • Vérifiez le moniteur série, cela devrait vous aider à identifier pourquoi le capteur ne répond pas
    • Si vous utilisez des capteurs externes, évitez d'utiliser les adresses I2C 0x60 (VCNL4040) et 0x4A (BNO085) car il y aura des conflits

Réflexions finales

Nous espérons que cela vous a aidé à identifier la cause du problème. Si le problème persiste, n'hésitez pas à nous contacter ; nous serons ravis de vous aider !

Voir l'article entier

CodeCell: Connecting with BLE

CodeCell : Connexion avec BLE

Le Bluetooth Low Energy (BLE) est un puissant moyen de communication sans fil entre votre CodeCell et d'autres appareils tels que les smartphones, les tablettes et même d'autres microcontrôleurs. Dans ce guide, nous allons configurer le BLE sur CodeCell, lui permettre de recevoir des commandes d'un client BLE et contrôler ses LED RVB en fonction des données reçues.

Qu'est-ce que BLE ?

Le BLE est une version économe en énergie du Bluetooth qui permet aux appareils d'échanger de petites quantités de données avec une faible consommation d'énergie. Voici ses concepts clés :

  • Serveur BLE → CodeCell agit comme un serveur , se faisant connaître auprès d'autres appareils.
  • Client BLE → Un téléphone, une tablette ou un autre microcontrôleur qui se connecte à CodeCell.
  • Service BLE → Un ensemble de caractéristiques qui définissent les données envoyées.
  • Caractéristique BLE → Un point de données spécifique (par exemple, pressions sur les boutons, lectures de capteurs).

Affichage des données BLE sur un smartphone

Avant de commencer les tests, vous devez télécharger une application pour envoyer des données BLE sur votre smartphone. Commencez donc par la télécharger. une application de scanner BLE :

  • Android → nRF Connect ou « Scanner BLE »
  • iOS → nRF Connect

Configuration de BLE sur CodeCell

Pour que CodeCell se présente comme un appareil BLE , nous devons initialiser BLE, créer un service et une caractéristique, et commencer à faire de la publicité .

Ce code crée un serveur BLE , annonce un service et configure une caractéristique lisible et écrivable par un appareil connecté. Le CodeCell recevra la caractéristique du bouton et contrôlera sa LED RVB intégrée :

  • Si la valeur du bouton est 1 , la LED devient rouge .
  • Si la valeur du bouton est 0 , la LED devient verte .
 #include <BLEDevice.h>
 #include <BLEUtils.h>
 #include <BLEServer.h>
 #include <BLE2902.h>

 #include <CodeCell.h>
 CodeCell myCodeCell;

 BLECharacteristic *pButtonCharacteristic = NULL;
 #define BUTTON_UUID "abcd1234-abcd-1234-abcd-123456789012"

 class MyServerCallbacks : public BLEServerCallbacks {
 void onConnect(BLEServer *pServer) override {
 Serial.println("BLE Connected");
 delay(1000);
 }

 void onDisconnect(BLEServer *pServer) override {
 Serial.println("BLE Disconnected");
 delay(500);
 BLEDevice::startAdvertising(); // Restart advertising
 }
 };

 // Callback class for handling button writes
 class ButtonCallback : public BLECharacteristicCallbacks {
 void onWrite(BLECharacteristic *pCharacteristic) override {
 String value = pCharacteristic->getValue();

 if (value.length() > 0) {
 int buttonState = value[0];

 Serial.print("Button State: "); 
Serial.println(boutonÉtat);

 si (buttonState == 1) {
 myCodeCell.LED(255, 0, 0); // LED rouge lorsque le bouton est à 1
 } autre {
 myCodeCell.LED(0, 255, 0); // LED verte lorsque le bouton n'est pas à 1
 }
 }
 }
 };

 void setup() {
 Serial.begin(115200);
 myCodeCell.Init(LIGHT); // Initialise le capteur de lumière

 BLEDevice::init("CodeCell_BLE"); // Définir le nom du périphérique BLE
 Serveur BLE *bleServer = BLEDevice::createServer();
 bleServer->setCallbacks(nouveau MyServerCallbacks());

 BLEService *bleService = bleServer->createService(BLEUUID("12345678-1234-5678-1234-56789abcdef0"));

 // Créer une caractéristique BLE pour l'état du bouton
 pButtonCharacteristic = bleService->createCharacteristic(
 BOUTON_UUID,
 BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE
 );
 pButtonCharacteristic->addDescriptor(nouveau BLE2902());
 pButtonCharacteristic->setCallbacks(nouveau ButtonCallback());

 bleService->start();
 
BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
 pAdvertising->addServiceUUID("12345678-1234-5678-1234-56789abcdef0");
 BLEDevice::startAdvertising();
 }

 boucle vide() {
 // Pas besoin de vérifier en permanence, les mises à jour LED ne se font que lors de l'écriture BLE
 }

Comment fonctionne ce code

  • Initialisation BLE → CodeCell se présente comme un périphérique BLE appelé "CodeCell_BLE" .
  • Service et caractéristique BLE → Un service avec une caractéristique de bouton est créé.
  • Rappels BLE → Le serveur affiche « BLE Connecté » lorsqu'un client se connecte et « BLE Déconnecté » lorsqu'il se déconnecte.
  • Redémarrage de la publicité → Une fois déconnecté, le BLE redémarre automatiquement la publicité afin que de nouveaux appareils puissent se connecter.

Test du contrôle LED

  • Connectez-vous à "CodeCell_BLE" dans l'application BLE Scanner.
  • Sélectionnez le service que vous avez créé - généralement affiché comme Service inconnu
  • Recherchez la caractéristique du bouton ( BUTTON_UUID ) et envoyez la valeur :
    • Écrire 1 → La LED devient rouge 🔴
    • Écrire 0 → la LED devient verte 🟢

Envoi de données de capteur

Ensuite, nous allons définir une nouvelle caractéristique BLE qui permet à CodeCell d' envoyer des valeurs de capteur à un appareil connecté .

 #include <BLEDevice.h>
 #include <BLEUtils.h>
 #include <BLEServer.h>
 #include <BLE2902.h>

 #include <CodeCell.h>
 CodeCell myCodeCell;

 BLECharacteristic *pSensorCharacteristic = NULL;
 #define SENSOR_UUID "abcd5678-abcd-5678-abcd-56789abcdef0"

 class MyServerCallbacks : public BLEServerCallbacks {
 void onConnect(BLEServer *pServer) override {
 Serial.println("BLE Connected");
 delay(1000);
 }

 void onDisconnect(BLEServer *pServer) override { 
Serial.println("BLE déconnecté");
 délai(500);
 BLEDevice::startAdvertising(); // Redémarrer la publicité
 }
 };

 configuration vide() {
 Serial.begin(115200);
 myCodeCell.Init(LIGHT); // Initialiser le capteur de lumière et de proximité

 BLEDevice::init("CodeCell_BLE"); // Nommer le périphérique BLE
 Serveur BLE *bleServer = BLEDevice::createServer();
 bleServer->setCallbacks(nouveau MyServerCallbacks());

 BLEService *bleService = bleServer->createService(BLEUUID("12345678-1234-5678-1234-56789abcdef0"));

 // Créer une caractéristique BLE pour les données du capteur
 pSensorCharacteristic = bleService->createCharacteristic(
 CAPTEUR_UUID,
 BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_NOTIFY
 );
 pSensorCharacteristic->addDescriptor(nouveau BLE2902());

 bleService->start();

 BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
 pAdvertising->addServiceUUID("12345678-1234-5678-1234-56789abcdef0");
 BLEDevice::startAdvertising();
 }

 boucle vide() { 
if (myCodeCell.Run(10)) { // Lecture toutes les 100 ms (10 Hz)
 uint16_t proximity = myCodeCell.Light_ProximityRead();
 Serial.print("Proximité : ");
 Serial.println(proximité);

 // Convertir la valeur de proximité en chaîne et l'envoyer via BLE
 Chaîne de proximitéStr = String(proximité);
 pSensorCharacteristic->setValue(proximityStr.c_str());
 pSensorCharacteristic->notify(); // Notifier l'appareil connecté
 }
 }

Comment ça marche ?

  • Ce code définit une nouvelle caractéristique ( SENSOR_UUID ) que les clients peuvent lire et obtenir des mises à jour en temps réel :
    • PROPERTY_READ → Permet au client de lire la valeur manuellement.
    • PROPERTY_NOTIFY → Envoie automatiquement des mises à jour lorsque de nouvelles données sont disponibles.
  • La fonction Light_ProximityRead() obtient une valeur du capteur de lumière embarqué qui détecte les objets à proximité. Nous convertissons le nombre en chaîne et l'envoyons au client BLE.

Essayez-le

Maintenant que CodeCell envoie des données de capteur de proximité via BLE , vous pouvez les visualiser sur un téléphone .

  • Ouvrez une application BLE comme nRF Connect (Android/iOS)
  • Recherchez "CodeCell_BLE" et connectez-vous
  • Trouver la caractéristique du capteur ( SENSOR_UUID )
  • Activez les notifications et regardez la mise à jour des données de proximité en temps réel !
  • Les données de votre moniteur série doivent correspondre aux données envoyées à votre téléphone

Déplacez un objet près du capteur et voyez comment les valeurs changent !

Quelle est la prochaine étape ?

Maintenant que vous pouvez contrôler CodeCell via BLE, essayez :

  • Ajout de commandes supplémentaires (par exemple, LED bleue, clignotant, déclencheurs de capteur)
  • Réception de plusieurs valeurs (par exemple, envoi de données d'accéléromètre ou de capteur de proximité)
  • Construire un appareil IoT entièrement contrôlé par BLE ou même le connecter à une autre application


Voir l'article entier


1 2 3 Suivant »
Partage

Github

  • À propos
  • Logiciel
  • Éducation
  • Contact
  • FAQ
  • Termes
  • Politique de remboursement
  • politique de confidentialité

Soyez le premier informé des nouveaux projets et bénéficiez d'offres intéressantes !

© 2026 Microbots.

★ Reviews

Let customers speak for us

67 reviews
Write a review
85%
(57)
6%
(4)
1%
(1)
3%
(2)
4%
(3)
62
21
C
CodeCell C3
Cloke74

Great piece of kit, had just what i needed to complete the project i had in mind. Shame shipping to the UK is so expensive, but appreciate this isn’t necessarily in the hands of MicroBots

A
CodeCell C6
Anonymous

I had an issue, got a red light, I used too much flux. Support said clean it, then the one sensor worked fine. I got the help and answer same day I provided a foto.

A
CodeCell C6 Drive
Anonymous

I think this is the best of the ESP offered, most versatile.

User picture
P
CodeCell C6
Prudhvi tej Chinimilli

Been testing the Microbots CodeCell C6 and honestly impressed with how much functionality they packed into such a tiny module. Great form factor for rapid prototyping wearable/embedded sensing applications. ESP32-C6 + IMU integration makes development much easier compared to building everything from scratch.

Still exploring battery optimization and compact LiPo options for our use case, but overall the platform is promising for low-cost real-time sensing systems. Excited to keep building with it.

F
CodeCell C6
Francisco Estivallet

Amazing hardware, my go to for compact projects.

User picture
123