Micro:bit or Arduino
Johan Halmén

I'm on a two day course about robotics. I've thought of buying a Raspberry Pi, but right now I'm leaning to Micro:bit or Arduino, just because of the fun of low level. Well, you program them on a high level, but they still are no computers like Raspberry Pi is. Today I got my hands on a Micro:bit thing, some leds, some photoresistors etc. Quite fun.

Tomorrow it will be about programming robots with mBlock. And after that, more Micro:bit. Still haven't come up with an idea to implement. Our teacher would have preferred Arduino, but there was no equipment available, so we go with Micro:bit.

Gideon Weems

I have been wanting to manage household appliances using an array of sensors and my desktop computer for logic. I thought an Arduino device could provide an interface between the PC and sensors, but apparently Arduino requires setting up a "dashboard" at Adafruit.com and running their smart phone app.

I just want a wired interface from my PC to various sensors (temperature, humidity, light level, battery levels...) and relays (12V lights, motors for opening/closing curtains, speakers...). If you or anyone else knows how to do this, please say something.

Johan Halmén

Well, sensors, motors, relays and servos are hardware. These controllers are more like the interface between the hardware and the logic. Here's something about the micro:bit connectivity: http://microbit.org/hardware/pins/

Besides that, it has USB and Bluetooth, either for just loading the controller program to make it standalone or for interacting with your PC. But to all those pins you can connect your sensors and relays and whatnot.

So I just ordered a Micro:bit & some stuff. I have an idea of building a sorting robot. Its task is to sort Hama beads, small plastic pieces that we use at school for making mosaics. All the beads are mixed together and the robot's task would be to check each colour and get them sorted. I thought of using a RGB led to light the beads, and an LDR to read the intensity of the reflected light. Switching the led through red, green and blue should get different readings on the LDR, which should give me a unique rgb value for each colour. The beads are not actually spherical, but cylindrical, which makes it a bit difficult to develop the mechanics that will feed the pieces one by one to the colour recognising system. Anyway, it could be something like this:


...or this:


I'd replace the upper back-and-forth servo with a 360 degree continuous servo that would go round and round in the same direction. The plate would be a full 360 degree disk with lots of holes and when one hole drops the bead, the next hole stops for colour reading, while the further next hole receives the following bead.

Ben Delacob

"apparently Arduino requires setting up a "dashboard" at Adafruit.com and running their smart phone app."

Adafruit doesn't own Arduino. That's just one possible way to do things. For instance, see this instructable.

Johan Halmén

We used Arduino and Microbit. Both had an usb connection for transferring compiled programs into their RAM. At least Arduino could be programmed with an offline version of Scratch. I only used the block editor, which was quite good, don't remember if it included a text code mode of any kind.

We also used very briefly MakeyMakey. I got the impression that it was nothing more than a keyboard feeding key events through usb to the computer.

Here's a simple program that shows on the 5*5 led array how I tilt the device.


So one can read x, y and z values of acceleration. And of magnetic fields. Never tested the latter. Anyone know if devices can have sensors that sense rotation? Or do they just use the magnetic field data, relying on that there's always some field around?

Samuel Henderson


Despite this article I'm still planning on picking up an Arduino starter kit. I got a barebones Arduino Duemilanove years and years ago and had some fun with it using LEDs and a breadboard. Now I'd like to get in to some robotics and sensors, all things that the starter kit comes with IIRC.

Johan Halmén

Before I get to the mechanically very advanced bead sorting robot, I thought of creating a ball wall target board. A 1 m in diameter disc for throwing balls at. Or kicking footballs at (no, not handeggs). The board would have three embedded piezo sensors that measure the hit. A display, maybe the user's phone via bluetooth, would display the hit, how far from the bull's eye and the force of the hit.


I'm a complete novice in electronics, but I thought of this kind of wiring. The image shows one sensor and one port on the Microbit board. My target board would use three similar ports of Microbit.


Microbit runs on 3 V. P0 is a port that can output both digital and analog signals, meaning 3 V pulses of given length or any of 1024 values from 0 V to 3 V. And it can read digital and analog values as well. I decided on doing digital. What happens here is that the piezo produces a voltage spike due to a ball hitting it (or a piece of plywood, which distributes the pressure to the three piezos). The piezo charges the capacitor C1, which starts to discharge through the resistor R1. The charge keeps the transistor open for a while. When the transistor is open, P0 holds zero volt. When it's closed, P0 is 3 V.

The bigger impact on the piezo, the bigger charge and the longer P0 is zero. I have no clue at all what values all the components should have. Some of them I can test. And I need a simple loop in the program that counts how long P0 is zero. If I get reliable measurements from all three piezos, I can calculate and interpolate to find out both the coordinates of the ball impact on the plate and the force of the ball.

I put R2 there just because I thought there should be something at that spot to prevent too high voltage spikes from going through. But maybe an inductor is what that spot needs.

The running time of Microbit can be read in milliseconds. So to get accurate values of where the ball hit and with which force, I need the pulse length to be maybe 1000 ms as maximum. Say P0 gives 500 ms, P1 gives 300 ms and P2 gives 500 ms, the hit is on a line that goes through P1 and the middle point of P0 and P2, but nearer that middle point than P1. The system would need calibrating as well as mathematics. I have no idea if my logics are correct. And I have no idea if that circuit works and what the values of the components should be.


Haha! I just crashed two old wire telephones and picked out the mics and the speakers from them. It appears phones used to have more or less identical piezo elements both as speakers and as mics. A simple digital electrometer showed some 100 mV when I just held the elements in my hand. Knocking on them raised the voltage a bit. I have three almost identical elements. I'd need to view the signal in an oscilloscope to see if they really are identical. Or then I just use them as they are and calibrate everything to meet their differencies. But they are mics and speakers, not just piezo press or shock sensors. They have this convex plate with a small hole in the middle. I guess if I could detach the concave plate, I'd have just a flat plate, the essential piezo element that I need. A plate not receiving sound waves, but actual pressure shocks through the foamy plastic layer between the piezo element and the plywood.

Thread #616864. Printed from Allegro.cc