Skip to content
Brooke Morrison edited this page Mar 24, 2020 · 3 revisions

This is the guide for mbot and connecting it to remo.tv

Please note, I am not responsible for any technical errors during this process, and may not be able to provide support. You can still contact me on the remo.tv discord at: @sticks#0001

Hardware

What you need:

  1. A camera
  2. The mbot kit and the mcore bord
  3. Speaker
  4. raspberry pi 3+ or 4
  5. internet
  6. Battery pack

Now what you want to do, is follow the instructions to put together the bot, linked here.

After that's done, find a place for the pi, camera, speaker, mbot core board, and a battery pack

A wiring diagram is below for battery:

  • Battery -> Bot: Connected to Cam
  • Battery -> Bot: Connected to Speaker
  • Battery -> Bot: Connected to mbot board (not USB, 4 AA bats)

The wiring diagram is below for connections to pi and mcore board:

  • pi -> Cam: Connected to Cam over USB
  • pi -> Speaker: Connected to Speaker over AUX
  • pi -> mcore board: Connected to mcore over USB serial

Controller Configuration

The robot type must be serial_board.

The code for the Arduino

The following code must be flashed to the board with the mbot software.

// RemoTV Controller for mbot
// Code used: Dan's handler,mblock init things
// compiled and published by sticks
// helpers: H2020,Dan,Brooke
// ver 1.0.0-beta
//for firmware: latest


// start
// Created by mblock START

#include <MeMCore.h>
#include <Arduino.h>
#include <Wire.h>
#include <SoftwareSerial.h>

MeDCMotor motor_9(9);
MeDCMotor motor_10(10);
void move(int direction, int speed) {
  int leftSpeed = 0;
  int rightSpeed = 0;
  if(direction == 1) {
    leftSpeed = speed;
    rightSpeed = speed;
  } else if(direction == 2) {
    leftSpeed = -speed;
    rightSpeed = -speed;
  } else if(direction == 3) {
    leftSpeed = -speed;
    rightSpeed = speed;
  } else if(direction == 4) {
    leftSpeed = speed;
    rightSpeed = -speed;
  }
  motor_9.run((9) == M1 ? -(leftSpeed) : (leftSpeed));
  motor_10.run((10) == M1 ? -(rightSpeed) : (rightSpeed));
}

//delay code (some wired thing)
//void _delay(float seconds) {
//  long endTime = millis() + seconds * 1000;
//  while(millis() < endTime) _loop();
//}

// this is motor moves 1,f 2,b 3,r 4,l
// num = sec delay, so code before _delay 1 is forward
//  move(1, 50 / 100.0 * 255);
//  _delay(1);
//  move(1, 0);
//  move(2, 50 / 100.0 * 255);
//  _delay(2);
//  move(2, 0);
//  move(4, 50 / 100.0 * 255);
//  _delay(3);
//  move(4, 0);
//  move(3, 50 / 100.0 * 255);
//  _delay(4);
//  move(3, 0);


// created by mblock STOP

//custom code (by dan) START
String inData;

void STOP() {
  motor_9.run(0);
  motor_10.run(0);

}

void setup(){
  Serial.begin(9600);
}

void loop()
{
   while (Serial.available() > 0)
    {

    char recieved = Serial.read();
    inData += recieved;

    switch (recieved) {
      case 'f':
         move(1, 100 / 100.0 * 255);
         delay(500);
         STOP();
       break;

       case 'b':
         move(1, 0);
         move(2, 100 / 100.0 * 255);
         delay(500);
         STOP();

       break;

       case 'r':
         move(4, 0);
         move(4, 100 / 100.0 * 255);
         delay(500);
         STOP();
       break;

       case 'l':
         move(2, 0);
         move(3, 100 / 100.0 * 255);
         delay(500);
         STOP();
       break;
     default:
       delay(1);
    }
    inData = "";
  }
}
//custom code (by dan) END

//end 

Thanks for reading!

© sticks#0001 on discord. Written by sticks. Formatted & Edited by Brooke

Clone this wiki locally