0%
0%

Micro:bot

A simple robot based on the BBC micro:bit.

Similar projects worth following
4.8k views
As a part of the "microbit world tour" program, I'm putting the micro:bit on a robot. This is a very basic animal, assembled from junk I had lying around, held together with two-sided tape and hot glue. No soldering required, so any kid can try and build one like this.

I received a micro:bit board for testing for a week, killed it the next day (http://microworldtour.github.io/microbit/mahiri.html), received another one and build some robots with it (http://microworldtour.github.io/microbit/monifa.html).

• 1 × micro:bit
• 2 × 9g continuous rotation servos
• 2 × wheels
• 1 × small plastic box for the battery
• 1 × 3.7V LiPo Battery
• Explode and Connections

ere's the exploded view:

And the connections:

• Programming

Once I had the mechanics done, I started to work on the programming. Setting the speed of the servos was easy enough:

```import microbit

microbit.pin0.set_analog_period(20)
microbit.pin0.write_analog(int(25 + 100 * degrees / 180))```

But then making it turn exactly 90° or travel exactly 10cm required some careful experimentation with timing.

Once I had that, hooking up the distance sensor was easy. It's an analog SHARP range finder, so all I needed was to read the analog pin. Then I added some simple logic for finding out in which direction the obstacle is further away, and voila, object avoidance:

And that's it. All the code sits in the repository: https://bitbucket.org/thesheep/micro-bot/src

• The Simplest Bot Possible

I knew what I wanted to do with the micro:bit -- I wanted to put it into robots and program them in Python. So I decided to start with the simplest thing possible -- a two-wheeled robot, with continuous rotation servos and a caster wheel. I only had two criteria for choosing the parts:

1. I had to have them already, because I only had a few days, and they had to be off the shelf -- no salvaged or custom-made stuff, so that it can be replicated easily.
2. No soldering, laser-cutter, 3d-printer etc. Just two-sided tape and some glue.

I started by gluing everything together with the two-sided tape in several different configurations. At the beginning, I didn't have the white depron bar to hold the screws, so I simply hotglued them to the servos:

This is actually the only interface the robot has with the micro:bit, because I didn't have the edge connector for accessing all the other pins yet. But three pins is enough for me -- two for the servos, and one for the distance sensor.

After assembling and testing it with some simple code, I noticed that the servos have a lot of problems with the PWM signal generated by the micro:bit. They would basically rotate at maximum speeds in random directions... So I went to the nearby hackerspace and used their oscilloscope to look at the signal. Turns out that you have to set the frequency of the PWM signal several times for it to have the desired effect. After just one time, the frequency is off by an order of magnitude:

But then if you actually start sending a signal and set it again, it becomes correct:

Well, correct apart from some twitching, and it would still change directions randomly. Since I couldn't find the reason for that in the signal, I turned to the power. And yes, replacing the two alkaline AAA batteries with a 3.7V LiPo battery solved that problem.

Share

Discussions

titimoby wrote 11/09/2016 at 17:50 point

nice one. oh... and there's glue: 10 bonus points :)

Are you sure? yes | no

Does this project spark your interest?

Become a member to follow this project and never miss any updates