Thanks for bearing with us while we took the Easter break off – we return to you refreshed and full of chocolate.
The marvellous Spencer Organ, one of our Certified Educators, is a teacher at King Edward VI Sheldon Heath Academy (KESH Academy to its friends) in Birmingham. The school recently put on a student performance of The Wizard of Oz.
Spencer was in charge of performance technology, and wanted to see if he could fit a Raspberry Pi in as special effects equipment. The Tin Man’s heart presented a perfect opportunity. Spencer used the Pimoroni Unicorn HAT with a Model A+ to make the Tin Man’s heart (which was made out of red foil back when I did the same play as a kid) a glowing, animated thing of wonder. For more on HATs, see James’ post from last year.
(Spencer sensibly tweaked the brightness settings; a Unicorn HAT at full blast is positively retina-searing.)
The heart was programmed to pulse, giving the audience the impression it was beating.
The code was relatively simple and I used a simple list to assign the x,y and colour data for each pixel to be used.myList1=[3,2,3,4,1,2,3,4,5,0,1,2,3,4,5,6,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,2,3,5,6,7,1,2,6] myList2=[0,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,7,7,7] myList3=[1,1,2,1,1,2,2,2,1,1,2,2,2,2,2,1,1,3,3,2,2,2,2,1,1,3,3,2,1,2,2,1,1,2,2,1,1,2,1,1,1,1]
To give the effect of the heart beating and pulsating I gradually changed the brightness of the pixels from about 30 – 80%. It was important not to go too bright as I could have blinded the audience or other cast members!while True: for bright in range (30,80): UH.brightness(bright*0.01) heart()
This gave a very passable beating effect which looked stunning on the stage. The Pi was powered with a portable battery pack and to make backstage life easier the code was activated from boot using crontab with:@reboot sudo python /home/pi/Pimoroni/heart.py &
Spencer has made the Python script you’ll need to make your own available on his website; check out the Raspberry Pi section of his blog for more teaching and learning ideas with the Pi. Thanks Spencer!