Basic Kit 2: Try STM32 Logging and BLE

Use this page with AI

Set up with your favorite AI

Gemini & other AI

Copy the setup prompt into your AI. Work through each step together, from checking your kit to getting it running.

Open Gemini

Copy the prompt, then paste it into Gemini’s message box.

View prompt

Table of contents

This guide is for trying the demo after swapping in the included STM32 MCU. When your Basic Kit 2 arrives, start with the assembled AVR demo. You can keep using AVR; switching to STM32 is optional.

Basic Kit 2 lets you display sensor readings on a phone or computer. Both the AVR and STM32 MCUs have a demo sketch installed, so you can try the original demos without uploading a program or setting up a development environment.

Try the preinstalled demos

  1. If this is your first time, start with the AVR demo. Keep the kit assembled and follow the AVR demo shared by Basic Kit and Basic Kit 2.
  2. Consider STM32 when you need more memory or processing capacity. If you choose to swap the MCU, use this page to try on-device logging and low-power operation.

The rest of this page covers the STM32 demo. If you have already uploaded a different sketch, see the STM32 Logger Beacon sample for instructions on uploading the original demo.

Required items and browser support

  • Basic Kit 2 and its CR2032 coin cell
  • A Bluetooth-capable phone or computer
  • Google Chrome on a supported system such as Android, Windows or Mac; Bluefy on iPhone or iPad

For the first check, connect to retrieve the log and view the graph on screen. Receiving beacons is optional. See Browser compatibility later on this page for the detailed requirements.

Setup

Before changing the stack, check the assembly and leaf replacement basics.

  1. Turn the power off and disconnect USB before changing the leaves. Remove the Connector Cover from the STM32 MCU. Remove the AVR MCU and USB leaf from the assembled block, then install the STM32 MCU as shown.

    Replace the AVR MCU and USB leaf with the STM32 MCU

  2. Set the STM32 MCU's program switch to Run.

    STM32 MCU program switch and reset button

  3. Insert the CR2032 coin cell and turn the power switch on.

    Coin cell placement and power switch

View sensor readings

Connect and start logging

  1. Turn Bluetooth on and open the STM32 Logger Beacon web app in a supported browser. Allow Bluetooth access if requested.
  2. Shake Leafony to enter its connection window, then select Connect in the web app within about 20 seconds. Select Leaf_A (the initial device name) from the list and pair. The connection sets the device's clock automatically. Continue when the app shows Connected.
  3. Check the measurement interval while still connected. Select Check interval in step 2 of the app and note the number of seconds shown. You can try the current setting first.
  4. Select Disconnect to start recording. Leave Leafony powered on and wait at least the interval you noted before retrieving the log below.

If the device does not appear in the list, shake it and try selecting it again. It waits for a connection for about 20 seconds. To change the interval, open Interval, name and stored data while connected, enter the number of seconds, and select Save interval.

Retrieve the log and view the graph

  1. Shake the device and reconnect using Connect in step 1 of the web app.
  2. Select Read stored data (Get Data) in step 4 of the app. After the stored data is received, graphs show temperature, humidity, illuminance and battery voltage.
  3. The app disconnects automatically when the transfer finishes. Connect again when you want to retrieve newer readings.

If the graphs do not show any readings yet, use Check interval while connected, select Disconnect to start recording, wait, and retrieve the log again.

Check that it worked

When measurement times and values appear in the graphs, your connection, recording and retrieval check is complete. Try beacon reception or CSV download after checking your browser's support.

Next steps

After trying the demo, set up a development environment when you want to upload your own programs.

For a different STM32 development tool, see the STM32 development environment.

Restore the demo

If you uploaded a different program, use the MCU-specific demo restoration guide. Basic Kit 2 has separate AVR and STM32 demos; select the one for the MCU currently in the stack.

Leaves included in the kit

7 types of leaves. Select a photo or name for specifications and pin assignments.

AP01 AVR MCU

An AVR microcontroller that runs your programs.
Qty: 1

AP03 STM32 MCU

Runs programs to read sensors and control other leaves. It can replace the AVR MCU.
Qty: 1

AI01 4-Sensors

Measures temperature, humidity, light, and acceleration.
Qty: 1

AC02 BLE Sugar

Sends and receives data over Bluetooth LE.
Qty: 1

AV01 CR2032

Supplies power from a CR2032 coin cell battery.
Qty: 1

AZ01 USB

Connects to a computer for programming, serial communication, and USB power.
Qty: 1

AX02 29pin

Connects leaf signals to external circuits.
Qty: 1
Accessories and other included items

AZ62 Connector Cover

Protects the connector from dust and debris.
Qty: 1

AZ66 Basic Kit Case

Holds Basic Kit and attaches it to a surface that magnets stick to, using a magnet on its base.
Qty: 1
  • Product sheet× 1
  • Product label× 1
  • CR2032 coin cell battery× 1
  • M2×18 mm screw× 2
  • Screwdriver× 1

How the STM32 demo works

Two modes of the STM32 demoMeasure and store with low power. Connect to configure the device or retrieve its log.

MOST OF THE TIME

Measure, store, broadcast

Beacon mode

Leafony
Readings
Android phone*Raspberry Pi

One-way broadcast

  • Periodically measure temperature, humidity, illuminance and battery voltage.
  • Store readings in on-device memory (EEPROM).
  • Broadcast readings by beacon, then sleep.

Power consumptionUltra-low

WHEN NEEDED

Set up and read the log

Connection mode

Leafony
Settings Stored data
PCAndroid phone*

Two-way connection

  • Initial setup: set the clock and measurement interval.
  • Transfer stored data from on-device memory (EEPROM).
  • Graph and analyze the downloaded data on a PC or Android phone*.

Power consumptionMedium

Qualitative comparison of the two modes in the demo.

Switching modes

BeaconConnection

Shake Leafony

Then select Connect in the web app.

Motion detection wakes the device and gives the app time to connect.

ConnectionBeacon

Select Disconnect to start recording in the web app.

The device resumes measuring, storing, broadcasting and sleeping.

First, connect to set the device clock. The demo needs the clock set before it can store readings.

Where the data goes

ConnectionRead and analyze the stored log

  1. Leafony memory
  2. PC / Android phone*
  3. Graphing / analysis

BeaconMonitor beacon readings nearby

  1. Leafony beacon
  2. Android phone*
  3. Real-time monitoring

BeaconApplication example: use Raspberry Pi as a receiver

  1. Leafony beacon
  2. Raspberry Pi
  3. Internet / cloud
  4. Phone: real-time graphing / analysis

This application example requires software for receiving and forwarding data, and a service for displaying it.

* Android only: the phone condition shown in the original demo diagram. The September 2022 guide also describes Bluefy for iPhone connections. Connecting and receiving live beacons have different browser requirements; see the browser notes below and the current compatibility table.

EEPROM here refers to the MCU’s internal Flash used to retain the log, rather than a separate memory leaf.

The STM32 demo normally measures, stores readings and broadcasts beacons, sleeping between cycles to reduce battery use. Connect to a PC or phone when you need to set the clock or measurement interval, or retrieve the stored log.

You can retrieve the readings stored in the device in a batch. Check the browser notes below for connecting or receiving beacons.

Web Bluetooth

The web app can retrieve and graph up to 169 samples stored in the device. If this is your first time, follow View sensor readings on this page to connect, record measurements and retrieve the log.

Browser compatibility

  • Connecting to read the log and receiving beacons without a connection have different browser requirements. Chrome provides the connection feature on Android, Windows, Mac and other supported systems. The official compatibility table lists Linux as partially implemented and unsupported, requiring additional settings.
  • Receiving beacons is optional. The web app describes this feature for Android. Chrome's Scanning API is experimental and requires chrome://flags/#enable-experimental-web-platform-features on a supported system. See the Web Bluetooth implementation status for details.
  • On iPhone and iPad, open the web app in Bluefy. The September 2022 guide reports that CSV download was unavailable. CSV download in this demo has not been retested with current Bluefy versions, so use the on-screen graph for your first check.

Demo video

Measurement interval and battery life

The measurement interval depends on the installed sketch and saved settings. The original guide estimates that intervals of several minutes may allow months of CR2032 coin cell operation. This is a theoretical estimate, not a measured runtime guarantee; battery condition, supply losses and the program's activity affect runtime. See low-power design for the calculation method.

Leaf photo
Search documentation, sample apps, and Q&A