CBiS Education generously sent me two of their new range of robotics development kits - BinaryBots (https://www.binarybots.co.uk/makers.aspx), these are a range of cardboard based kits (so far a robot and a UFO) with electronic components for example LEDs; sensors and buzzers, depending on the kits. What makes the kits interesting though is they are designed to be controlled by either by a BBC Micro:bit or a CodeBug.
This blog documents, briefly, an initial play with the UFO kit (see below) using a Micro:Bit for control.
The UFO model came together readily, the instructions were fairly easy to follow. Personally, a feature I especially liked about the model was the LEDs being both on the top and bottom of it - increasing its usefulness. CBiS EducationThey have also provided a webpage / portal with some example projects and code.
My first project I built, was to pulse the LEDs on and off (one set of LEDs on Pin 0, the other on Pin 1). Pin 2 was connected to the buzzer, so produce a low buzz every few seconds. The code below is written using the Block Editor (https://www.microbit.co.uk/create-code)
The video below shows the LEDs pulsing. I do need to decorate the UFO though!
Looking forward to playing with it further.
Related
http://robotsandphysicalcomputing.blogspot.co.uk/2016/08/ufo-detects-light.html
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.
Robots and getting computers to work with the physical world is fun; this blog looks at my own personal experimenting and building in this area.
Tuesday, 23 August 2016
Friday, 19 August 2016
Micro:bit Junkbot for use in schools
A new direction has been developed for the junkbot project (http://junkbots.blogspot.co.uk/); previously Raspberry Pis have been used to control the junkbot’s movement (http://robotsandphysicalcomputing.blogspot.co.uk/2016/01/python-junkbot.html) – but what about the recently released Micro:Bits; can it be used to control a junkbot?
Matthew Hole, a student from Wrenn Academy, Northamptonshire ; has been investigating this idea whilst on a Nuffield Research Placement (http://www.nuffieldfoundation.org/nuffield-research-placements) working with Dr Scott Turner, University of Northampton. The project was to look into developing junkbots controlled using a Micro:bit and also to produce some materials for schools to use with or without outside assistance.
What is a Junkbot?
For this project, it is a moving ‘bot’ made from waste materials, combined with an electric motor and a programmable device (in this case a Micro:Bit) to control (or try) it. An example is shown above. More details on junkbots can be found at http://junkbots.blogspot.co.uk/
Approach used in the project.
A Micro:Bit was selected for two reasons. First, there was been a BBC supported project to give year 7 (or equivalent) students a Micro:bit (http://www.bbc.co.uk/programmes/articles/4hVG2Br1W1LKCmw8nSm9WnQ/the-bbc-micro-bit), so they are available in the schools. Secondly, Kitronik produce a motor driver board, and provide quite a bit of support for it, for the Micro:Bit (the latest version of the board can be found at https://www.kitronik.co.uk/5620-motor-driver-board-for-the-bbc-microbit-v2.html ). Using Micropython via the online editor https://www.microbit.co.uk to program the board and therefore the junkbot connected. The board with the Micro:Bit attached can be seen in the figure above carried on the junkbot.
An example piece of code is shown below:
from microbit import *
def startIt():
pin8.write_digital(1)
pin12.write_digital(0)
pin0.write_digital(1)
pin16.write_digital(0)
def leftTurn(duration):
pin8.write_digital(0)
pin12.write_digital(1)
sleep(duration)
def stopIt():
pin8.write_digital(1)
pin12.write_digital(1)
sleep(2000)
while True:
startIt()
if button_a.is_pressed():
leftTurn(100)
if button_b.is_pressed():
stopIt()
Suggested Resource List
- Small Electric Motor
- Kitronik Motor Board
- Battery Pack
- BBC Micro:bit
- Pens
- Junk (Can or Bottle)
- Wires
- Tape
- Scissors
- Broken Propeller or un-balanced load
- Screw Driver
Related Links
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.
Wednesday, 17 August 2016
USB Robot arm control with Python and Raspberry Pi
I was asked recently if the USB robot arm could be programmed - I knew the answer was yes. The Arm came from the CBiS Education Robot Arm kit (http://www.cbis.education/Product-Details.aspx?prodid=2 ) which comes with a Raspberry Pi and SD Card with software to control the Arm. So the question has become - How do I program it in Python from scratch?
Well, the honest answer is I don't I use what others have done before. A good
starting point is this site http://www.wikihow.com/Use-a-USB-Robotic-Arm-with-a-Raspberry-Pi-(Maplin), it gives most (pretty much all) of the answer, including where to get the pyusb library need; setting it up (be careful don't use the zip file but the tar.gz version - you might need to scroll down the screen to do this) and an example. A second source that was very useful was http://notbrainsurgery.livejournal.com/38622.html?view=93150#t93150 which contains an explanation of the 'triples' (for example [32,0,0]) used to select which part of the arm moves and what it does (in the example [32,0,0] causes the Robot Elbow to move down).
The code below is largely based on the code in http://www.wikihow.com/Use-a-USB-Robotic-Arm-with-a-Raspberry-Pi-(Maplin) the only real changes are named procedures (such as ElbowUp) in place of the slightly less easy to understand lines such as MoveArm(Duration,[4,0,0]) #wrist up . The only other changes was a procedure that changes what the light does (0 - light off; 1 - light on; 3 - pulses by a number of times).
See it action in the video below.
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.
Well, the honest answer is I don't I use what others have done before. A good
starting point is this site http://www.wikihow.com/Use-a-USB-Robotic-Arm-with-a-Raspberry-Pi-(Maplin), it gives most (pretty much all) of the answer, including where to get the pyusb library need; setting it up (be careful don't use the zip file but the tar.gz version - you might need to scroll down the screen to do this) and an example. A second source that was very useful was http://notbrainsurgery.livejournal.com/38622.html?view=93150#t93150 which contains an explanation of the 'triples' (for example [32,0,0]) used to select which part of the arm moves and what it does (in the example [32,0,0] causes the Robot Elbow to move down).
The code below is largely based on the code in http://www.wikihow.com/Use-a-USB-Robotic-Arm-with-a-Raspberry-Pi-(Maplin) the only real changes are named procedures (such as ElbowUp) in place of the slightly less easy to understand lines such as MoveArm(Duration,[4,0,0]) #wrist up . The only other changes was a procedure that changes what the light does (0 - light off; 1 - light on; 3 - pulses by a number of times).
import usb.core, usb.util, time
RoboArm = usb.core.find(idVendor=0x1267, idProduct=0x000)
if RoboArm is None:
raise ValueError("Arm not found")
Duration=1
#Define a procedure to execute each movement
def MoveArm(Duration, ArmCmd):
#Start the movement
RoboArm.ctrl_transfer(0x40,6,0x100,0,ArmCmd,3)
#Stop the movement after waiting a specified duration
time.sleep(Duration)
ArmCmd=[0,0,0]
RoboArm.ctrl_transfer(0x40,6,0x100,0,ArmCmd,3)
def RotateBaseClockwise(Duration):
MoveArm(Duration,[0,1,0]) #Rotate base clockwise
def RotateBaseAntiClockwise(Duration):
MoveArm(Duration,[0,2,0]) #Rotate base clockwise
def ElbowUp(Duration):
MoveArm(Duration,[16,0,0]) #Elbow up 0x10
def ElbowDown(Duration):
MoveArm(Duration,[32,0,0]) #Elbow down 0x20
def WristUp(Duration):
MoveArm(Duration,[4,0,0]) #wrist up 0x04
def WristDown(Duration):
MoveArm(Duration,[8,0,0]) #wrist down 0x08
def CloseGripper(Duration):
MoveArm(Duration,[1,0,0]) #close gripper 0x01
def OpenGripper(Duration):
MoveArm(Duration,[2,0,0]) #open gripper 0x02
def ShoulderUp(Duration):
MoveArm(Duration,[64,0,0]) #shoulder up 0x40
def ShoulderDown(Duration):
MoveArm(Duration,[128,0,0]) #shoulder down 0x80
def GripLight(Action, Duration):
if (Action==1):
MoveArm(Duration,[0,0,1]) #light on
if (Action==0):
MoveArm(Duration,[0,0,0]) #light off
if (Action==3):
for x in range(Duration):
MoveArm(1,[0,0,1]) #light on
MoveArm(1,[0,0,0]) #light off
WristUp(0.5)
OpenGripper(0.5)
RotateBaseClockwise(2)
RotateBaseAntiClockwise(2)
ElbowUp(1)
ElbowDown(1)
WristDown(0.5)
CloseGripper(0.5)
ShoulderUp(3)
ShoulderDown(1)
GripLight(3,3)
See it action in the video below.
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.
Wednesday, 3 August 2016
Traffic lights - Microbit, GlowBugs and micropython
In a previous post, I got a GlowBug to work with a micro:bit (http://robotsandphysicalcomputing.blogspot.co.uk/2016/08/microbit-and-glowbug.html) . In this post, I will show a relatively simple traffic lights system produced by turning off and on the pixels via a micro:bit.
Code
from microbit import *
import neopixel
# Setup the Neopixel strip on pin0 with a length of 3 pixels
np = neopixel.NeoPixel(pin0, 3)
while True:
#red
np[0] = (255, 0, 0)
np[1] = (0,0, 0)
np[2] = (0,0,0)
np.show()
sleep(1000)
#red and orange
np[0] = (255, 0, 0)
np[1] = (255, 69, 0)
np[2] = (0,0,0)
np.show()
sleep(1000)
#green only
np[0] = (0, 0, 0)
np[1] = (0, 0, 0)
np[2] = (0,255,0)
np.show()
sleep(1000)
#orange
np[0] = (0, 0, 0)
np[1] = (255, 69, 0)
np[2] = (0,0,0)
np.show()
sleep(1000)
It is simple, timings and more lights can be added to make a more interesting system. If you have done something similar please use the comments to discuss or link to it.
Thank you to @SCC_Lancaster for the loan of a micro:bit.
Related Posts
Microbit and GlowBugs
CodeBug and Glowbugs
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.
Code
from microbit import *
import neopixel
# Setup the Neopixel strip on pin0 with a length of 3 pixels
np = neopixel.NeoPixel(pin0, 3)
while True:
#red
np[0] = (255, 0, 0)
np[1] = (0,0, 0)
np[2] = (0,0,0)
np.show()
sleep(1000)
#red and orange
np[0] = (255, 0, 0)
np[1] = (255, 69, 0)
np[2] = (0,0,0)
np.show()
sleep(1000)
#green only
np[0] = (0, 0, 0)
np[1] = (0, 0, 0)
np[2] = (0,255,0)
np.show()
sleep(1000)
#orange
np[0] = (0, 0, 0)
np[1] = (255, 69, 0)
np[2] = (0,0,0)
np.show()
sleep(1000)
It is simple, timings and more lights can be added to make a more interesting system. If you have done something similar please use the comments to discuss or link to it.
Thank you to @SCC_Lancaster for the loan of a micro:bit.
Related Posts
Microbit and GlowBugs
CodeBug and Glowbugs
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.
Monday, 1 August 2016
Micro:bit and Glowbug
I saw on Twitter that some people have got the GlowBugs, more commonly used the CodeBugs (http://www.codebug.org.uk/learn/activity/73/glowbugs/), to work with the Micro:bit. Here is my go at doing it. I just wanted to get one GlowBug to flash Red, Green and Blue and keep cycling around.
The start point was to base it on the code from http://microbit-micropython.readthedocs.io/en/latest/neopixel.html for using Python with neopixels. The GlowBugs are essentially a single neopixel. So I connected the Data In to pin 0 and set the strip length to 1 ( np = neopixel.NeoPixel(pin0, 1) ) and then set the colours by setting np[0] to the colour wanted (eg. Red np[0] = (255, 0, 0) ).
from microbit import *
import neopixel
# Setup the Neopixel strip on pin0 with a length of 1 pixel
np = neopixel.NeoPixel(pin0, 1)
while True:
np[0] = (255, 0, 0)
np.show()
sleep(1000)
np[0] = (0, 255, 0)
np.show()
sleep(1000)
np[0] = (0 , 0 , 255)
np.show()
sleep(1000)
Video of it in action.
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.
Sunday, 26 June 2016
CodeBug at code club
These
little devices provide something different to a code. To see the coding interface go to http://www.codebug.org.uk/ (or see figures 1 and 2) and click on create.
Last two
weeks
Week 1
The code clubbers initially shared machines, playing with the CodeBug environment, practice downloading to
the bug, writing a routine to scroll their short message. The challenge was then to develop a routine to
have a smiley face and a grumpy face scroll across the screen.
Week 2
All have access to the simulation and code generation on codebug.org.uk but
this time they don’t have the CodeBug each, they have complete a challenge and
run it on the simulation before get a CodeBug to try it. This week's challenge was to get the smiley and grumpy face from week 1 to be selected via the buttons (A and B) - so it involved a loop and conditional statements. Most of them picked it up very quickly.
Two version were built - I reconstructed the ideas in figures 1 and 2 (the code clubbers often did a better version than mine shown here!).
The one shown in Figure 1 works by pressing A -scrolls :-) and B - scrolls :-( . Some spotted that the the 'nose' wasn't quite in the place. Some went and found the build sprite block and used that instead.
Two version were built - I reconstructed the ideas in figures 1 and 2 (the code clubbers often did a better version than mine shown here!).
Figure 1: Simple Scroll |
Figure 2 - Using the build sprite. |
Lessons learnt
- Give them all access individually to the CodeBug website but not to the physical CodeBug straight away
- They are often a limited resources
- There is a great temptation from the code clubbers to focus on download to the actual device when the seem to get more done if the spend more time with website and its simulator first;
- When they have something interesting to put on the ‘bug’; then they can borrow a bug and try it out.
- They should do a bit of show and tell.
Related posts
Basic Motor Control using CodeBug
messing around with Codebug
Friday, 24 June 2016
Playing with Smurf the Robot
Experimenting with an Aldebaran NAO robot - nicknamed Smurf - to get the robot to deliver a short welcome. The video below show the robot being simulated using the code in figure 1 and then shows the 'Smurf' actually carrying out the routine (the bottom video show this bit without the simulator). The only difference in the code on the simulator and the one running on the actual robot was an extra command was added at the start of the one on the robot to only start when the top of the head is tapped.
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.
figure 1. Choregraphe program for the routine. |
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with.
Subscribe to:
Posts (Atom)
Who wants to produce AI produced cartoon strips
Question: How easy is it produce a comic/cartoon using genetative AI? Let's start with using ChatGPT4o to produce cartoons. The idea wa...