Jon Rojí Taboada - Codemotion 2017
AND... OTHER THINGS NOT SO USEFULL...
MULTIPLE ANALOGIC AND DIGITAL I/O
ALL THE CODE YOU NEED IS ON INTERNET
NOT GREAT AT BIG CALCULATIONS
And a restricted Arduino's environment
CAMERA, BLUETOOTH, ETC...
ALL THE CODE YOU NEED IS ON INTERNET
CAN DO HEAVIER TASKS
And can do whatever you want
ODROID
NANOPC
MINOWBOARD
BEAGLEBONE
BANANA PI
CUBIEBOARD
. . .
13.99 €
13.99 € / 29.90 €
const Raspistill = require('node-raspistill').Raspistill;
...
class ImageAnalyzer {
constructor() {
this.camera = new Raspistill({
fileName: 'test',
verticalFlip: true,
width: 640,
height: 480
});
}
...
async capture() {
let photo = await this.camera.takePhoto();
}
...
}
5.99 €
GPIO (General Purpose Input/Output) refers to a generic pin in a chipset and whose behaviour can be programmed by the user
// SET MOTOR PINS
const motors = {
leftFront: 16,
rightFront: 18
};
// SET PINS I/O MODE
async.parallel([
(callback) => { gpio.setup(motors.leftFront, gpio.DIR_OUT, callback); },
(callback) => { gpio.setup(motors.rightFront, gpio.DIR_OUT, callback); },
], goForward);
// SEND 1
goForward() {
async.parallel([
(callback) => { gpio.write(this.motors.leftFront, true, callback)},
(callback) => { gpio.write(this.motors.rightFront, true, callback)}
], callback);
}
https://pinout.xyz/
Raspberry Pi Pinout guide
Have to move by remote control
Have to send images
Have to interact with the world
RPI-GPIO
class Robot {
constructor(firebaseRef) {
if (!firebaseRef) {
firebase.initializeApp(CONFIG.firebase);
firebaseRef = firebase.database().ref('orders');
}
this.direction;
this.motors = this.initPins();
this.firebaseRef = firebaseRef;
this.listenOrders();
}
listenOrders() {
this.firebaseRef.on('value', (snapshot) => {
const direction = snapshot.val().direction;
this.updateDirection(direction);
});
}
....
initPins() {
const motors = {
leftFront: 16,
leftBack: 13,
rightFront: 18,
rightBack: 15
};
async.parallel([
(callback) => { gpio.setup(motors.leftFront, gpio.DIR_OUT, callback); },
(callback) => { gpio.setup(motors.leftBack, gpio.DIR_OUT, callback); },
(callback) => { gpio.setup(motors.rightFront, gpio.DIR_OUT, callback); },
(callback) => { gpio.setup(motors.rightBack, gpio.DIR_OUT, callback); },
]);
return motors;
}
goForward() {
async.parallel([
(callback) => { gpio.write(this.motors.leftFront, true, callback)},
(callback) => { gpio.write(this.motors.rightFront, true, callback)}
]);
}
Have to move by remote control
Have to send images
Have to interact with the world
(Not selected solution)
Headless Chrome Node Api
const browser = await puppeteer.launch({
headless: true,
args: [
"--allow-running-insecure-content",
"--ignore-certificate-errors",
"--use-fake-ui-for-media-stream",
"--unsafely-treat-insecure-origin-as-secure"
],
userDataDir: "/Users/jroji/tmp/puppeteer/Chrome",
});
await page.goto('https://appr.tc/r/910993264', {
waitUntil: 'networkidle'
});
await page.click("#confirm-join-button");
STORAGE
Have to move by remote control
Have to send images
Have to interact with the world
Humidity
Distance
Temperature
Motion
...
Google Cloud Platform API KEY
Google Vision API
/**
* Construct request body for the petition
* @param {string} image
* @param {string} type
*/
constructRequest(image = this.imageURI, type = 'LABEL_DETECTION') {
return {
"requests": [
{
"features": [
{
// TYPE OF THE DETECTION, LABEL BY DEFAULT
"type": type
}
],
"image": {
"source": {
// IMAGE TO BE ANALYZED
"imageUri": image
}
}
}
]
};
}
}
storage
Banana
Have to move by remote control
Have to send images
Have to interact with the world
Have to move by remote control
Have to send images
Have to interact with the world
Chromium and Raspberry Arch limitations
Care with voltage difference
Low quality of some components
https://github.com/jroji/raspibot
Files upload
Image / Video recognition
https://es.pinout.xyz/
https://github.com/mirceageorgescu/raspi-tank-2
https://diyhacking.com/control-a-dc-motor-with-an-l298-controller-and-raspberry-pi/
https://github.com/jroji/raspibot
https://amazon.es
https://github.com/jroji/raspibot