Speech Recognition in Scratch 3 - turning Hello into Bonjour!
The Raspberry Pi Foundation recently released a programming activity Alien Language , with support Dale from Machine Learning for Kids , tha...PS3 Controller to move a USB Robot Arm
Guest Blogger Hiren Mistry, Nuffield Research Placement Student working at the University of Northampton. How to use a PS3 Controller to...Scratch Robot Arm
It is not physical but CBiS Education have release a free robot arm simulator for Scratch. Downloadable from their site http://w...Tinkercad and Microbit: To make a neuron
The free online CAD (and so much more) package Tinkercad https://www.tinkercad.com/ under circuits; now has microbits as part of the list ...Escape the Maze with a VR robot - Vex VR
You don't need to buy a robot to get programming a robot, now there are a range of free and relatively simple to start with robot simula...Easy, Free and no markers Augmented Reality - location based AR
For a few years, I have been a fan of Aframe and AR.js - these are fantastic tools for creating web-based Virtual and Augmented Reality. No...Coral Dev Board and Raspberry Pi
This is the second of a planned occasional series of posts on playing with some of the current AI specific add-on processors for Intenet of ...Explaining the Tinkercad microbit Neural network
In a previous post, I looked at developing a neural network in Tinkercad around the Microbit (details available here ) and the whole model ...VR robot in a maze - from Blocks to Python
Recently I produced a post about playing with Vex Robotics VexCode VR blocks and the Maze Playground. The post finished with me saying I w...4tronix Eggbit - cute and wearable - hug avoider
/ The ever-brilliant 4tronix have produced Eggbit https://shop.4tronix.co.uk/collections/microbit-accessories/products/eggbit; a cute, wear...
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.
Friday, 31 December 2021
Top 10 viewed posts 2021 on the Robot and Physical Computing Blog
Sunday, 26 December 2021
Hug Avoider 4 - micropython, Eggbot and speech
The last of the posts on the Hug avoider and the 4Tronix's Eggbit
4Tronix's Eggbit (in fact I bought three of them https://shop.4tronix.co.uk/collections/bbc-micro-bit/products/eggbit-three-pack-special :-) recently) is a cute add-on for the microbit. In three previous posts I looked at eggbit using microcode to produce a hug avoider - warns when people at too close.
In this post using the buttons and adding (via Microbit V2 with its speaker) simple speech
1. Buttons
Pins for the buttons
- pin8 - Green button
- pin12 - Red button
- pin14 - Yellow button
- pin`6 - Blue button
if pin12.read_digital()==1:
#Red Button
blank_it()
if pin8.read_digital()==1:
#Green button
startingMessage()
if pin14.read_digital()==1:
#Yellow button
rainbow()
if pin16.read_digital()==1:
#Blue botton
display.show(Image.ASLEEP)
2. Speech
The basis on the code is take from https://microbit-micropython.readthedocs.io/en/latest/tutorials/speech.html
mess1 = [
"This is the hug avoide",
"please keep back",
]
# Take from https://microbit-micropython.readthedocs.io/en/latest/tutorials/speech.html
for line in mess1:
speech.say(line, speed=120, pitch=100, throat=100, mouth=200)
sleep(500
The speech is difficult to hear but is fun and there are possibly ways to improve this starting with the information on https://microbit-micropython.readthedocs.io/en/latest/tutorials/speech.html
3. Overall
from microbit import *
from machine import time_pulse_us
import neopixel, speech
sonar =pin15
sonar.write_digital(0)
fireled=neopixel.NeoPixel(pin13,9)
def rainbow():
fireled[0] = (255, 0, 40)
fireled[1]= (255,165,0)
#block=yellow
fireled[2] = (255,255,0)
#block=green
fireled[3] = (0,255,0)
#block=blue
fireled [4] = (0,0,255)
# block=indigo
fireled[5] = (75,0,130)
# block=violet
fireled[6] = (138,43,178)
#block=purple
fireled[7] = (255,0,255)
fireled.show()
def blank_it():
for j in range(8):
fireled[j] = (63, 0, 0)
fireled.show()
def howfar():
sonar.write_digital(1)
sonar.write_digital(0)
timeus=time_pulse_us(sonar,1)
echo=timeus/1000000
dist=(echo/2)*34300
sleep(100)
return dist
def startingMessage():
mess1 = [
"This is the hug avoide",
"please keep back",
]
# Take from https://microbit-micropython.readthedocs.io/en/latest/tutorials/speech.html
for line in mess1:
speech.say(line, speed=120, pitch=100, throat=100, mouth=200)
sleep(500)
def buttonplay():
if pin12.read_digital()==1:
#Red Button
blank_it()
if pin8.read_digital()==1:
#Green button
startingMessage()
if pin14.read_digital()==1:
#Yellow button
rainbow()
if pin16.read_digital()==1:
#Blue botton
display.show(Image.ASLEEP)
while True:
buttonplay()
dist=howfar()
if dist>30:
pin2.write_digital(1)
pin0.write_digital(0)
display.show(Image.HAPPY)
else:
pin2.write_digital(1)
pin0.write_digital(1)
blank_it()
speech.say("back away please", speed=120, pitch=100, throat=100, mouth=200)
display.show(Image.ANGRY)
Thursday, 23 December 2021
Hug Avoider 3 - experiments with Python and 4Tronix Eggbit
4Tronix's Eggbit (in fact I bought three of them https://shop.4tronix.co.uk/collections/bbc-micro-bit/products/eggbit-three-pack-special :-) recently) is a cute add-on for the microbit (see above). In two previous posts I looked at eggbit using microcode to produce a hug avoider - warns when people at too close.
This post replicates some of this, but this time using Python and shows the stages of the build
- Get the ultrasound to find the distance;
- Produce smile and surprise on the eggbit's 'mouth';
- Produce rainbow on the neopixels or all the pixels turning red;
- Bring it all together so if the person is too close, less than 30cm it reacts.
1. Ultrasonic detection
Probably the most challenging bit of this was getting the ultrasonic distance measrement working. It actually is not that difficult; especially using code from https://firialabs.com/blogs/lab-notes/ultrasonic-distance-sensor-with-python-and-the-micro-bit as the basis of the solution and pin15 does both triggering and receiving. Code sends a pulse out, picked up and processed to get the distance from the delay. The code is shown below:
from microbit import *
from machine import time_pulse_us
sonar =pin15
sonar.write_digital(0)
while True:
sonar.write_digital(1)
sonar.write_digital(0)
timeus=time_pulse_us(sonar,1)
echo=timeus/1000000
dist=(echo/2)*34300
sleep(100)
display.scroll(str(dist))
2. LEDs
To get a greater understanding of how 4Tronix's makecode extension (used in the previou posts) for the Eggbit controls the various pins the best resource was to reverse engineering the code from https://github.com/4tronix/EggBit/blob/main/eggbit.ts in their github respository for the Eggbit.
This gave the colours and the correct pin for the LEDs the code is shown below. Producing a rainbow method and a method to set the LEDs/neopixels to red.
import neopixel
fireled=neopixel.NeoPixel(pin13,9)
def rainbow():
fireled[0] = (255, 0, 40)
fireled[1]= (255,165,0)
#block=yellow
fireled[2] = (255,255,0)
#block=green
fireled[3] = (0,255,0)
#block=blue
fireled [4] = (0,0,255)
# block=indigo
fireled[5] = (75,0,130)
# block=violet
fireled[6] = (138,43,178)
#block=purple
fireled[7] = (255,0,255)
fireled.show()
def blank_it():
for j in range(8):
fireled[j] = (63, 0, 0)
fireled.show()
3. 'Face'
Eggbit has set of LEDs that represent a mouth, controlled via three pins. Only two of those are used in this example
'Smile' is pin2.write_digital(1) the 'lower' part of the mouth and turn off upper part of the mouth pin0.write_digital(0)
'Surprise' uses both parts
pin2.write_digital(1)
pin0.write_digital(1)
4. Overall
So putting this altogether
from microbit import *
from machine import time_pulse_us
import neopixel
sonar =pin15
sonar.write_digital(0)
fireled=neopixel.NeoPixel(pin13,9)
def rainbow():
fireled[0] = (255, 0, 40)
fireled[1]= (255,165,0)
#block=yellow
fireled[2] = (255,255,0)
#block=green
fireled[3] = (0,255,0)
#block=blue
fireled [4] = (0,0,255)
# block=indigo
fireled[5] = (75,0,130)
# block=violet
fireled[6] = (138,43,178)
#block=purple
fireled[7] = (255,0,255)
fireled.show()
def blank_it():
for j in range(8):
fireled[j] = (63, 0, 0)
fireled.show()
def howfar():
sonar.write_digital(1)
sonar.write_digital(0)
timeus=time_pulse_us(sonar,1)
echo=timeus/1000000
dist=(echo/2)*34300
sleep(100)
return dist
while True:
dist=howfar()
if dist>30:
pin2.write_digital(1)
pin0.write_digital(0)
rainbow()
display.show(Image.HAPPY)
else:
pin2.write_digital(1)
pin0.write_digital(1)
blank_it()
display.show(Image.ANGRY)
Tuesday, 21 December 2021
Hug Avoider 2 - #4tronix #Eggbit
In an earlier post this year ( 4tronix Eggbit - cute and wearable - hug avoider) I played with 4Tronix's Eggbit (in fact I bought three of them https://shop.4tronix.co.uk/collections/bbc-micro-bit/products/eggbit-three-pack-special :-) recently). In that one I used a microbit V1.
In this post, I am using a microbit V2 and replicating the idea but with adding a sound; when people get too close as a bit of fun and surprise for relatives at christmas.
The code written using Makecode for Microbit (https://makecode.microbit.org/) and the extension for it 4Tronix's developed (see https://4tronix.co.uk/blog/?p=2485 for more details) is shown below:
If the ultrasonic sensor picks up anyone in front; LEDS change to red, a sped-up version of one of the standard tunes in Makercode is played and the mouth changes to a surprised look.
Good fun, didn't stop anyone and my son made one with the LEDs lighting up as the person got closer.
What I want to look at is the possibility of programming it with Python - something for the new year.
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. Twitter @scottturneruon
Saturday, 31 July 2021
This blog's Most read 10 posts July 2021
- For a few years, I have been a fan of Aframe and AR.js - these are fantastic tools for creating web-based Virtual and Augmented Reality.
- Elcrow in 2020 released on kickstarter and now in pre-order their own site , an interesting take on the Raspberry Pi laptop -
- The Raspberry Pi Foundation recently released a programming activity Alien Language , with support Dale from Machine Learning for Kids , tha...
- A product that has kept popping on to my radar has been the intriguing Turing Tumbles @TuringTumble
- In a previous post, I looked at developing a neural network in Tinkercad around the Microbit (details available here ) and the whole model ...
- In two recent posts, Makecode was used with the Enviro:bit from Pimoroni to try out a few ideas
- This is the second of a planned occasional series of posts on playing with some of the current AI specific add-on processors for Intenet of Things
- It is not physical but CBiS Education have release a free robot arm simulator for Scratch.
- Recently I produced a post about playing with Vex Robotics VexCode VR blocks and the Maze Playground.
Wednesday, 28 July 2021
Tumbling Turing 1 - initial play with the Turing Tumble @TuringTumble
A product that has kept popping on to my radar has been the intriguing Turing Tumbles @TuringTumble I admit to being initially hesitant (is just a gimmicky marble run? - it isn't!) a marble powered computer. The idea is using mechanical ideas to visualise computing concepts is thought-provoking and I have always loved marble runs and 'Heath Robinson'/'Rube Goldberg' style machines; so bit the bullet and brought one and I am impressed; it is great fun (more than just as a marble run).
Let's start with the packaging and components it is and feels like a high quality product. The components feel sturdy and well designed, the storage for the components also feels sturdy (see figure 1). The project book with the exercises etc is a mixture of puzzles and challenges, alongside a short graphic novel/comic; it all feels well executed and thought through. Online there is now a growing community https://community.turingtumble.com/ where new puzzels are posted, alongside new ideas for puzzles and support. Personally, I think this is a great move, and one of the features with the potential to move this from a game (I have no problem with games), into a tool (as well as a game) for experimentation and also an educational tool.
figure 1: components |
It does have elements of a marble run the power to everything is gravity acting on marbles (see figure 2).
figure 2: Game board |
In the video below the set of red and blue marbles, go through the system producing an output of alternating red and blue marbles - simple but good fun.
Where to next then:
- I am aiming to find the time to try out the binary operation puzzles and logic puzzles.
- then play with other ideas.
The company behind Turing Tumble have recently run a further very successful Kickstarter project for a follow-on idea Spintronics (see below) using mechanical concepts to help visualise and understand electronic concepts. Yes, I have 'pledged' for it along with several thousand others, it looks so Steampunk.
If you would like to play with a spintronic simulation goto https://www.turingtumble.com/upperstory/spintronics/simulator/index.html
Thursday, 15 July 2021
CrowPi2 - Raspberry Pi laptop and much more.
Elecrow in 2020 released on kickstarter and now in pre-order their own site (or Amazon.com ) an interesting take on the Raspberry Pi laptop - a laptop with a built-in sensor lab.
e |
Image taken from: https://www.kickstarter.com/projects/elecrow/crowpi2-steam-education-platformand-raspberry-pi-laptop/description |
The version I received comes with a fantastic range of items, including the Raspberry Pi; power bank; books on python and scratch; RFID keyfob; remote control; game controllers; and many other components. A wide range of software and learning materials are installed on the SD-Card; including software to learn about AI.
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. Twitter @scottturneruon
At the moment I have mainly been playing with it as a Pi based laptop but I am looking forward to digging into playing with the sensors.
To find out more go to https://www.elecrow.com/crowpi2-raspberry-pi-portable-laptop.html
Monday, 5 July 2021
Added to the National Teaching Repository - Free Augmented Reality
The National Teaching Repository https://ntrepository.wordpress.com/home/ based at Edge Hill University was set up to provide a resource for sharing teaching resources.
Members of Canterbury Christ Church University play a role in the curation process.
To search the Repository https://figshare.edgehill.ac.uk/The_National_Teaching_Repository
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. Twitter @scottturneruon
Thursday, 1 July 2021
June 2021 - 10 Most viewed Blog posts on Robots and Physical computing Blog
- / The ever-brilliant 4tronix have produced Eggbit https://shop.4tronix.co.uk/collections/microbit-accessories/products/eggbit; a cute, wear...
- Finally got to play with something that has been my list of things to play with, the Pimoroni Enviro:bit Weather Kit https://learn.pimoroni...
- The Raspberry Pi Foundation recently released a programming activity Alien Language , with support Dale from Machine Learning for Kids , tha...
- In a previous post, the Envirobit ( https://shop.pimoroni.com/products/enviro-bit ) for the Microbit was played with getting temperature,...
- In two recent posts, Makecode was used with the Enviro:bit from Pimoroni to try out a few ideas ( https://robotsandphysicalcomputing.blogspo...
- Speech Recognition in Scratch 3 - turning Hello into Bonjour! The Raspberry Pi Foundation recently released a programming activity Alien Lan...
- Guest Blogger Hiren Mistry, Nuffield Research Placement Student working at the University of Northampton. How to use a PS3 Controller to...
- It is not physical but CBiS Education have release a free robot arm simulator for Scratch. Downloadable from their site http://w...
- This post forms part of occasional posts about playing with Marty the Robot V2 ( https://shop.robotical.io/products/marty-the-robot-v2 ) fr...
- I am going to try to persuade you that using A-Frame it is not hard to do some simple Augmented Reality (AR) for free, via a browser, but th...
Blog Archive
Tuesday, 29 June 2021
Microbit and Environment Measurement - Using Python
In two recent posts, Makecode was used with the Enviro:bit from Pimoroni to try out a few ideas (https://robotsandphysicalcomputing.blogspot.com/2021/06/pimoroni-envirobit.html and https://robotsandphysicalcomputing.blogspot.com/2021/06/pimoroni-envirobit-light-and-led.html ). In this post Pyton using the Mu editor was used to try out the Enviro:bit.
As in the makeCode version, Pimoroni has provided both a python library (via Github) but also within the Readme.md useful installation instructions. There is at the time of writing a possible typo; to get the BME280 sensor (temperature, pressure, humidity sensor) to work; you need to add parenthesis in the line bme = bme280.bme280()
After that, it works fine and includes potential altitude measurement which I don't think is in the Makecode version (though I could be wrong); I need to play with it a bit more.
To experiment the code below was used test reading temperature (in Centigrade), humidity (%), and altitude (feet). In the examples, currently provided with the library, I couldn't find a BME280 example but it was fairly easy to adapt the examples included to get something going.
import microbit
import bme280
bme = bme280.bme280()
while True:
reading = bme.temperature()
microbit.display.scroll("temp: ")
microbit.display.scroll(str(reading))
microbit.sleep(3000)
reading = bme.humidity()
microbit.display.scroll("humidity: ")
microbit.display.scroll(str(reading))
microbit.sleep(3000)
reading = bme.altitude()
microbit.display.scroll("Alt: ")
microbit.display.scroll(str(reading))
microbit.sleep(3000)
It is a cool and fun device to play with, though I not sure the precision of the readings shown on the microbit LEDs is really necessary :-)
Monday, 28 June 2021
Pimoroni Envirobit - Light and LED
In a previous post, the Envirobit ( https://shop.pimoroni.com/products/enviro-bit ) for the Microbit was played with getting temperature, humidity and pressure (https://robotsandphysicalcomputing.blogspot.com/2021/06/pimoroni-envirobit.html).
In this short post a quick experiment using the sound and light sensor, to turn LEDs on the board to turn off and on beyond on light level. The code is set up when a clap happens nearby, light level is used to 'decide' whether the LEDs are turned on or off, below a threshols the LEDs go on above it the LEDs are turned off,
Makeecode |
Using Makecode makes this relatively easy to implement and fun.
Monday, 21 June 2021
Pimoroni Enviro:bit -
Finally got to play with something that has been my list of things to play with, the Pimoroni Enviro:bit Weather Kit https://learn.pimoroni.com/tutorial/tanya/building-the-enviro-bit-kit (see below)- a nice kit based around Pimoroni's enviro:bit device which uses microbit and adds a number of sensors including temperature, pressure and humidity; as well as a microphone.
Programming is via MakeCode; extensions can be added using the Extension option and searching for envirobit.
So a quick experiment to work through the temperature, pressure and humidity sensors, a brief bit of code to do this is shown below:
Responding to sound
The microbit used with the kit was a V1, so this device added a microphone to the systems (V2 already has the microphone built-in). In the code below the microbit to react to a clapping sound.
There is still various things to try out the like the light sensors. As well as the expert blocks - what their functions are.
To develop further.
Fun and easy to play with.
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. Twitter @scottturneruon
Code available:
Subscribe to:
Posts (Atom)
Remote Data Logging with V1 Microbit
In an earlier post https://robotsandphysicalcomputing.blogspot.com/2024/08/microbit-v1-datalogging.html a single microbit was used to log ...