Self-powered Wireless/Radio Switch Module

Self-powered Wireless Switch -BLE Beacon

Introduction

In life, remote controllers can be seen everywhere, and most of them are inseparable from the battery.However, we often encounter problems when using the battery, for instance, it is troublesome to replace the battery, batteries are easy to corrode in a humid environment, or the waste batteries may cause serious environmental pollution.Do you know that wireless remote control can actually work without batteries!

DFRobot has developed a self-powered wireless switch that can transmit wireless signals without the need for batteries. The switch consists of a micro generator and a BLE (Bluetooth Low Energy) RF circuit. The micro generator uses electromagnetic induction to convert the kinetic energy from pressing into electrical energy. The RF circuit rectifies and stores this electrical energy and ultimately broadcasts the BLE signal wirelessly. Any nearby device capable of scanning for BLE signals can receive the message. This switch is ideal as a maintenance-free solution for long-term monitoring of press, collision, and other state changes, making it suitable for applications such as wireless doorbells, call buttons, order buttons, and wall switches.

Features

Specification

Board Overview

Name Function
1. Programming port Reserved for custom functions
2. Expansion port Reserved for custom functions
3. Power generation button Generates energy when pressed

Scan with mobile app

Scan with ESP32

/*
   Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleScan.cpp
   Ported to Arduino ESP32 by Evandro Copercini
   Changed to a beacon scanner to report iBeacon, EddystoneURL and EddystoneTLM beacons by beegee-tokyo
*/

#include <Arduino.h>
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEScan.h>
#include <BLEAdvertisedDevice.h>
#include <BLEEddystoneURL.h>
#include <BLEEddystoneTLM.h>
#include <BLEBeacon.h>
#define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00) >> 8) + (((x)&0xFF) << 8))

float TemperatureData,HumidityData;
float Temperature,Humidity;

int scanTime = 3; //In seconds
BLEScan *pBLEScan;

class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks
{
    void onResult(BLEAdvertisedDevice advertisedDevice)
    {
      if (advertisedDevice.haveName())
      {
        if(String(advertisedDevice.getName().c_str()) == "WS_DF")
        {
          std::string strManufacturerData = advertisedDevice.getManufacturerData();
          uint8_t cManufacturerData[100];
          strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0);
          Serial.printf("Address:");

          for (int i = 2; i < 8; i++)
          {
            Serial.printf("[%X]", cManufacturerData[i]);
          }
          Serial.println();
          Serial.println("------------------");       
        }        
      }
    }
};
void setup()
{
  Serial.begin(115200);
  Serial.println("Scanning..."); 

  BLEDevice::init("");
  pBLEScan = BLEDevice::getScan(); //create new scan
  pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
  pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster
  pBLEScan->setInterval(100);
  pBLEScan->setWindow(99); // less or equal setInterval value
}
void loop()
{
  // put your main code here, to run repeatedly:
  BLEScanResults foundDevices = pBLEScan->start(scanTime, false);
  pBLEScan->clearResults(); // delete results fromBLEScan buffer to release memory
  delay(2000);
}

FAQ

More questions and cool idea, please visit DFRobot Forum

More Documents

DFshopping_car1.png Get Self-powered Wireless Switch -BLE Beacon from DFRobot Store or DFRobot Distributor.

Turn to the Top