Skip to content

Xvier/mbot_nodebots

 
 

Repository files navigation

Using your mBot as a NodeBot

Join the chat at https://gitter.im/Makeblock-official/mbot_nodebots

Hardware mbot from makeblock

mBot is the easiest educational robot for kids to learn programming, Arduino and robotics.

mbot

Photo from Andrew Fisher

Getting started

Everyone

  1. Install the USB Serial driver for your platform. It's in the drivers folder. If you're using linux you don't need to do anything. Win and Mac you will need to. You'll also need to reboot your computer for it to take effect.
  2. Build the bot
  3. Install the dependencies of:

Install using Arduino IDE

  1. Install Arduino IDE
git clone git@github.com:Makeblock-official/mbot_nodebots.git && cd mbot_nodebots
npm install
  1. Install fimata. Open arduino and navigate to firmware/src/mbotFirmata/mbotFirmata.ino and open it.

Compile and then upload to the board.

Install using Interchange

Connect with USB cable and install firmware using interchange (instruction below assumes ./node_modules/.bin is on your path. You can also install interchange with the npm install -g nodebots-interchange switch to install it globally.

npm install nodebots-interchange

You can install the firmware to work with either USB or Bluetooth with appropriate firmata using the firmata switch on interchange

To use USB:

interchange install git+https://github.com/Makeblock-official/mbot_nodebots -a uno --firmata=usb

To use Bluetooth:

interchange install git+https://github.com/Makeblock-official/mbot_nodebots -a uno --firmata=bluetooth

Examples

Examples are in the examples directory. You can run using node examples/file.js like normal. Information about the examples is below

Motors

Use examples/motors.js this will drive the mbot around using the arrow keys on your keyboard. You may need to change the details of the directions depending on how you wired up the motors.

Buzzer

Use examples/piezo.js - this will make your mbot play some tunes.

Obstacle detection

Use examples/sonar.js to detect the distance to an object. You can use this to stop your robot from running into this.

Button

Your mbot has a little button that you can use to trigger something maybe. Use examples/button.js to detect the button press and do something with it.

Light Sensor

You can read the light level near the mbot - maybe you can make your mbot run away from too much light or move towards more light? Use examples/light.js

LEDs

There are 2 LEDs on the mbot which are RGB LEDs. These are connected in a strip so you can use node-pixel to control them. An example is examples\leds.js

Reflectance sensor

Under your mbot is a sensor which you can use to detect lines. Look at examples\reflectance.js to see how to get the data. You can detect lines by getting one of the two sensors to be bright and one to be dark so it can follow an edge.

Bluetooth module

To use the BT module do the following modifications:

  • Remove the bluetooth module from the mBot
  • Install the bluetooth firmata with instruction below
interchange install git+https://github.com/Makeblock-official/mbot_nodebots -a uno --firmata=bluetooth
  • Turn the mbot off, install the bluetooth module, turn the board on again.
  • Pair the module (use whatever tool you need to make that work - usually BT settings in your control panel).

Test the connection by using a screen terminal such as:

screen /dev/tty.Makeblock-ELETSPP

If this connects you should see the blue LED on the BT module go solid. From there hit the reset button on the board and then you should see something like the following appear on your terminal.

��ymbotFirmata.ino��{�3��l�A�2�U�

If you don't get that, test your connection etc. If you do then proceed.

Now execute

node examples/leds.js /dev/tty.Makeblock-ELETSPP

And you should get blinking lights over BT. You can do the same thing with most of the examples though speed may be an issue in high data rate cases.

2.4GHz wireless module

Install using:

npm install drivers/node-hid

Run example

node examples/wifi_motors.js

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 40.2%
  • C 31.8%
  • Other 11.6%
  • Makefile 5.4%
  • M4 4.2%
  • Python 4.0%
  • Other 2.8%