Thursday 1 July 2021

June 2021 - 10 Most viewed Blog posts on Robots and Physical computing Blog

Blog Archive



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

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 :-) 
 

 



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

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.








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

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.




Getting sensor information:
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.

To develop further.

There is still various things to try out the like the light sensors. As well as the expert blocks - what their functions are. 

Fun and easy to play with.



Code available:




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 12 June 2021

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, wearable device, with ultrasonic sensors, buttons and LEDs for the microbit - I couldn't resist.

Programming is through Makecode and an extension is available, to download and install. To use the extension, at the time of writing this, go through the add extension option and use the search box to add it  from https://github.com/4tronix/EggBit



So what to do with it? Inspired by social distancing  (or not being a 'hugger')  created it so that when people get too close the RGB LEDs go out - simple but fun. The distance is set at 20cm for testing. The code is shown below.




It was fun to do and perhaps swapping the settings around so the lights come on when people at too close might be more fun or using sound. This is a lovely device to play with and the look encourages play - just look how cute it is! The price is reasonable and the look means it has the potential to encourage a wide range of people to experiment with it.





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

Monday 31 May 2021

10 mosts read posts on the Robots and Physical computing Blog - May 2021



  • I often play with the brilliant Sonic Pi  https://sonic-pi.net/   for a bit of fun, but let's be clear I have no musical ability.

















  • It is not physical but CBiS Education have release a free robot arm simulator for Scratch. 










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 8 May 2021

Quick Play with SonicPi



I often play with the brilliant Sonic Pi https://sonic-pi.net/ for a bit of fun, but let's be clear I have no musical ability.

To get my head around it I tried turning thee one tune I know "Hot Cross Buns" for the recorder into a tune. I found a useful webpage https://newt.phys.unsw.edu.au/jw/notes.html to turn the notes into the MIDI number (60, etc) . Played with the synthesier sounds and choose tech_saw just because I liked it. The code is below

use_synth :tech_saws
2.times do
  play 71
  sleep 0.5
  play 69
  sleep 0.5
  play 67
  sleep 0.5
end
4.times do
  play 67
  sleep 0.25
end
4.times do
  play 69
  sleep 0.25
end
play 71
sleep 0.5
play 69
sleep 0.5
play 67

Also tried it with changing the synth to prophet

Also tried to make it a bit more mournful (possible slightly aggressive) with minor chords - I used https://en.wikipedia.org/wiki/Minor_chord#:~:text=In%20music%20theory%2C%20a%20minor,is%20called%20a%20minor%20triad. to get the notes in combination with the MIDI notes list (I still think I got it wrong!)
use_synth :prophet
2.times do
  play 71
  play 62
  play 66
  sleep 0.5
  play 69
  play 60
  play 64
  sleep 0.5
  play 67
  play 70
  play 62
  sleep 0.5
end
4.times do
  play 67
  play 70
  play 62
  sleep 0.25
end
4.times do
  play 69
  play 60
  play 64
  sleep 0.25
end
play 71
play 62
play 66
sleep 0.5
play 69
play 60
play 64
sleep 0.5
play 67
play 70
play 62
sleep 0.5


Adding sound effects is great fun - same code as above with a slightly techno sound to it

use_synth :prophet
with_fx :ixi_techno do
  2.times do
    play 71
    play 62
    play 66
    sleep 0.5
    play 69
    play 60
    play 64
    sleep 0.5
    play 67
    play 70
    play 62
    sleep 0.5
  end
  4.times do
    play 67
    play 70
    play 62
    sleep 0.25
  end
  4.times do
    play 69
    play 60
    play 64
    sleep 0.25
  end
  play 71
  play 62
  play 66
  sleep 0.5
  play 69
  play 60
  play 64
  sleep 0.5
  play 67
  play 70
  play 62
  sleep 0.5
end

or alternatively

use_synth :prophet
with_fx :ixi_techno do
  2.times do
    play chord(:b4, :minor7)
    sleep 0.5
    play chord(:a4, :minor7)
    sleep 0.5
    play chord(:g4, :minor7)
    sleep 0.5
  end
  4.times do
    play chord(:g4, :minor7)
    sleep 0.25
  end
  4.times do
    play chord(:a4, :minor7)
    sleep 0.25
  end
  play chord(:b4, :minor7)
  sleep 0.5
  play chord(:a4, :minor7)
  sleep 0.5
  play chord(:g4, :minor7)
  sleep 0.5
end

I am the first to admit I have little musical knowledge but playing with Sonic Pi is still good fun; just changing the sound effects (like changing it to whammy and getting it sounding like aliens) is enjoyable.

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

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 ...