Skip to main content

Posts

Showing posts with the label mu

CBiS Education Micro:Bit based Robot Car

At PiWars 2017 (1st-2nd April 2017), thanks to the generosity of CBiS Education , I now have one of their  BBC micro:bit RobotCar ™  . It is a sturdy bit of kit, encased in an aluminum chassis with a clear acrylic screen - it feels substantial when you pick it up.  It is based around fours motors, control by a Micro:Bit, via L298N based motor controller/shield. Batteries power, 8 AAs, the motors and a Lithium powerbank to power the Micro:Bit - all included.  More information about the technical details and example software can be found on their site  https://www.cbis.education/robotic-car-kit#  including further details on the  L298N based motor controller/shield, which I found useful for programming it.   I have experimented briefly with programming it in Python (micropython), getting it to it move forward, backward; to the right and left, using the Mu editor.  The code is shown below for those who want to try i...

4Tronix Bit:Bot - now there is a good idea.

When I first heard of this robot, my first thought was what a great idea; a robot with neopixels (I know I should be saying 'smart RGB LEDs' but neopixels is so much more snappier) controlled via a micro:bit. A good starting point for learning more about this robot, is the details on the 4Tronix site/blog , which includes build guidance and programming instructions for micropython and PXT. Though for the micropython code you might need to change pinX.digital_write() to pinX.write_digital()  where X is the pin number. My play code was to randomly select which neopixels to light up, I didn't include code to turn them off so multiple ones can be on. The robot is driven forwards, waits, backward, waits, turns to the right and then the left; and then repeats.  Code: from microbit import * import neopixel, random np = neopixel.NeoPixel(pin13, 12) def forward(n):     pin0.write_digital(1)     pin8.write_digital(0)  ...

Dancing pixels

In previous post I played with using the combination of the Proto-Pic Micro:pixel and Micro:Bit to react, using the accelerometer, to music through a computer speakers. The vibrations from the music shake the Micro:Bit enough to give measurable changes in three axis, and these values are used to change the pixels colour. The latest version of this uses most of pixels. Coded in micropython using the Mu editor . from microbit import * import neopixel, random np = neopixel.NeoPixel(pin0, 32) while True:     for pxl in range (2,32, 5):         rd=int(abs(accelerometer.get_x())/20)         gr=int(abs(accelerometer.get_y())/20)         bl=int(abs(accelerometer.get_z())/20)         np[pxl] = (rd, gr, 0)         np[pxl-1] = (rd, gr, 0)         np[pxl+1] = (0, gr, rd)         np[pxl-2] = (rd, 0, 0)       ...

UFO talks to Robot - part two

In part one of this series of posts , the project to get Consumable Robotics UFO and Dimm robot was started but focussed on the UFO kit. The goal being for some action on Dimm to trigger a series of messages being passed between the two of them. In this post, the focus moves to Dimm and the setting up the actions leading to the messaging. Stage 1 Build Using the Micro:bits port 0 (as part of the Dimm robot) for the input from the light sensor, which is included in the kit (Red lead going to 3v and the black lead going to GND). Just to note the less light there is the higher the value on the sensor. Stage 2 Code Micropython programmed through the Mu editor (see below) If light levels are high then :       scroll a message saying "calling UFO"        send the code "dimm" via bluetooth. otherwise:         scroll a message saying  "I can't see" If it recieves "ufo" via bluetooth...

UFO talks to Robot - part one

In previous posts ( UFO has Landed  and DIMM the OOD ),  I started playing with the CBiSEducation's UFO consumable robots. Still using the Micro:Bit, in this two part post series, I am going to be playing with using Micropython to send messages between the two kits. Stage 1 Wiring and Set up-UFO Pins 0 and 1 are outputs to the LEDs The black leads on the UFO go to GND. Micropython, using the Micro:Bit's built in radio module (Bluetooth), is used to communication between the two kits. Stage 2 Code -UFO The code is set to flash the UFO's LEDs and then scroll a message "DIMM Calling" when it receives a message "dimm" via Bluetooth.  Basic overview is - Turn on the radio module - radio.on() - If the message is received then turn the LEDs on and off and scrolls "DIMM calling" across the LED array. - send a message via bluetooth "ufo" to whoever is listening (in the end the robot DIMM hopefully). The code is shown below. ...

Do it yourself: Remote Controlled Micro:Bit Junkbot

In an earlier post , I showed how you could build a Micro:Bit controlled Junkbot. In this post I want to show a modification to it, to use one Micro:Bit to control the junkbot controlled by another Micro:Bit. A nice feature of the Micro:Bit using micropython, is it can send and receive simple messages via radio - so here is my take on it. The first problem is the Python editor available on  https://www.microbit.co.uk/ does not seem to work with the radio API. One solution to this is to change to the mu editor. Two pieces of code are needed. Sending Code for the 'remote' control: Essentially it is set up to send two messages, via the built-in radio module,  spinl  or spinr  depending on which button is pressed. import radio from microbit import button_a, button_b radio.on() while True:    if button_a.is_pressed():        radio.send('spinl')    if button_b.is_pressed():        ra...