About a week ago my BBC micro:bit arrived from Pimoroni and since then I have been figuring out what I can do with it. I usually blog in Dutch about that but since my write-up is much more useful if people that actually own a BBC micro:bit can read it. Which probably mostly means people from the UK at the moment. And also, this hadn’t been done in English yet (unlike the one for iBeacon).
The video shows the full process and demonstrates the process, I will limit myself here to some background info and the links + code that are mentioned in the video:
- Padlet that you see at the start of the video is available here (read only).
- Blogpost at passkit.com which is worthwhile background info;
- Forum post as the espruino forum that talked about BLE and micro:bit;
- Micro:bit page at espruino with a step-by-step for installation;
- Driver download page at mBed (windows);
- Cutting edge Espruino builds for micro:bit;
- Espruino web IDE extension for Chrome;
- Puck.js page at Kickstarter;
- Google URL shortener;
One time steps:
- Install the mBed seriel driver if you are on Windows;
- Install the most recent Espruino .hex (unless you reprogrammed the micro:bit for other languages);
- Install the web IDE extension for Chrome.
After that you us the web IDE if you want to set/change the URL that is being broadcasted.
Note that you can much more with Espruino and the micro:bit than set it as a Eddystone URL beacon! You can read and write the GPIO pins etc just like you can with the other languages. Have a look at the documentation on the site.
One Idea suggested by Gordon Williams was that you can read these values and then transmit these as part of the URL. There is a problem with that though. You can only use 17 bytes for the URL which means it has to remain short. Also, you would have to build a URL shortener into the code since I cannot add parameters after a URL that has been shortened with goo.gl.
The Espruino code snippet that I showed can be found on Github.com. After I completed the screencast, I optimized it a bit. The steps being:
- Take the (https) URL that you want to use;
- Add it to the Google URL shortener;
- Take the resulting URL and add it to this Eddystone URL generator tool;
- Take the part between {.. } in the resulting output:
and add it to the Espruino code between [..]. To make that simply cut-paste, I created a Javascript array in the code:
- Connect the micro:bit, upload the code and you’re done. You can disconnect the micro:bit and use a battery instead.
Tools used
For those wondering: To create the screencast I used Techsmith Camtasia Studio, although far from cheap it still is the best option on Windows. To mirror my LG G4 Android smartphone I used the free version of the LiveScreen App. To mirror my iPad Mini I used Lonelyscreen.
Credits
Like I said in the video: all credits for making this work go to Gordon Williams from Espruino. He figured out what the code needed to be and created the custom .hex needed on the BBC micro:bit. I am just the guy asking the questions, testing the code and writing it down. 🙂