Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Sunday, 23 May 2021

micro:bit music making

The year 6 Fleetville Code Club has kept going during all through lockdown – we spent a lot of time in Minecraft, which worked pretty well for virtual sessions, since we were all sharing the same virtual space.

This term we did something a bit different: the students have been making and programming MINI•MU musical gloves. This is a kit designed by Helen Leigh based on the MiMU Glove – in turn invented by the musician Imogen Heap and her team. You can get a glimpse of what the full MiMU Gloves can do in the following video:



The MINI•MU Gloves are considerably simpler than the ones in the video – instead of picking up all finger and hand movements, they use the movement sensors on a BBC micro:bit to detect basic hand motions, like how much you tilt your hand front to back and side to side. It’s still plenty of input to use for a musical instrument though!

We received the glove kits thanks to the OpenUK Digital Kids Camp and Huawei – who sent out 3000 kits and provided some cool e-zines which we used as a basis for our sessions. The students had to first cut the pattern from felt and sew their glove together, then connect the micro:bit, sound board and battery pack – before programming the micro:bit to make their own sounds.

This was a harder project to get to work in an all-remote environment, and I think some of the students found it hard to stay engaged without being able to share their creations in real life. Even so, I was really impressed with what they managed to build. Here’s my favourite wishing one of the student’s grandparents a happy birthday!

Taking it further…

The MINI•MU gloves make it easy to make a sound as they have a built-in speaker. However, the micro:bit can only make very simple beeps by itself.

I spent a bit of time trying to get closer to the full MiMU glove experience by sending the movement of the glove to something else that could make some richer sounds.

Scratch

One option is to connect the micro:bit to Scratch using its bluetooth connection. The Scratch site has very clear instructions on how to get the micro:bit connected – you need to install the Scratch Link software on macOS or Windows, or else use the Scratch app for ChromeOS or Android tablets; then install a special program on the micro:bit itself; and finally add the micro:bit extensions to Scratch and identify your micro:bit by the name it displays.

There’s a few tutorial programs to get you started on the Scratch site, and there’s a range of examples on the microbit site as well – including a theremin to make spooky sci-fi noises.

I’ve made another example that lets you make noises as you move either the mouse or the micro:bit around. You can have a go below:



Bluetooth MIDI

Another way to get better sound from the MINI•MU glove is to connect the micro:bit to a tablet or computer using MIDI over Bluetooth. MIDI is a music communication system that’s even older than the micro:bit’s BBC precursor from 1981, the venerable BBC Micro. You can use MIDI to describe starting and stopping a particular note, how hard the note is played (its velocity) and all sorts of other variations – and the system is supported by most music making programs, including things like GarageBand.

To get MIDI from your micro:bit to your computer or tablet is a little complex but once it’s working, you can make all kinds of sounds! Here’s some tips and tricks to get you going:

Build a project with the Bluetooth MIDI extension

To send Bluetooth MIDI from your micro:bit, you’ll need to add the Bluetooth MIDI extension:

  1. In MakeCode, click Advanced at the bottom of the blocks
  2. Scroll down to the bottom to see Extensions
  3. Click that and type “midi” into the search bar
  4. Make sure you click on the bluetooth-midi extension, not the plain midi one
  5. You’ll now have some extra light blue blocks in the Midi category

Here’s a ready-made project you can start with – Pentatonic MIDI controller

Tilt your micro:bit left and right to choose a note, then press the A button to make the micro:bit send the current note. There’s a secret feature to use the light levels picked up from the LEDs – can you figure out how to use it?

Make your micro:bit easier to connect

micro:bit MakeCode projects have a secret option that makes it easier to connect the micro:bit to something over bluetooth. It would probably make things harder if you had lots of devices in a classroom, but if you’re just wanting to connect a single micro:bit to your computer or tablet then this will make your life much easier!

  1. Go to project settings by clicking on the gearwheel at the top right of the page
  2. Turn on “No Pairing Required: Anyone can connect via Bluetooth”
  3. Click Save
  4. Re-download your project to the micro:bit

The Pentatonic MIDI Controller project above already has this option set for you!

micro:bit to iPad

This is fairly simple – in GarageBand for the iPad, go to Settings (the gearwheel icon), click Advanced, click Bluetooth MIDI Devices, tap the micro:bit then tap the Connect switch on. If the micro:bit is marked as offline, click Edit and Forget the device.

Now you can use your micro:bit to play and record tunes in GarageBand – and choose any instrument you want!

micro:bit to Mac

macOS won’t connect to the micro:bit by itself and needs a little bit of prompting. Download and run the Bluetility app to see the micro:bit, then click the last service and the last characteristic (they should start “E95D93AF-” and “E95DB84C-” respectively). You should then see a Subscribe button to click in the Detail pane – and this should then make the micro:bit appear in your Bluetooth system preferences.

Now that the micro:bit is connected over Bluetooth, you need to tell the macOS MIDI system that it needs to listen to it. Open the Audio MIDI Setup app (it lives in /Applications/Utilities – or just use Spotlight Search). Make sure the MIDI Studio window is showing (if not, go to the Window menu and choose Show MIDI Studio). Then click the Bluetooth symbol in the MIDI Studio window’s toolbar, which should open the Bluetooth Configuration window and list your connected micro:bit. Click the Connect button next to your micro:bit and you’re finally ready to play!

Open GarageBand, create a new project, and add a Software Instrument. GarageBand should pick up the connected micro:bit immediately and play the notes that you send. You can then choose different sounds from the Library to make your micro:bit play whatever instruments you want.

micro:bit to Windows 10

I haven’t tried this, but there’s a very clear video by BEATNVISION that suggests using the MIDIberry app to receive the Bluetooth MIDI from your micro:bit and play sound.

Use the micro:bit connectors

As well as the movement sensors, the micro:bit also has edge connectors that you can use to attach all sorts of other technology. The MINI•MU glove uses these to connect the speaker, but if you’re going to use bluetooth to output the sound, then you can use the connectors to get more input.

Here’s the micro:bit wizard David Whale with his micro:bit guitar:



And if you really want to see how far you can go, how about using muscle movements to control your music? Here’s a video on how to pick up electrical changes from your muscles using a micro:bit:



Keep making music!

Saturday, 28 September 2013

Over The Air 2013

Building an Internet of Things for Everyone

Alexandra Deschamps-Sonsino https://twitter.com/iotwatch

  • get the work you want
  • if you get work just for money, you’ll get more of it
  • won’t get you the work you want…

good night lamp

  • originally in 2007 people were unsure about it
    • it uses Wi-Fi: isn’t that a health risk?
  • restarted in 2010 — no longer a problem

IoT is now accessible

  • hardware & software is easily available, documented + supported with lots of forums
  • lots of hackspaces around to make thing
  • idea to making something that looks pretty and works: “I give you 2 weeks — and 1 of those is waiting for things to be delivered”
  • still hard to get something to production scaling, but getting support for that:
    • Fritzing, DesignSpark, etc

IoT vs big business

  • wanting to bridge concerns of small business and large corporations
  • both want the same reach of
  • standards & security
  • british gas https://twitter.com/connectinghomes & #connectinghomes 26/09/13
    • 25 startups in energy sector
    • bobo the polar bear: changes colour depending on how you manage your home energy
  • need to get corporates who are interested to actually meet the people who are doing stuff

Telling the right story

  • journalists will make stuff up…
  • make sure you tell a good story
  • e.g. onesie for a child with sensors
    • great for children with health conditions
    • but could be creepy for parents
  • you have to be completely clear about why a customer would want to buy what you’ve made
    • create a press release and a dropbox full of well-lit, decent pictures

Investment

  • investors < 60 years old will probably have never invested in anything other than the web…
  • they need to see more hardware things
  • new https://twitter.com/bg_ventures incubator

Retail is interested…

Building Complex Web Apps with Dart & Web Components

Chris Buckett https://twitter.com/chrisbuckett

  • V8 is as fast as they can get for javascript
  • dart is faster for some benchmarks already

dart language

  • optionally typed
    • when Dart runs, it pays no attention to the type information
    • use types for annotations
    • used for communication and validation
  • classes are also interfaces…
    • like duck typing
  • has privacy: just prefix with underscore
    • also has package shared equivalent
  • concurrency & async support
    • works with web workers in the browser
  • supports libraries by default
    • a single repository of libraries
  • built-in support for DOM
  • DartDoc is markdown based :-)
  • Dart VM not in any browser other than Dartium (special Chrome build)
    • but has been designed to compile to javascript
  • the language is still a beta, some restrictions
    • e.g. can’t modify variables on the fly

web components

  • Polymer is Google’s implementation of web components
  • polymer.dart is the dart version
  • polymer elements consist of a template & a script
  • elements get created and added to the shadow DOM
  • polymer elements have double-barrelled names
    • first part is namespace
    • hyphen is mandatory

Designing for diversity

or How to stop worrying and deal with Android fragmentation

Stephanie Rieger

a bit of history

  • port of leith, edinburgh: cruise ships stop
    • crew come out and use the internet
    • mostly filipino (25% of crew are filipino)
  • massive change in devices in a short time:
    • 2010: massive laptops
    • 2011: netbooks
    • 2012/13: tablets/phablets
  • and this is a change for people who send most of their income home
  • mobile phones were getting smaller, but needed large teams
  • started to change in 2005:
    • mediatek started offering reference design chipsets
  • went from giant companies to tiny ones
  • lots competed on price, but others went with regional specializations
  • by 2007, these had captured c.10% of global device sales
  • started experimenting wildly
    • e.g. 4 SIM phone with a project
    • could try out with tiny production runs
  • then Android changed things again in 2008
  • these companies could now switch from low-end feature phones to mid & high range
    • e.g. Lumia lookalike, running skinned Android, sells for £56!
  • other chipset vendors have emulated MediaTek reference designs
    • e.g. Rockchip, even Qualcomm
  • all the components are now tuned to work with Android by default

hardware diversity

  • variations at different levels
  • low-end: all off-the-shelf — around £56
  • slightly more customized: nice case, slightly customised Android, off-the-shelf chip
    • e.g. Xiaomi Hongmi
    • dual SIM, gorilla glass, highly customised Android (MIUI)
    • just £83
    • sold out first batch of 100,000 in 90 seconds…
  • we’re used to having customisation all the way down
  • but even larger companies are experimenting
  • Japan - KDDI Infobar: highly customised design & Android
    • fashion product
  • Oppo: Bluetooth LE camera trigger, touch panel on rear of phone
  • Yota e-paper rear display: can retain image for weeks without power
    • also has a capacitative touch strip
  • India: Aakash 2 is now c.£30
    • govt aiming to subsidise & distribute to 20 million students
  • it’s increasingly likely that devices will be made by “other manufacturers”

platform diversity

  • Android lets you change the keyboard
  • as a developer you can’t rely on the user having a standard keyboard
  • also lets you change the default app for intents
  • Paranoid Android lets you change the resolution of the device at the app level
    • as apps adjust to resolution & screen size, this lets you choose the way the app behaves on your device
  • MIUI is particular popular as it’s actively crowd-sourced
    • also because there are thousands of community build themes
    • including metaphor-based themes with virtual navigation
  • Oppo now lets you choose your ROM when you order your phone: Oppo’s Color or CyanogenMod
  • Cyanogen aiming to create a one-click installer
  • manufacturers are supposed to include the default Holo theme
    • but some small manufacturers don’t
  • manufacturers will also select OS versions and not update for a while
    • we will always see multiple versions live at any time
  • also multiple app stores especially in different countries
  • unofficial app store booths (e.g. in a Bangkok mall)
    • owner will recommend and install apps for you

how do we design for this?

  • design strategies will apply to Android IoT devices as well
  • basic principles:
    1. be flexible
    2. provide assets for all
    3. optimize layouts
    4. enable diverse experiences
  • can use weighting to scale cleverly
  • use asset grouping to enable variation
  • google publish screen density stats every 2-4 weeks
  • as screen gets bigger, letting the UI stretch doesn’t work so well
  • very similar to responsive design
  • set breakpoints in your layout where you change layout
  • want to avoid have three versions that you swap
  • instead aim for a continuum where content adjusts itself
  • Evernote is a good example
    • list view switches to grid view on larger screens
  • see also Google IO & Wordpress apps
    • Wordpress portrait tablet has list and detail side by side
  • lots of qualifiers
    • touch screen type: capacitative/trackball/finger
    • UI mode: car/desk/television/appliance!
  • not necessary to account for all combinations!
  • enabling intents allows future-friendly behaviour
    • don’t have to worry about new social networks in different countries
  • official android devices reached 1 billion last week
    • doesn’t include non-Google devices
    • probably doesn’t include cars, etc
    • doesn’t include experimental Android IoT devices

“diversity is not a bug, it’s a feature”

Arduino: Robots, WiFi and extreme hacks

David Cuartielles https://twitter.com/dcuartielles

  • based in Malmö Uni
  • all got into Arduino because wanted something for students
  • “as technology grows in our hearts, it gets smaller in size”
  • David’s background: worked at Infineon designing chips, then went to teach technology to arts students in Sweden
  • had six months to teach people to program
    • had to relearn how to learn
  • arduino not just boards:
    • boards
    • dev tools
    • documentation & community
  • not teaching about transistors: teaching how to make a light blink
  • arduino ide doesn’t have lots of features
    • but gives you feeling that you’re in a slimmed down version of Eclipse
  • short run manufacturing (c.10K) so can always change the design
  • hacked a full-sized car to be remote controlled
    • will see self-driving car on youtube soon…
  • in mexico city only room for 30% of students in university
  • instead they have arts centres for students who don’t get it
  • David taught electronics there:
    • sorted out electronics sourced from mexico as components not available
    • vimeo: ohoh robochock
    • vimeo: ohoh competition
      • trying to remote control their robotos
      • all interfering with same channel, but they don’t know!
  • arduino robot
    • designed with help from kids from mexico
    • 4 times winners of robocup
    • invested a lot of time in the AC/DC converter
    • so that performance is consistent across battery
  • educational experiment in Spain
    • 24 schools, over 500 kids (15 year-olds)
    • every week had three sessions: introduction, hacking, sharing
    • each week was thematic: e.g. sports
    • 25 kids, 5 projects: olympic games on Friday
    • 24 different experiments, but kids didn’t do everything
    • instead saw what other kids were doing
    • all details http://cuartielles.com/verkstad/en
  • hacked Sony SmartWatch to run Arduino
    • all published on github: underverg?
    • only thing couldn’t get hold of was bluetooth chip
  • natural fuse
    • plant lives or dies based on your carbon footprint
    • if it dies your electricity stops
    • can switch between selfish (grab from neighbours) and selfless (offer spare to neighbours) modes
  • fukushima
    • pachube/cosm was used for people to map the radiation themselves
    • using arduinos with geiger counters
  • open source white goods controller
    • modular: only need four abilities
    • mosfet, relay, pwr, ??
    • added UI module to provide output
  • everything is open source
    • pay me to make it: once it’s made, the work is done
    • you can pay me to maintain it

Whitespace Networks: Connect All The Things

Ben Ward https://twitter.com/crouchingbadger - http://love-hz.com

  • TV whitespace becoming available as moves from analogue to digital
  • however, will still be used for analogue radio mics etc
    • if we cock up they’ve got lots of famous people to complain!
  • weightless protocol)
    • 10 yr battery life
    • 5-10km range
    • unhelpfully called “super-wifi” in america (802.11AF)
  • needs a whitespace database…
    • being worked on right now
    • need to check every 15 minutes
    • check OFCOM for list of approved DBs
    • then check with your licensed DB
    • but you’re not reserving space, just agreeing to share
    • see also http://uk-whitespaces.spectrumbridge.com
  • neul now making a 4.5cm2 board
    • expected price $17 (at scale)
    • range: 1-8km
  • new phrase: “the fog” — like the cloud but on the ground :-)
  • open source boards
    • using software defined radio chip (lime something)
    • myriad RF
    • nuand bladeRF
    • also hackRF?
  • has some location capabilities based on triangulation
  • ideas?
    • bike theft detector using the frame as the antenna
    • oxford guerilla sensor network for flood detection

Appium: Mobile Automation Made Awesome

Jonathan Lipps https://twitter.com/jlipps

  • cross-platform solution for native & hybrid mobile automation
  • other options for ios:
    • calabash-ios
    • Frank
    • ios-driver
    • UIAutomation
    • KeepItFunctional
  • other options for android:
    • calabash-android
    • MonkeyTalk
    • Robotium
    • UiAutomator
    • selendroid
  • wanted to set some ground rules:
    • test the same app you submit to the store
      • don’t want to add additional code into the app
    • write your tests in any language & framework
    • use a standard automation API & spec
    • make it open source and foster a large community
  • appium supports:
    • ios, android & firefox os
    • real devices, simulators
    • native apps, hybrids, mobile web
  • can write one set of tests that work across multiple platforms
    • if you’re careful in how you structure your app
  • appium exposes an HTTP server than allows selenium to run
  • selenium webdriver has clients in many languages
  • and is a W3C working draft, so nearly a standard :-)
  • appium also extends webdriver protocol with additional mobile-specific behaviours
    • talking to selenium to get those changes into
  • under the hood:
    • iOS: Apple Instruments & UIAutomation
    • Android 4.2.1 and up: Google UiAutomator
    • older Android + hybrid: Selendroid
    • Firefox OS: marionette
  • written in node.js, so npm install appium and write tests in node
  • or else have a GUI runner to set flags
  • GUI also comes with an inspector
    • so you can see what’s going on at each step
    • (don’t need to be the app developer to write a test)
    • will create some initial code for you from your actions
  • find things by:
    • accessibility
    • element type
    • hiearchy xpath
    • android id
  • you can use a config dictionary for IDs/xpaths to help cope with platform/device differences
  • instruments can only run a single test at once per host machine
  • Sauce Labs have lots of devices available across the net

    • provides scaling and device selection
    • can switch to Sauce just by changing appium end point + adding credentials
    • also need to provide app: pre-upload using Sauce API, or host on a server somewhere
    • http://saucelabs.com/mobile
  • Q: can you switch between apps?

    • we could use a second app to turn on/off wifi
    • A: doesn’t work on iOS — when you jump to another app then UIAutomation loses its context and quits
  • Q: can you fake location?

Programming is terrible

Lessons from a life wasted

Tef https://twitter.com/tef

  • Watch out for The Group Project: getting together to work on a project that individuals have not made time for themselves…
  • make your code easy to replace more than easy to extend
  • people often learn more from maintenance than from building from new
  • people tend to teach in the way that they learned best
  • C, Java, C# are not a great starting point for new programmers
    • they require concepts to figure out even before you can make things happen
  • learning programming should be a side effect of doing something exciting
  • girl at MIT struggling with English grammar
    • Seymour Papert asked her to write a sentence or poetry generating programme
    • after a few hours, she exclaimed “I know what nouns are!”
  • view source
    • one of the best features of Scratch online
    • learn by seeing something you want to copy
  • computer anonymous
    • support group for everyone
  • for a starter, introduce constraints if they’re not already there