Trace Unit (For Lidar Bot/Bala)

via M5Stack
$20.05
SKU M5-A048
Description

TRACE is mainly consist of 4 sets of IR, 1x infrared emitting and 1x infrared receiver for each set. The infrared LEDs should be placed towards and close to the ground where having black tracing lines and white background (or vice versa) layouts.

The IR transmitter keep emitting, at the mean time infrared ray would be absorbed by different color of objects. Black can absorb more ray than other color, so the infrared receiver (infrared sensitive phototransistor) would receive less which makes the resistance value of the phototransistor would vary with different object color. Then we assign an AD convertor tp capture the data.

This Unit communicates with the M5Core via GROVE PORTA I2C(0x5A).

Product Features

  • operation range: The reflecting surface is less than 11mm from the photoelectric surface
  • Program Platform: Arduino, UIFlow(Blockly,Python)
  • Two Lego-compatible holes

Kit includes

  • 1x TRACE Unit
  • 1x Grove Cable

Application

  • Self-tracing robot
Documents
Learn

Example

1. Arduino IDE

The code below is incomplete. To get complete code, please click here

#include <M5Stack.h>
#include "Wire.h"

#define TRACE_ADDR 0x5a

// declaration
#define VALUE_SPLIT
uint8_t value;
int SensorArray[4] = {0};

// initialization
m5.begin();
Serial.begin(115200);
Wire.begin();


// read data
Wire.beginTransmission(TRACE_ADDR);
Wire.write(0x00);
Wire.endTransmission();
Wire.requestFrom(TRACE_ADDR,1);
while(Wire.available()){
    value = Wire.read();
}
SensorArray[3] = (value&0x08)>>3;
SensorArray[2] = (value&0x04)>>2;
SensorArray[1] = (value&0x02)>>1;
SensorArray[0] = (value&0x01)>>0;

2. UIFlow

To get complete code, please click here

 

More information

Schematic

PinMap

M5Core(GROVE A) GPIO22 GPIO21 5V GND
TRACE Unit SCL SDA 5V GND