Ayhan EscandarEP Education
Published

Sustainable Living - Smart Home

AI Camera are able to learn and track objects, detect number of people altogether

BeginnerProtip3 hours107
Sustainable Living - Smart Home

Things used in this project

Hardware components

BBC micro:bit board
BBC micro:bit board
×1
Expansion Board
×1
Power Module
×1
Koi2 AI Camera
×1

Software apps and online services

Ep Tec Store
MakeCode
Microsoft MakeCode
BBC Microbit

Story

Read more

Schematics

Koi2 Schematic

Smart Lock System

Code

Koi2 Object Tracking

JavaScript
basic.showIcon(IconNames.Heart)
koi2.koi2Init(SerialPin.P14, SerialPin.P15)
koi2.switchFunction(koi2.FullFunction.ObjectTracking, koi2.IOTSwitch.OFF)
while (true) {
    if (koi2.objectTrackingIsClass(koi2.VOC2012Object.Aeroplane)) {
        basic.showString("A")
    } else if (koi2.objectTrackingIsClass(koi2.VOC2012Object.Bottle)) {
        basic.showString("B")
    } else if (koi2.objectTrackingIsClass(koi2.VOC2012Object.Cat)) {
        basic.showString("C")
    }
}
basic.forever(function () {
	
})

Koi2 Image Classification

JavaScript
input.onButtonPressed(Button.A, function () {
    tabbyvision.classifyImageAddTagID("A")
})
input.onButtonPressed(Button.B, function () {
    tabbyvision.classifyImageAddTagID("B")
})
tabbyvision.init(SerialPin.P13, SerialPin.P14)
tabbyvision.switchFunction(tabbyvision.FullFunction.ClassifyImage)
basic.showIcon(IconNames.Yes)
while (true) {
    basic.showString(tabbyvision.classifyImageGetClass())
}

Smart Lock System

JavaScript
function A () {
    basic.showIcon(IconNames.Heart)
}
input.onButtonPressed(Button.A, function () {
    tabbyvision.classifyImageAddTagID("A")
})
function B () {
    basic.showIcon(IconNames.SmallHeart)
}
input.onButtonPressed(Button.B, function () {
    tabbyvision.classifyImageAddTagID("B")
})
function Init () {
    tabbyvision.init(SerialPin.P13, SerialPin.P14)
    tabbyvision.switchFunction(tabbyvision.FullFunction.ClassifyImage)
    basic.showIcon(IconNames.Yes)
}
Init()
while (true) {
    if (tabbyvision.classifyImageGetClass() == "A") {
        A()
    } else if (tabbyvision.classifyImageGetClass() == "B") {
        B()
    } else {
    	
    }
}

Credits

Ayhan Escandar
1 project • 0 followers
EP Education
1 project • 0 followers

Comments