loading

The CSR1011 is a single mode Bluetooth Smart chip and this tutorial show how read the water level sensor through the GPIO

Step 1: Water Level Sensor

This sensor works as a switch and can trigger relays, lamps, water-bombs and send a signal to microcontrollers. The maximum sensor voltage support is 100V and 1-ampere current.

Step 2: Installing the CSR UEnergy SDK

To handle application on CSR1011 is used the Integrated Development Environment (xIDE) supplied with μEnergy Software Development Kits (SDKs). The software is provided on the CD-ROM but can also be downloaded from here.

Step 3: Software Architecture

On CSR1011 the application communicates with firmware using API calls that are implemented using firmware callbacks for various events in the application life cycle. When a project is created some functions are already implemented, these functions are used in the life cycle of the application:

  • AppPowerOnReset(): Application function called just after a power-on reset;
  • AppInit(): This function is called every boot and should contain application initialisation;
  • AppProcessSystemEvent(): Function called by firmware to process system-level events, like Low battery and PIO level change;
  • AppProcessLmEvent(): Function used to handles communication link-related events from firmware;
  • Timers: Run on top of the hardware timer with microsecond accuracy.

Step 4: Code Example to Read the Sensor State

This code demonstrates how to read the state of the water level sensor. To handle the access of the gpios were used functions available on pio.h library on group__PIO__B.html at uEnergy SDK.

Plug one sensor wire in the pin number 3 and the other connect to the GROUND.

To see the state changes is possible to use a serial program to watch it, just need set the speed to 2400.

About This Instructable

122views

2favorites

More by Matheus Campos:Dragonboard and BLE Device CSR1011 CSR1011 - Water Level Sensor Dragonboard and AWS IoT - Python 
Add instructable to: