Friday, 25 September 2020

Mu, Edublocks and the Kitronik Inventor's kit

A friend of mine recently asked me about Python programming on the micro:bit. I told him that I wrote a free workbook about that a while back. (If you'd like to get a copy you can sign up here). 

 It's based around the excellent mu editor.

Code with Mu

Mu is a no-frills editor that you can use to develop and run programs on the micro:bit, Adafruit CircuitPython boards, the Raspberry Pi and other Python environments

Mu has just enough features to be usable without being daunting. I love it.

But some young students find text-based programming a bit scary. How can they get started?

Code with Edublocks

Some younger programmers are happier with block-based (visual) programming. For them, Edublocks is a great solution.

Edublocks is block based, runs in your browser, and looks like the popular Scratch environment, but it's Python-oriented.

Here's the Edublocks version of the code for the first experiment for Kitronik's excellent micro:bit Inventor's Kit.

Edublocks allows you to assemble a block-based program in your browser. Then, as with mu, you can deploy it to a

  1. micro:bit, 
  2. Raspberry Pi,
  3. CircuitPython board or 
  4. a Python environment on your laptop or workstation.

The Edublocks interface will look familiar to anyone who has explored block-based programming, but it has a secret power!

Blocks or Python

If you click on the button marked BLOCKS the display switches to show you the Python  script that corresponds to your block-based code.

That helps users to get familiar with normal text-based Python programming. There's so much fascinating and educational Python code on the web, but you need to be happy with text-based programming to master it.

There's more!

To help with moving to text-based code there's a split screen mode that shows both views at once.

Edublocks is s delightful project. Amazingly, Joshua Lowe was 14 when he created it!

Josh was introduced to programming by Alan O'Donohoe (@teknoteacher) and knew immediately that he wanted a career as a programmer. With Edublocks Josh has shared his passion with a new generation of programmers.

If there's enough interest I'll post some more Edublocks examples based on the experiments in the Kitronik Inventor's kit. Let me know in the comments below or in the micro:bit and MicroPython FaceBook group.

Wednesday, 23 September 2020

Build your own Arduino clone - updating the Shrimp

A Shrimp assembled

A while ago I ran a series of workshops showing how to build your own Arduino clone, based on a low-cost e-book called Making the Shrimp.


The book needs an update and I'm looking for reviewers. They will get a free copy of the book and a free kit to build. If you're interested, sign up here.

Friday, 18 September 2020

Getting started with Pimoroni's Tiny 4WD Rover

Kit contents with extras

I just finished my book on the Pimoroni Explorer HAT, and I'm celebrating!

I have treated myself to a Tiny 4WD Rover kit.

It looks a lot of fun, and should be simple to assemble. The product page has a link to a great blog post from Emma Norling which has detailed build instructions. I'll be following that closely.

I have already encountered one  minor gotcha.

You need a few extras over and above the parts in the kit.

Some of them are mentioned on the product page (battery, Pi zero W), but Emma found she needed spacers to mount the Explorer pHAT on the Pi zero W. I have suitable spacers in stock so I think I'll be OK.

I also got a LIPO shim and a USB charger.

Once I've completed the build I'll document it and provide a link on this blog.

A nice bonus if you hurry! 

Pimoroni are currently offering a free Pi Zero WH for customers spending more than £100 (excluding postage). The offer ends soon, but I managed to get my order in on time which got me the brains for the kit!

HAT book update

I mentioned that I'd finshed Explorer HAT tricks. It's got all the planned content, code and images; I'm wating for feedback from my copy editor and a few reviewers, so it may change a bit. Since the book is on Leanpub, readers will get any upgrades free.

The book price (currently $8 + tax) goes up again on Monday, so if you are thinking of getting it, buy it now! There's a 45-day money back guarantee so it's a risk-free purchase.

Friday, 11 September 2020

Explorer HAT tricks is nearly finished!

If you're thinking of experimenting with the Pimoroni Explorer HAT,  Explorer HAT tricks is a great place to start.

It covers over a dozen simple projects, complete with Python code, and you won't need to do any soldering.

If you're an experienced Pi user, you probably feel you don't need it, and that's fine. But if you're just starting out with Physical Computing, or new to the Explorer HAT, it's well worth a look, and there's a free sample available.

The book is now over 80% complete. You get the book from Leanpub, which means that you get updates free whenever the book changes.

The book was written for use with the Pimoroni Explorer HAT Pro but Pimoroni are currently offering a great deal on their Electronics pHAT kit. The kit costs just £19.92 including a Raspberry Pi zero. !

I've ordered one to experiment with. I know a couple of the projects in the book will need to change, but almost all of them will work unmodified.

I'll write up what works and what doesn't, and I'll be adding an appendix telling you how to set the Pi zero up.

One minor warning; the Pi zero kit does require you to solder a header to the Pi.

Another book is on the way

I'm also working on ideas for a follow-on book. More details soon!

A heads-up on Price

If you're hesitating about getting Explorer HAT tricks, now is a great time to get it. I'll be raising the price (currently a low, low 8$) when the book is finished.

Get the book here

Friday, 4 September 2020

Baby talk - Audio analysis on the Pi

I'm working on two projects at present.

I want to finish my book on the Pimoroni Explorer HAT, and I'm getting close. All of the code examples are available on GitHub, many with documentation, and the book itself is now 70% finished. It's still only $5, but the price goes up this weekend.

I've also started another project - one that I expect to take months or years. It's based on some fascinating work by J├╝rgen Schmidhuber and his team on a technique they call UDRL - Upside-Down Reinforcement Learning.

It looks as if they have cracked a problem that has been bugging me for decades. How can we get an ANN-based Parent Agent to train a Child Agent without hard-wiring in an unrealistic amount of innate behaviour?

If you're interested in their solution (and have a basic background in reinforcement learning) there are two papers on arxiv that explain it:

Training Agents using Upside-Down Reinforcement Learning and

 Reinforcement Learning Upside Down: Don't Predict Rewards -- Just Map Them to Actions.

 The papers use game-based learning tasks but I want to explore the idea of teaching a Child agent to speak by getting it to imitate the parent.

Sound analysis

The first step of my project is to generate inputs for an ANN from the sounds that the Child agent hears. I'm lucky to have a friend who is an expert on Hearing;   his recommended reading led me to some software on GitHub which analyses sound in much the same way as humans do.

The image to the right is the output generated from a short speech sample. It's like the spectrum you'd get from Fourier Analysis, but it's closer to what experts think the human nervous system does.