Night R
Published © MIT

Interacting with the Flora

Improvising on Precision Farming technique, through combined efforts of DL & sensing Electrophysiological response from plant.

AdvancedFull instructions providedOver 6 days98
Interacting with the Flora

Things used in this project

Hardware components

Avnet Ultra96-V2
FireBeetle ESP32 IOT Microcontroller (Supports Wi-Fi & Bluetooth)
DFRobot FireBeetle ESP32 IOT Microcontroller (Supports Wi-Fi & Bluetooth)
Adafruit Waterproof DS18B20 Digital temperature sensor
Adafruit Waterproof DS18B20 Digital temperature sensor
Rohm BH1750 Light Intensity Sensor
SparkFun Single Lead Heart Rate Monitor - AD8232
SparkFun Single Lead Heart Rate Monitor - AD8232
60W PCIe 12V 5A Power Supply
Digilent 60W PCIe 12V 5A Power Supply
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
Thin wire electrodes and conductive jelly.

Software apps and online services

PYNQ Framework
Xilinx PYNQ Framework
Xilinx Vitis-AI
Jupyter Notebook
Jupyter Notebook
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering Station, Hobbyist
Soldering Station, Hobbyist
Mimosa Pudica 5-month sapling


Read more


Connection block diagram for MiMo_Sense


MiMo_Sense EndNode.

// Sensing environmental response[Temperature, Lux, BiopotentialVal] in Mimosa Pudica and relaying over BLE through ESP32::Ultra96V2.
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 15
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

#include <Wire.h>
#include <BH1750.h>

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

BLEServer* pServer = NULL;
BLECharacteristic* pCharacteristic = NULL;
bool deviceConnected = false;
bool oldDeviceConnected = false;
BH1750 lightMeter;

#define SERVICE_UUID "6E400001-B5A3-F393-E0A9-E50E24DCCA9E"  //Nordic UART Service
#define CHARACTERISTIC_UUID "6E400003-B5A3-F393-E0A9-E50E24DCCA9E"

class MyServerCallbacks: public BLEServerCallbacks {
    void onConnect(BLEServer* pServer) {
      deviceConnected = true;

    void onDisconnect(BLEServer* pServer) {
      deviceConnected = false;

int BPV; 
boolean BPVval = false;
int sensorPin = A0;        //pin number to use the ADC
int sensorValue = 0;      //initialization of sensor variable, equivalent to EMA Y
float EMA_a_low = 0.3;    //initialization of EMA alpha
float EMA_a_high = 0.5;
int EMA_S_low = 0;        //initialization of EMA S
int EMA_S_high = 0;
int highpass = 0;
int bandpass = 0;

void setup() {
  pinMode(12, INPUT);
  pinMode(13, INPUT);
  EMA_S_low = analogRead(sensorPin);      //set EMA S for t=1
  EMA_S_high = analogRead(sensorPin);
  // Create the BLE Device

  // Create the BLE Server
  pServer = BLEDevice::createServer();
  pServer->setCallbacks(new MyServerCallbacks());

  // Create the BLE Service
  BLEService *pService = pServer->createService(SERVICE_UUID);

  // Create a BLE Characteristic
  pCharacteristic = pService->createCharacteristic(
                      BLECharacteristic::PROPERTY_READ   |
                      BLECharacteristic::PROPERTY_WRITE  |
                      BLECharacteristic::PROPERTY_NOTIFY |

  pCharacteristic->addDescriptor(new BLE2902());

  // Start the service

  // Start advertising
  BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
  pAdvertising->setMinPreferred(0x0);  // set value to 0x00 to not advertise this parameter
  Serial.println("Waiting a client connection to notify...");

void loop() {
  int temperature = sensors.getTempCByIndex(0);  
  int lux = lightMeter.readLightLevel();
  if((digitalRead(12) == 1)||(digitalRead(13) == 1)){
    Serial.println("Leads Off!");
    //BPV = 0;
    BPVval = false;
      //Serial.print("BPV: ");
      //BPV = analogRead(A0);
      BPVval = true;  }
  sensorValue = analogRead(sensorPin);    //read the sensor value using ADC
  EMA_S_low = (EMA_a_low*sensorValue) + ((1-EMA_a_low)*EMA_S_low);  //run the EMA
  EMA_S_high = (EMA_a_high*sensorValue) + ((1-EMA_a_high)*EMA_S_high);
  //highpass = sensorValue - EMA_S_low;     //find the high-pass as before (for comparison)
  //bandpass = EMA_S_high - EMA_S_low;      //find the band-pass
  BPV = EMA_S_high - EMA_S_low;
  // notify changed value
  if (deviceConnected) {
     char TempStr [2];
     char BPVStr [2];
     char LuxStr [2];
     dtostrf (temperature, 1, 2, TempStr);
     dtostrf (BPV, 1, 2, BPVStr);
     dtostrf (lux, 1, 2, LuxStr);
     char MiMoDataStr [16];
     sprintf (MiMoDataStr, "% d,% d,% d" , temperature, lux, BPV);
     delay(3); // bluetooth stack will go into congestion, if too many packets are sent!
    // disconnecting
    if (!deviceConnected && oldDeviceConnected) {
        delay(500); // give the bluetooth stack the chance to get things ready
        pServer->startAdvertising(); // restart advertising
        Serial.println("start advertising");
        oldDeviceConnected = deviceConnected;
    // connecting
    if (deviceConnected && !oldDeviceConnected) {
        // do stuff here on connecting
        oldDeviceConnected = deviceConnected;

Sensor Data acquisition over BLE for Ultra96V2

# BLE communication script for ULTRA96V2 and MiMo_Sense. 

from bluepy import btle
import time
import binascii

# Address of BLE device to connect to.

BLE_ADDRESS = "30:AE:A4:75:29:72"

# NORDIC UART service.

BLE_SERVICE_UUID ="6e400001-b5a3-f393-e0a9-e50e24dcca9e"

# MiMo_Sense characteristic (with BLE descriptor{2902}), [Temperature, Lux, BiopotentialVal]

BLE_CHARACTERISTIC_UUID= "6e400003-b5a3-f393-e0a9-e50e24dcca9e";

class MyDelegate(btle.DefaultDelegate):

    def __init__(self):


        # ... initializations.

    def handleNotification(self, cHandle, data):

    #	data = bytearray(data)
    	data = bytearray(data)

    	print (data)

	print ('Establishing connection with the client')

dev = btle.Peripheral(BLE_ADDRESS)

dev.setDelegate( MyDelegate() )

service_uuid = btle.UUID(BLE_SERVICE_UUID)

ble_service = dev.getServiceByUUID(service_uuid)


data_chrc = ble_service.getCharacteristics(uuidConfig)[0]

# print "Debug Services..."

# for svc in

# 	print str(svc)

# print 'Debug Characteristics...'

# for ch in es_service.getCharacteristics():

# 	print str(ch)

# Enable the sensor, start notifications
# Writing x01 is the protocol for all BLE notifications.

time.sleep(3.0) # Allow to stabilise

# Main loop --------

while True:

    if dev.waitForNotifications(1.0):

        # handleNotification() was called


    print ("Waiting...")

Xilinx Adaptive Intelligence IoT::Ultra96V2


Night R

Night R

10 projects • 18 followers
R&D Engineer @ IoT Solutions Provider, Robotics Engineer @ SIS Corp., Passionate for Hardware hacking, 12+ years experience in programming..


Add projectSign up / Login